Repository navigation
Refresh sidebar activity when a native chat tab arrives after its status - #37151
Conversation
…mmary perf contract
|
No actionable comments were generated in the recent review.
|
Review loop statusThe problem. A workspace's status dot in the sidebar could show no activity while a native chat in it was running. This happened when the chat's status arrived before its tab, as with a restored chat. The sidebar's shared activity cache saved the empty answer from that moment. When the tab arrived, none of the inputs the cache compared had changed, so the dot stayed empty until something unrelated refreshed it. What changes for users. The dot now shows the running chat as soon as its tab appears, whatever the order. Its look, colors and labels are unchanged. Review (light path). One adversarial reviewer confirmed the light-path classification and checked every input the summary reads. With this change, each input is either compared directly or covered by an input that changes whenever it does. No other cache was found with the same late-tab problem. Findings:
Reference comparison: a fresh reviewer compared the whole mechanism with the common pattern: where the value comes from, what invalidates the cache, what wakes each row and what keeps the rest quiet, how staleness works, and that nothing here can block a user action. The PR adopts the common pattern: track every input, and keep a workspace's previous result when nothing changed. The one difference is that Orca keeps terminal panes and native-chat tabs as separate inputs. It's labelled intended, since Orca supports both kinds of surface. No findings. Verified: the two test files pass locally (26 tests) and in CI. QA: tests only. This changes how the sidebar computes a value it already shows; there's no new screen, layout, copy, interaction or lifecycle behavior, so no app run or screenshots. CI is fully green on the current head c26ba01, including the typecheck that main's breakage had skipped before. Since the reviewed head 0e61870: main was merged once more (d028800, origin/main 9463cf4) after main's own CI breakage was fixed by #37174 and #37195; no conflicts, and none of main's changes touch this PR's files. Then c26ba01, a test-only lint repair (above). No shipped code changed since the review. For Brennan's review
|
Problem. In the sidebar, each workspace row shows a status dot for the agents running in it (working, needs permission, done and so on). A native chat that was already running could leave its workspace showing no activity. This happened when the chat's status reached the app before its tab did, for example when a chat is restored at startup. The first time the row was worked out, the status couldn't be matched to a tab yet, so the row came out empty. That empty answer was then cached. When the tab arrived a moment later, nothing the cache watched had changed, so the row stayed empty until something unrelated happened to refresh it.
What changes for users. The workspace's status dot now shows a running native chat as soon as its tab appears, however the status and the tab are ordered. Nothing else about the dot, its colors or its labels changes.
How it works. The sidebar works out every workspace's activity in one shared pass and caches the result. That cache now also refreshes when the set of chat tabs changes or when the status list changes, which are the two things it reads but used to ignore. When a refresh produces the same answer for a workspace, that workspace keeps its previous result, so its row doesn't redraw. The existing timer that marks old statuses as stale is unchanged. Nothing new is saved.
Plan: adopt the common pattern of tracking every immutable source snapshot and preserving equal derived answers. One PR, estimated 10 production lines and 180 test lines; no saved field, wire change, admission check, ownership, lifecycle or ordering change. The recent history contains status-rollup and orchestration attribution work, but no repair of this missing-input cache symptom or recorded incident/revert. Nearby #34890 and #34891 do not change the files in this PR. Ask-early answers: no added capability or changed requested outcome; no older-client/CLI/data regression; no new layout or interaction; no conflicting ruling. No unresolved product decision. This stays outside the full plan categories, so plan reviewers are not required.
Review classification (light):
Validation: the late-tab case fails on main and passes here (the selector test plus a mounted test using the real sidebar hook and the real store actions). The mounted test runs at 10 and 100 workspaces, each with a chat tab and a working status, and drives each trigger as its own update: an unrelated store write, a late tab arrival, a same-state status ping, a chat title change, and a real state change. Unrelated writes, pings and title changes redraw no rows. A late tab or a real state change redraws only its own row. The test counts status and tab reads separately from redraws, and they stay linear (at most 4 per workspace per update, no more than 10x from 10 to 100 workspaces). Turning off the equal-result reuse makes these tests fail. CI covers lint and typecheck.
QA classification: tests. This changes only how the sidebar computes a value it already shows. There is no new screen, layout, interaction, copy or lifecycle behavior.
Intended domain difference from the common pattern: terminal pane identities and separately represented native-chat tabs remain inputs because Orca supports both surfaces. The cache now tracks both. No temporary differences.
Tracked in STA-13055.