Skip to content

fix(planner): plumb github_repo through API + auto-detect from git remote#198

Merged
Abernaughty merged 1 commit into
mainfrom
fix/issue-193-planner-repo-plumbing
Apr 17, 2026
Merged

fix(planner): plumb github_repo through API + auto-detect from git remote#198
Abernaughty merged 1 commit into
mainfrom
fix/issue-193-planner-repo-plumbing

Conversation

@Abernaughty

Copy link
Copy Markdown
Owner

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_refs silently drops same-repo refs like "Issue #113" when default_owner/default_repo are empty, and the Planner only read those from GITHUB_OWNER / GITHUB_REPO env vars — which aren't in .env.example. The dashboard's REMOTE repo picker never reached the Planner either.

Plumbing — end-to-end

  • PlannerStartRequest now accepts github_repo + workspace_type (dev-suite/src/api/models.py)
  • Dashboard startSession sends both on REMOTE and LOCAL starts (dashboard/src/lib/stores/planner.svelte.ts, dashboard/src/lib/components/views/ChatView.svelte)
  • create_planner_session stores github_repo on PlannerSession
  • When github_repo isn't passed, the server auto-detects from remote.origin.url in the workspace's .git/config (handles SSH, HTTPS, with/without .git, 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 — 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
  • New loose #\d+ heuristic fires a warning log when a message contains #N refs but no default repo is resolvable, pointing at the missing config instead of silently dropping

Test plan

  • uv run pytest tests/test_planner.py -v — 73/73 pass (12 new in TestPlannerGithubRepoPlumbing + 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 pass
  • pnpm check — 0 errors, 0 warnings
  • Manual smoke (post-merge): "Review and implement the fix for GitHub Issue bug: Terminal panel drag-to-resize breaks after ~1/3 screen height #113"

Refs #193

🤖 Generated with Claude Code

…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>
@Abernaughty Abernaughty merged commit 1f78492 into main Apr 17, 2026
3 checks passed
@Abernaughty Abernaughty deleted the fix/issue-193-planner-repo-plumbing branch April 17, 2026 21:53
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