Repository navigation
Description
Summary
Mentioning the Slack bot with a pasted GitHub URL extracts the wrong repo. The
mention repo pattern treats github.com as the owner segment, so
https://github.com/aws-samples/sample-interview-assistant-serverless/issues/24
resolves to the repo github.com/aws-samples and the task is rejected with
Repository 'github.com/aws-samples' is not onboarded.
Pasting a URL is the natural thing to do in Slack — Slack linkifies and unfurls
it automatically — so this affects effectively every new user.
Reproduction
In a channel where the bot is installed:
@bot fix https://github.com/aws-samples/sample-interview-assistant-serverless/issues/24
Observed: ❌ reaction and reply
Failed to create task: Repository 'github.com/aws-samples' is not onboarded. Register it with a Blueprint before submitting tasks.
Expected: task created against aws-samples/sample-interview-assistant-serverless, issue 24.
Root cause
cdk/src/handlers/slack-events.ts:185:
const repoPattern = /\b([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+(?:#\d+)?)\b/;. is inside the owner character class, so github.com is a valid owner match
and the pattern matches the leftmost <host>/<first-path-segment> pair.
Verified against the exact inbound text (after <@Uxxx> stripping):
| Input | Extracted |
|---|---|
fix <https://github.com/aws-samples/sample-interview-assistant-serverless/issues/24> |
github.com/aws-samples |
fix https://github.com/aws-samples/sample-interview-assistant-serverless/issues/24 |
github.com/aws-samples |
fix aws-samples/sample-interview-assistant-serverless#24 |
aws-samples/sample-interview-assistant-serverless#24 |
Two aggravating factors:
- The bad value passes
isValidRepo(cdk/src/handlers/shared/validation.ts:45),
which also permits dots in the owner segment — so it reaches the onboarding
check rather than failing validation with a clearer message. - A URL match pre-empts the channel default repo
(bgagent slack onboard-channel), becausehandleSubmitonly falls back to
the default when no repo token matched
(cdk/src/handlers/slack-command-processor.ts:207-217). So an onboarded
channel does not work around it.
Proposed fix
In slack-events.ts, before the bare owner/repo match:
- Normalize GitHub URLs to
owner/repo#N— recognize
https://github.com/<owner>/<repo>optionally followed by
/issues/<n>or/pull/<n>, and strip Slack's<...>/<url|label>wrapper. - Require the matched URL host to be
github.com/www.github.com. - Exclude host-like owners from the bare pattern so a stray
example.com/foo
cannot be mistaken for a repo.
Acceptance criteria
- Pasted issue URL, PR URL, and bare repo URL all resolve to
owner/repo, with the issue/PR number carried through - Slack's
<url>and<url|label>wrappers handled - Non-GitHub URLs do not produce a repo match; the channel default applies instead
- Existing
owner/repo#Nshort form keeps working - Unit tests in
cdk/test/cover each row of the table above
Activity
fhuthmacher commentedon Sep 2, 2026
Starting implementation.
krokoko commentedon Nov 24, 2026
Fixed in #1075, please reopen if you still face any issue, thanks !
fix: quick wins from a sweep of the open issues (aws-samples#1075)