Skip to content

fix: parse GHE SSH remote URLs with non-standard usernames for fuzzy schedule scattering#44502

Merged
pelikhan merged 9 commits into
mainfrom
copilot/fix-fuzzy-schedule-scattering
Jul 10, 2026
Merged

fix: parse GHE SSH remote URLs with non-standard usernames for fuzzy schedule scattering#44502
pelikhan merged 9 commits into
mainfrom
copilot/fix-fuzzy-schedule-scattering

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

gh aw compile incorrectly emits a "Fuzzy schedule scattering without repository context" warning inside valid GHE git repos whose SSH remote uses a non-git username — e.g. example@example.ghe.com:example-org/example-repo.git.

Root cause

parseGitHubRepoSlugFromURL (and extractHostFromRemoteURL) hardcoded git@ as the only valid SCP-style SSH username, so any GHE remote with a custom username silently fell through to the "no slug" path.

Changes

  • parseGitHubRepoSlugFromURL — replace the git@<host>: prefix check with a general strings.Cut(url, "@") split, then match <configuredHost>: on whatever follows. Handles git@github.com:owner/repo and example@ghe.host:owner/repo equally.
  • extractHostFromRemoteURL — same generalization for consistency; any [user@]host:path SCP-style URL now extracts the host correctly.
  • TestsTestParseGitHubRepoSlugFromURLGHE covers custom-username SSH, standard git@ SSH, HTTPS, SSH URL scheme, and a non-matching host guard. New case added to TestExtractHostFromRemoteURL for custom-username SCP URLs.
# Before: silently returns ""
parseGitHubRepoSlugFromURL("example@example.ghe.com:example-org/example-repo.git")

# After: correctly returns "example-org/example-repo"
# (when GITHUB_SERVER_URL=https://example.ghe.com)

Generated by 👨‍🍳 PR Sous Chef · 10.4 AIC · ⌖ 5.15 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · 6.57 AIC · ⌖ 6.74 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · 7.94 AIC · ⌖ 6.73 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · 9.71 AIC · ⌖ 6.72 AIC · ⊞ 7.1K ·
Comment /souschef to run again

…schedule scattering

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix fuzzy schedule scattering parsing for GHE SSH remote URLs fix: parse GHE SSH remote URLs with non-standard usernames for fuzzy schedule scattering Jul 9, 2026
Copilot AI requested a review from pelikhan July 9, 2026 06:02
@pelikhan pelikhan marked this pull request as ready for review July 9, 2026 10:54
Copilot AI review requested due to automatic review settings July 9, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes GitHub Enterprise (GHE) repository detection during gh aw compile by improving parsing of scp-style SSH remotes that use non-git usernames, so repository context can be derived correctly and fuzzy schedule scattering warnings are avoided in valid GHE repos.

Changes:

  • Generalizes parseGitHubRepoSlugFromURL to accept scp-style SSH remotes with arbitrary usernames (user@host:owner/repo).
  • Generalizes extractHostFromRemoteURL to extract the host from scp-style SSH remotes with arbitrary usernames.
  • Adds/expands tests covering custom-username scp-style SSH remotes (plus GHE HTTPS and SSH-scheme coverage).
