Skip to content

fix: gh tool targets the checkout's own GitHub repo - #99

Merged
ajianaz merged 1 commit into
developfrom
fix/gh-repo-detect
Sep 18, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/gh-repo-detect

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

What

The gh tool's fixed --repo is now derived from the checkout's remote.origin.url (https/ssh/URL forms, strict charset validation, leading-dash refused), falling back to codecoradev/tole when undetectable. Applied to both registry builders.

Why

Dogfood finding from the integration-surfaces work: running tole in any project other than the tole checkout made gh issue/pr ops act on the wrong repository — a hardcoded default the scan had flagged and a live mission confirmed.

Changes

  • github_repo_from_remote_url (pure, unit-tested URL parser)
  • detect_github_repo (git config lookup, 5s ceiling, shell-tools gated)
  • both GhTool registration sites use the detected repo
  • 3 new tests (parser forms, garbage rejection, real-checkout detection)

Testing

  • fmt / clippy -D warnings / test --workspace ✅ (206 tests)
  • Live E2E: gh issue_view fetched issue 94 with correct state/title from the tole checkout
  • cora review --staged: No issues found

Dogfood finding (2026-09-18): GhTool's --repo was hardcoded to
codecoradev/tole at registration, so running tole in ANY other project
made gh issue/pr ops act on the wrong repository.

The CLI now asks the checkout itself (git config remote.origin.url) and
derives owner/name — https/ssh/URL-suffix forms, strict charset,
leading-dash refused. Falls back to codecoradev/tole when there is no
GitHub origin. Applied to both registry builders (interactive CLI and
MCP server mode); URL parser + real-checkout detection covered by
tests.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit fd930a7 into develop Sep 18, 2026
16 checks passed
@ajianaz
ajianaz deleted the fix/gh-repo-detect branch September 18, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant