Repository navigation
fix(native-chat): show new Claude and Codex chats in the workspace sidebar before the first send - #47929
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
…debar before the first send A chat's journal publishes status null until its first request, and the renderer projection dropped the row for that summary. Project a published summary with no status as an idle session-boundary row, the same shape a TUI has after SessionStart, so the first send updates the same row in place. A missing summary still removes the row and a failed launch still marks it failed. The opened row keeps its first clock when the host republishes the empty journal. Fixes stablyai#47919 Co-authored-by: David Chen <[email protected]>
b6c3eac to
60af895
Compare
Co-authored-by: dzkchen <[email protected]>
ELI5
When you open a new Claude or Codex chat, it now shows up under its workspace in the sidebar right away, the same way a terminal agent does. Before, it only showed up after you sent the first message.
What Changed
How it works: the chat journal publishes a summary with
status: nulluntil the first request is recorded. The renderer projection (structured-agent-session-status-projection.ts) used to treat that like "no session" and removed the row. Now a summary with no status becomes an idle session-boundary row. That is the same shape a terminal agent row has after SessionStart, so the dot, card rollup and notes menu read it exactly like a fresh TUI row. A missing summary still removes the row, and a failed launch still marks it failed. When the host republishes the empty journal, it stamps it with the current time. The opened row keeps its first clock anyway, so its age does not reset. The comments in the notes and send-target helpers now match this behavior.Why
The bug lives in one place: the projection drops the published-but-unsent summary. Fixing it there keeps a single source for agent rows, so the sidebar, notes menu and CLI all read the same store entry. The wire contract and host stay unchanged, so mixed-version hosts keep working. We looked at adding a separate synthetic "open chat" row in the dashboard rows stage. That adds a second row source that every consumer would have to filter, so we chose this narrower change.
Linked Issue
Fixes #47919
Original fix by @dzkchen in #47929; final version reworked during the bug bash.
Reported by @dzkchen
Visual Proof
N/A: we did not capture new screenshots in this step. This change only moves where the row's data comes from (a renderer store projection). The before/after UI is what the original PR showed: the empty chat now has its row under the workspace. The new unit tests cover this behavior.
Testing
Repro on main: open a Claude or Codex chat in Chat view from the tab bar's
+menu. No row appears under the workspace until you send a message.New
structured-agent-session-status-projection.test.ts(3 tests, real store):stateStartedAt.Ran the targeted vitest suites for native-chat status and agent-session messaging, oxlint, oxfmt, anti-slop oxlint, native-plugins oxlint, ast-grep and the changed-code quality gate on the touched files. All clean. Tested on macOS. The change is renderer-only and has no platform-specific code.
Performance
None that matters. This runs in the renderer status bridge once per host status emission, and only for chats whose input changed. It is not on a typing, terminal-stream or polling path, and it adds no I/O, timers or subprocesses. Microbench with the real store, 1000 chats in one transaction, 3 runs each:
One chat costs about 0.02 ms. A 1000-chat burst only happens at restart, and it costs the same as 1000 sent chats on main.
Risk
Level: Low
An unsent chat now has a row that reads "done + session boundary", like a fresh terminal agent. If the boundary flag were mishandled, the row could show a stale age or look finished. Tests cover the clock and the in-place update. Known limit, unchanged from main: host and mobile
orca worktree psstill leave out unsent chats, because their status is null on the wire. A plain revert backs this out.Review
Reviewed the projection's remove/failed/opened branch table, the clock continuity rule, and the notes and send-target consumers of status-less chats.
Agent skill upstream boundary
Notes
Renderer-only. Security, cross-platform, SSH, mobile and backwards-compatibility impact: none, because the wire contract and host are unchanged.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)