Agent chat header: the Environment line leaves a worktree's branch to its pill; / reads /

Merged
TE
16d ago
+29-3

Two non-blocking findings from #23236's review, fixed:

  • A local chat in a worktree named its branch twice in the header: once in the new Environment line and once in the worktree pill (WorktreePill.tsx). The line now leaves the branch out when the chat is local and runs in a worktree (summary.worktree). A remote chat has no pill, so its line keeps the branch.
  • A chat whose folder is / trimmed to an empty path, which projectLabel read as "No folder". It now reads /.

Tests

webviews/test/chat-environment-line.test.tsx adds a local worktree chat without the branch, a remote worktree chat with it, and the root folder reading /.

Observed / Not run

  • Observed: the TypeScript check is clean for both files, and the pre-push gate is clean.
  • Not run: bun tests, because this host (cosmic-gray) runs no tests. CI's webview shards run them.

Changelog

none

🤖 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 two issues in the agent chat header's Environment line: branch duplication in worktrees and the root folder label.

  • A local chat in a worktree no longer names its branch in the Environment line, since the worktree pill already shows it; remote chats, which have no pill, keep the branch.
  • A chat whose folder is / now reads / instead of "No folder".