Agent chat: the Environment line and Inspector show the branch acpmux reports

Merged
TE
17d ago
+67-1

The chat header's Environment line (#23236, #23259) and the Inspector's Environment never showed a branch in the real app. acpmux's session detail sends the folder's branch as gitBranch (cmux-tui/crates/acpmux/src/hub/views.rs, session_detail), but the webview read summary.branch, which acpmux never sends. The summary now falls back to gitBranch. The #23259 review found this.

Changelog

Fixed: The agent chat's Environment line and Inspector now name the chat's git branch.

Test

bun test test/chat-summary-git-branch.test.ts (in webviews/): drives the direct client with a fake acpmux whose attach answers gitBranch.

  • Commit d07e96528be4 (test only): expected to fail on base (summary.branch is undefined).
  • Head: expected to pass.

Observed / Not run

  • Not run locally: cosmic-gray runs no bun tests. CI's webviews tests run it on this head.
  • Pre-commit format hook passed.

🤖 Generated with Claude Code

Agent session: cosmic-gray


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the agent chat's Environment line and Inspector so they show the chat's git branch in the real app.

acpmux's session detail sends the folder's branch as gitBranch, but the webview read summary.branch, which acpmux never sends, so no real chat ever showed a branch. The summary now falls back to gitBranch.

  • Adds a test that drives the direct client with a fake acpmux to verify gitBranch is used and that a folder outside git or on a detached HEAD still shows no branch.