feat(coder): the pull request pill shows the PR of the branch checked out in the agent's sandbox, recorded at turn end

Merged
DA
8d ago
+268-443

What

Dean's rule: show whatever pull request is attached to the branch currently checked out in the agent's sandbox, whatever branches it switched through on the way. The agent keeps publishing exactly as today with git push and gh pr create; nothing of ours creates a PR.

  • Read the branch at turn end. coder/hooks/store.ts runs git branch --show-current in the checkout as a turn ends, before the sandbox stop it already did. The host's new recordBranch saves the answer on the agent's row; a detached HEAD prints nothing and saves null. A read or write that fails is logged and the sandbox still stops. A turn that never opened the sandbox records nothing, as today.
  • One new nullable column, coding_agent.branch, through migration 0068 and coding-agent-schema.ts (drizzle-schema.test.ts holds it).
  • published.ts reads the row. No branch, nothing to show. Otherwise the existing pullRequestOfBranch for the PR with its checks, and branchStands for the branch chip when there is no PR. The cache and its ended-key behaviour are unchanged.
  • The transcript scan is deleted whole: publishedInTranscript, branchNamedIn, pullRequestNamedIn, allMessages, SCAN_PAGES, the regex constants, and tests/coder-host-published.test.ts. sameName and pullRequestByNumber lose their export since the scan was their only outside consumer.
  • The "opened #N" notification already reads the pull-request route, so it follows the row with no change of its own. README and PLANNING prose updated.

Tests

  • coding-agents-app.test.ts: the pull-request route answers the PR for the row's branch (with checks and the TTL), nothing when the row has no branch and GitHub is not asked, the branch chip when pushed with no PR, a fresh read at turn end, and the unreachable-repository refusal.
  • coder-host.test.ts: recordBranch saves the branch, saves null on a detached HEAD, and when git cannot answer it writes nothing and does not fail, so the stop after it runs.

Verification

./scripts/check.sh exits 0. No Mac UI change, so there is no verify.sh evidence and no screenshots: the change is server-side and the pill renders from the same wire answer as before. CI could not verify the Mac.

šŸ¤– Generated with Claude Code


Open workspace in Conductor


Devin Review