Show a summary per file
File Description
pkg/cli/git.go Updates Git remote URL parsing to handle scp-style SSH URLs with non-standard usernames for both slug extraction and host extraction.
pkg/cli/git_test.go Adds a test case ensuring host extraction works for custom-username scp-style SSH remotes.
pkg/cli/git_helpers_test.go Adds a focused GHE test suite for slug parsing across SSH (scp and scheme) and HTTPS inputs.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread pkg/cli/git.go
Comment thread pkg/cli/git.go Outdated
Comment on lines +130 to +132
// SSH scp-like format: [user@]host:path — any username, not just git@
if _, afterAt, hasAt := strings.Cut(remoteURL, "@"); hasAt {
if host, _, found := strings.Cut(afterAt, ":"); found {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 606b1fa — corrected comment to say "GITHUB_SERVER_URL" to match what the test actually configures.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation now correctly supports both forms as advertised in the comment. Lines 151-155 handle user@host:path and lines 156-163 handle username-less host:path (with a guard to avoid matching scheme-based URLs). The fix was applied in 606b1fa.

Comment thread pkg/cli/git_helpers_test.go
@pelikhan

pelikhan commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review feedback, and rerun checks once the branch update settles.

Unresolved review feedback to address first:

  • copilot-pull-request-reviewer review feedback remains open.

Run: https://github.com/github/gh-aw/actions/runs/29016118662

Generated by 👨‍🍳 PR Sous Chef · 10.4 AIC · ⌖ 5.15 AIC · ⊞ 7.1K ·
Comment /souschef to run again

…/repo)

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot July 9, 2026 13:05
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Triage — Run §29020837798

Field Value
Category bug
Risk 🟢 Low
Score 55 / 100
Action 🔄 batch_review
Batch url-parsing-fixes (with #44502)

Score breakdown: Impact 23 + Urgency 18 + Quality 14

Rationale: Targeted fix for GHE SSH remote URL parsing — non-git username caused false "no slug" warnings. Small diff (107 +/ 15 −) with tests. Low blast radius. Labels already set to defer by prior auto-triage; recommend re-evaluating as batch_review given clear tests and narrow scope.

Generated by 🔧 PR Triage Agent · 77.6 AIC · ⌖ 14.7 AIC · ⊞ 5.4K ·

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

pr-sous-chef
@copilot please run the pr-finisher skill, ensure the branch is up to date, address any remaining review feedback, and rerun checks.
...

Branch is up to date with main (merged in 5c1334f, lock files added in 072d638). All review feedback remains addressed in 606b1fa. Tests pass. Ready for CI re-trigger and merge.

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

PR Triage - Run 29041860272. Category: bug | Risk: Low | Score: 42/100 | Action: defer (carry-over relabeled). OPEN. Parses GHE SSH remote URLs with non-standard usernames for fuzzy schedule scattering (107+/15-, 3 files). Correct fix but narrow use case. Await CI and review.

Generated by 🔧 PR Triage Agent · 78.2 AIC · ⌖ 8.53 AIC · ⊞ 5.4K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

pr-sous-chef
@copilot please run the pr-finisher skill, ensure the branch is up to date, address any remaining review feedback, and rerun checks.

Run: https://github.com/github/gh-aw/actions/runs/29043300437

Generated by 👨‍🍳 PR Sous Chef · 4.36 AIC · ⌖ 7.98 AIC · ⊞ 4.7K ·
Comment /souschef to run again

…fix-fuzzy-schedule-scattering

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review comments, refresh the branch if needed, and rerun checks.

Generated by 👨‍🍳 PR Sous Chef · 7.75 AIC · ⌖ 9.11 AIC · ⊞ 7.1K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage — Run §29061171191

Field Value
Category bug
Risk 🟢 Low
Score 42/100 (Impact 18 + Urgency 12 + Quality 12)
Action 📦 batch_review
Batch url-parsing-fixes

GHE SSH URL parsing fix for non-standard usernames. 3 files, 107 additions. Low risk, narrow scope. Ready for batch review.

Generated by 🔧 PR Triage Agent · 155.8 AIC · ⌖ 8.06 AIC · ⊞ 5.4K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review comments, ensure the branch is up to date, and rerun checks.

Generated by 👨‍🍳 PR Sous Chef · 7.94 AIC · ⌖ 6.73 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address unresolved review comments, ensure the branch is up to date, and rerun checks.

...

PR finisher completed. All review feedback addressed in 606b1fa. Branch is up to date with main (HEAD 8e7ffd2, base f2bff5d). Local validation passed: fmt ✓, lint ✓ (0 errors), test-unit ✓, recompile ✓. The remaining unresolved review thread is outdated and has been replied to. CI re-trigger required by maintainer (agent pushes don't trigger workflows). PR is ready for merge pending CI verification.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

pr-sous-chef
@copilot please run the pr-finisher skill, address unresolved review comments, ensure the branch is up to date, and rerun checks.

Run: https://github.com/github/gh-aw/actions/runs/29065468296

Generated by 👨‍🍳 PR Sous Chef · 9.71 AIC · ⌖ 6.72 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

pr-sous-chef
@copilot please run the pr-finisher skill, address unresolved review comments, ensure the branch is up to date, and rerun checks.
...

PR finisher complete. No changes needed. All review feedback addressed in 606b1fa. Branch up to date (HEAD 8e7ffd2). Local validation passes (fmt/lint/test-unit/recompile ✓). Recent CI runs successful. The unresolved review thread is outdated and replied to. Ready for merge.

@pelikhan pelikhan merged commit acc3573 into main Jul 10, 2026
32 checks passed
@pelikhan pelikhan deleted the copilot/fix-fuzzy-schedule-scattering branch July 10, 2026 04:03
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fuzzy schedule scattering fails to parse GHE SSH remote URLs

4 participants