Skip to content

Refresh sidebar activity when a native chat tab arrives after its status - #37151

Merged
brennanb2025 merged 7 commits into
mainfrom
brennanb2025/lt1031-sidebar-summary
Nov 1, 2026
Merged

brennanb2025 merged 7 commits into
mainfrom
brennanb2025/lt1031-sidebar-summary

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​231 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​223
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6

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):

  • Small: one production selector, under 150 changed production lines.
  • Outside risky areas: renderer-only derived summary cache; no persistence, ownership, lifecycle, ordering, transport, process, authentication, orchestration-runtime or default changes.
  • Not a repeat: file history has no fix for this cache symptom in the last 30 days, and no incident or revert.
  • Local effect: one pure derived selector and its tests; existing hooks and rendered UI are unchanged.

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.

@brennanb2025
brennanb2025 marked this pull request as ready for review November 1, 2026 22:02
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 34ddf21d-ebd8-4c77-86bc-dfe7362a8a65
Commits

Reviewing files that changed from the base of the PR and between 9463cf4 and c26ba01.

Files selected for processing: 3
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary-subscription.test.tsx
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.test.ts
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Walkthrough

The activity-summary cache now tracks the unified-tab and agent-status map references used to build summaries. Tests cover how represented chat tabs and status changes affect summaries, and verify subscribed row renders and read counts at different workspace counts.

Merge Risk: Minimal · up to c26ba

The late chat tab can refresh sidebar activity, and no actionable merge-blocking issue was found. Merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: refreshing sidebar activity when a native chat tab appears after its status.
Description check Passed The description is detailed and on topic. It explains the problem, user-visible change, implementation, testing, performance impact, compatibility considerations, and risk. It does not fully follow th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and on topic. It explains the problem, user-visible change, implementation, testing, performance impact, compatibility considerations, and risk. It does not fully follow the template because it lacks an explicit issue link format, visual-proof N/A statement, completed checklist items, and explicit rollback details.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@brennanb2025

brennanb2025 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Review loop status

The 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:

  • Speed test gap (P2, fixed): the new comparisons mean status pings and tab title changes now recompute the summary, and the speed test didn't cover those updates. Production code was fine; only the test grew. The mounted test now runs 10 and 100 workspaces, each with a chat tab and a working status. Pings and title changes redraw no rows, a real state change redraws only its own row, and status and tab reads stay linear. Turning off the equal-result reuse makes it fail.
  • Three lint repairs in that test (test-only): the first removed a double type cast, the second replaced the broad object parameter type that CI's anti-slop rule rejected, and the third (c26ba01) keys the test's rows by workspace id instead of their list position, which CI's React check rejected once main's own lint failure stopped hiding that step. The reviewer confirmed all three keep the test's behavior and coverage.
  • Nothing deferred. No problems found that already exist on main.

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

@brennanb2025
brennanb2025 merged commit 147a6ab into main Nov 1, 2026
42 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/lt1031-sidebar-summary branch November 1, 2026 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant