fix(planner): plumb github_repo through API + auto-detect from git remote#198
Merged
Merged
Conversation
…mote (refs #193) After PR #197 landed the system-prompt reconciliation, manual smoke revealed the pre-fetch still didn't run because the default owner/repo was never actually resolvable: `extract_github_refs` drops same-repo refs like "Issue #113" when default_owner/default_repo are empty, and the Planner only read them from `GITHUB_OWNER`/`GITHUB_REPO` env vars (undocumented). The dashboard's REMOTE repo picker never reached the Planner either — `PlannerStartRequest` had no `github_repo` field. End-to-end plumbing: - `PlannerStartRequest` now accepts `github_repo` + `workspace_type`. - Dashboard `startSession` sends both on REMOTE and LOCAL starts. - `create_planner_session` stores `github_repo` on the session. - When `github_repo` is not passed, the server auto-detects it by parsing `remote.origin.url` from the workspace's `.git/config` (SSH and HTTPS, with/without `.git` suffix, origin-only). - `_prefetch_github_refs_for_message` prefers session.github_repo, falling back to env vars for CLI/headless use. Anti-hallucination + operator ergonomics: - System prompt now explicitly forbids inventing issue/PR contents when the "=== PRE-FETCHED GITHUB CONTEXT ===" block is absent — the LLM must tell the user the context is missing instead of fabricating plausible-sounding bodies. - New loose `#\d+` heuristic fires a warning log when the message contains `#N` references but no default repo is resolvable, so operators get a breadcrumb instead of a silent drop. Tests: 12 new tests covering explicit-repo plumbing, git-remote auto-detect (SSH/HTTPS/non-origin/non-github), session-repo used for pre-fetch, env-var fallback, silent-drop warning, and the anti-hallucination system prompt. 73/73 planner tests pass; 205/205 related tests pass. Closes amended ACs #3a-#3e in #193. AC #3f (manual smoke on LOCAL and REMOTE) follows post-merge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes amended ACs #3a-#3e from #193. After PR #197 fixed the Planner's system-prompt self-denial, manual smoke revealed the pre-fetch still didn't run because the default owner/repo was never actually resolvable:
extract_github_refssilently drops same-repo refs like "Issue #113" whendefault_owner/default_repoare empty, and the Planner only read those fromGITHUB_OWNER/GITHUB_REPOenv vars — which aren't in.env.example. The dashboard's REMOTE repo picker never reached the Planner either.Plumbing — end-to-end
PlannerStartRequestnow acceptsgithub_repo+workspace_type(dev-suite/src/api/models.py)startSessionsends both on REMOTE and LOCAL starts (dashboard/src/lib/stores/planner.svelte.ts,dashboard/src/lib/components/views/ChatView.svelte)create_planner_sessionstoresgithub_repoonPlannerSessiongithub_repoisn't passed, the server auto-detects fromremote.origin.urlin the workspace's.git/config(handles SSH, HTTPS, with/without.git, origin-only)_prefetch_github_refs_for_messagepreferssession.github_repo, falling back to env vars for CLI/headless useAnti-hallucination + operator ergonomics
=== PRE-FETCHED GITHUB CONTEXT ===block is absent — directly addresses the fake "bug: Terminal panel drag-to-resize breaks after ~1/3 screen height #113 Architect blueprint schema" hallucination from the first manual smoke#\d+heuristic fires a warning log when a message contains#Nrefs but no default repo is resolvable, pointing at the missing config instead of silently droppingTest plan
uv run pytest tests/test_planner.py -v— 73/73 pass (12 new inTestPlannerGithubRepoPlumbing+TestPlannerAntiHallucination)uv run pytest tests/test_github_fetch.py tests/test_mcp_tools.py tests/test_architect_two_phase.py tests/test_api.py— 205/205 passpnpm check— 0 errors, 0 warningsC:/Users/maber/Documents/GitHub/agent-dev— auto-detectsAbernaughty/agent-devfrom.git/config, fetches real bug: Terminal panel drag-to-resize breaks after ~1/3 screen height #113 ("Terminal panel drag-to-resize breaks...")Abernaughty/agent-dev— sendsgithub_repoexplicitly, same resultRefs #193
🤖 Generated with Claude Code