agent pane: per-chat pieces keep their last value across a switch, reconnect or reload
Many pieces of the agent pane are read per chat, folder, scope or harness. Each drew nothing, a stand-in or Loading on a switch, reconnect or reload until its read came back, then popped in or changed size. Each now keeps its last answer on the page and draws it in the first render; the read that follows only refreshes it.
| piece | before, on a switch, reconnect or reload | now |
|---|---|---|
| edited-files card, Changes counts | tool-call counts, then the checkpoint's (numbers and height change) | each chat's answered checkpoints (16 chats; a running turn's incomplete checkpoint isn't kept) |
| worktree pill | gone, then back, pushing the header tools | last worktree per folder |
| Changes view on Retry, stage, unstage, commit | whole list to Loading | keeps the list, branch names and threads, still clickable, until the new answer; picking a scope still starts from Loading |
| harness health notice | cleared on disconnect, pops in late and pushes the composer | last answer per harness, kept through a reconnect |
| slash commands | "No commands" until the attach | each chat's commands from its last visit (32 chats) |
| empty chat while connecting | blank transcript, then the hero | the hero (only a failed connect drops it) |
| bookmark dots | dropped on reconnect, then back | kept until the new connection's read |
| chats list and peers on a new chat's handshake | emptied until the first client frame | kept |
| subagent view on a chat switch | one frame of the old subagent (empty child view) | closed in the same render |
| transcript first frame | drawn at a guessed 600x760, then measured | measured before first paint, starting from the last box |
| composer location row | one frame of the wrong computer with no folder | the chat's computer in the same render |
#123 links | the chat before's repository | each folder's repository from its last read; none until read |
Evidence
Probes record committed renders (layout effects, before paint). Each test failed on the base before its fix:
webviews/test/agent-pane-switch-frames.test.ts(Chromium) passes in CI at aa4a298.webviews/test/agent-pane-keeps-last-on-switch.test.tsx: checkpoints, worktree pill, Changes reload, empty chat hero. 4 of 4 red at ea4d53d, green at d8b1d72.webviews/test/thread-bookmarks.test.tsx: reconnect keeps marks. Red at 0c78f31, green at 3b75e26.
Health, commands, the handshake list, the subagent view, the transcript box, the location row and links have no test of their own here.
Other checks:
tsc --noEmit: 0 errors.vp fmtandvp lintare clean on the changed files.bun test test/: no failures beyond the base run except tests that pass alone and fail only under load. Those arechanges-more-linesandchanges-file-review, which pass alone and together with the new test; andapp-themeandpalette-eval, as on base.- Not done: a live app dogfood.
The All chats list on the New Tab page is left out; the New Tab work owns it.
Changelog
Fixed: in agent chats, the edited-files card, worktree pill, Changes list, sign-in notice, slash commands and bookmarks no longer blink or jump when you switch chats, reconnect or reload.
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the agent pane so per-chat, per-folder, per-scope, and per-harness pieces keep their last value across a chat switch, reconnect, or reload, instead of drawing nothing, a stand-in, or Loading until their read came back.
Bug Fixes
- The edited-files card, Changes counts, worktree pill, Changes list, harness health notice, slash commands, bookmark dots, the composer location row, and transcript links draw their last answer in the first render; the read that follows only refreshes it.
- An empty chat keeps its hero while the pane connects; only a failed connect drops it.
- A new chat's handshake keeps the chats list and peers until the first client frame.
- A chat switch closes the subagent view in the same render, not an effect later.
- The transcript measures its box before first paint, starting from the last measured size.
- Reloading the Changes scope on screen (Retry, stage, unstage, commit) keeps the list, branch names, and threads until the new answer; picking a scope still starts from Loading.
- During a held switch, actions (Stop, archive, queue edits, permission and secret answers, picks, fork, ask) go to the chat on screen, never the hidden one; a send waits for the switch to draw and reads the handoff first, refusing with "The agent connection is not open." when it cannot.
- Answers land only in their own chat's state, a failed read (a removed worktree or unreachable connection) drops the kept value, and a new chat never inherits a prior chat's computer pick.