Repository navigation
fix(status-bar): Resource Manager closed badge terminal count + RAM seed - #9387
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughResourceUsageStatusSegment now uses a cached daemon session inventory for badge counts and session state. The inventory is seeded after workspace session restoration, refreshed from daemon sessions and PTY lifecycle events, and pruned on exits or kill actions. PTY spawning now emits renderer lifecycle notifications, while session listing starts local and SSH inventory requests concurrently. Tests and reliability-gate metadata cover inventory behavior, lifecycle races, polling, and readiness seeding. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9acee167-f103-41ca-88f5-a0c080ef4833
📥 Commits
Reviewing files that changed from the base of the PR and between 403d681 and fcd4cfe6f6d694264b795c970fc08477b6088f65.
📒 Files selected for processing (6)
src/renderer/src/components/status-bar/ResourceUsageStatusSegment.session-polling.test.tssrc/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsxsrc/renderer/src/components/status-bar/resource-session-count-selector.test.tssrc/renderer/src/components/status-bar/resource-session-count-selector.tssrc/renderer/src/components/status-bar/resource-session-inventory.test.tssrc/renderer/src/components/status-bar/resource-session-inventory.ts
💤 Files with no reviewable changes (2)
- src/renderer/src/components/status-bar/resource-session-count-selector.test.ts
- src/renderer/src/components/status-bar/resource-session-count-selector.ts
|
Taking a look! |
…tory The closed chip counted tab/layout PTY wake hints (inflating terminal count) and never fetched memory until the popover opened (showing "—"). Cache listSessions for the badge, seed memory on session ready, and drop the wake-hint closed selector.
CodeRabbit/React Doctor flagged mutating sessionInventoryRef during render; keep the write in useEffect after commit.
d432ba1 to
d620120
Compare
|
Thanks for the fix — I took this over and pushed a maintainer follow-up. I rebased onto current main, kept the daemon-inventory and RAM seeding behavior, and replaced the mounted-pane create heuristic with explicit PTY spawn/exit lifecycle updates so background and reattached sessions stay accurate without closed-state polling; the inventory hook also coalesces batch spawns and guards out-of-order/exit races. Verified with 325 focused tests, the full typecheck, touched-file lint, React lint, and the max-lines ratchet. |
…rds (#9789) * fix(sidebar): keep branch-discovered PR status visible on worktree cards The sidebar status lane and the right checks panel read the same PR caches but disagreed for unlinked worktrees: every successful GitHub PR fetch mirrors the result into hostedReviewCache stamped with a linked-style hint key ('github:<n>'), and getWorktreeCardPrDisplay suppresses unlinked reviews with a non-empty hint. The checks panel renders straight from prCache, so it showed "#9387 OPEN" while the same worktree's card fell back to the plain branch icon. Thread the branch-keyed PR cache number into getWorktreeCardPrDisplay as corroboration: when the branch cache names the same PR the hosted entry holds, the review provably belongs to this branch and stays visible. WorktreeCard passes its existing cachedBranchFallbackGitHubPRNumber, which is already guarded for linked metadata and the merged-head rule. The hint stamping itself is unchanged on purpose: the 'github:' marker also flags the entry as GitHub-scoped so neutral lookups still re-run GitLab MR discovery. * fix(sidebar): preserve PR lookup provenance * fix(sidebar): preserve merged PR head guard * test(github): assert exact refresh cache write
…closed-badge # Conflicts: # src/main/ipc/pty.ts # src/preload/api-types.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/reliability-gates.jsonc (1)
2298-2318: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the inventory-model assertions.
resource-session-inventory.test.tsis declared intestFilesand executed by the command, but has noassertionRefsentry. Add one so inventory construction, removal, and unknown-PTY detection remain auditable in this gate’s coverage map.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6f606318-09ae-4ac5-944b-f131450be47c
📥 Commits
Reviewing files that changed from the base of the PR and between d432ba186155b2115319fb96bc370684c2eceb9f and cd6f749.
📒 Files selected for processing (1)
config/reliability-gates.jsonc
This reverts commit 8f40ddf (#10179). Rebased on current main. The revert applied cleanly across the vast majority of the 1,626-file PR; the remaining work was preserving PRs that had been built on top of #10179 after it merged. All are preserved: - #9990 perf(terminal): cold-restore replay - #10213 fix(codex): TUI settings promotion - #10135 fix(mobile): images in native chat - #9387 fix(status-bar): Resource Manager badge + concurrent listSessions - #9853 fix(app): bound wake/quit paths (phone-session-ended freeze) - #10237 fix(claude-accounts): quote claude path for Windows (kept shell:false) Because those PRs were written against helper modules/APIs that #10179 introduced, the minimal, typecheck-verified closure they depend on is kept so the tree builds and every later-PR test passes: - bounded file/JSON readers used by #10213/#9990 (agent-state-file-reader, node-bounded-file-reader, json-text-structure-limit, terminal-history limits) - claimed-agent-pty-owner cap API + pty:listSessions admission (#9990/#9387) - the mobile-E2EE outbound-memory-budget subsystem #9853 builds on (e2ee-channel, mobile-e2ee-*, ws-outbound-backpressure-queue, remote-runtime-request-frames/-memory-limits, map-with-concurrency, e2ee-crypto) Everything else #10179 added (~555 files) is deleted; every file it modified elsewhere is restored to its pre-#10179 state. Verified: root typecheck (node+cli+web), mobile typecheck, full root test suite, full mobile test suite, oxlint, localization catalog + coverage, reliability gates, max-lines ratchet, and the CLI emit build all pass. Two checks fail only locally and fail identically on clean origin/main (this clone's git-tag namespace for verify:skill-bundle-manifest; an inherited GIT_CONFIG_* env for one relay test) — both pass on a clean CI environment. Co-authored-by: Orca <help@stably.ai>
…#12468) * fix(status-bar): invalidate the CLI session count on kill and restart `pty:management:killOne` / `killAll` / `restart` tear sessions down via `adapter.shutdown()` and broadcast nothing — unlike `pty:kill`, which ends in `sendPtyExitToRenderer`. The status-bar count is an event-sourced cache, so killing sessions from Manage Sessions or "Kill all terminals" left the `>_ N` chip frozen until the popover was opened, which itself triggers a refresh. > [!NOTE] > The dual-source split described in the issue text was already fixed by merged #9387. This closes a *different* remaining invalidation gap that produces the same reported symptom. Broadcast the teardown so the chip updates without needing the popover opened. Fixes #8372 Co-authored-by: Orca <help@stably.ai> * test(e2e): add recordable proof for status-bar-cli-session-count Fails on origin/main, passes on this branch. Test: drops after Manage Sessions kills a foreign daemon session, popover never opened Co-authored-by: Orca <help@stably.ai> * fix(status-bar): avoid duplicate inventory refresh after kill all --------- Co-authored-by: Orca <help@stably.ai>
…rds (stablyai#9789) * fix(sidebar): keep branch-discovered PR status visible on worktree cards The sidebar status lane and the right checks panel read the same PR caches but disagreed for unlinked worktrees: every successful GitHub PR fetch mirrors the result into hostedReviewCache stamped with a linked-style hint key ('github:<n>'), and getWorktreeCardPrDisplay suppresses unlinked reviews with a non-empty hint. The checks panel renders straight from prCache, so it showed "stablyai#9387 OPEN" while the same worktree's card fell back to the plain branch icon. Thread the branch-keyed PR cache number into getWorktreeCardPrDisplay as corroboration: when the branch cache names the same PR the hosted entry holds, the review provably belongs to this branch and stays visible. WorktreeCard passes its existing cachedBranchFallbackGitHubPRNumber, which is already guarded for linked metadata and the merged-head rule. The hint stamping itself is unchanged on purpose: the 'github:' marker also flags the entry as GitHub-scoped so neutral lookups still re-run GitLab MR discovery. * fix(sidebar): preserve PR lookup provenance * fix(sidebar): preserve merged PR head guard * test(github): assert exact refresh cache write
…eed (stablyai#9387) * fix(status-bar): seed Resource Manager closed badge from daemon inventory The closed chip counted tab/layout PTY wake hints (inflating terminal count) and never fetched memory until the popover opened (showing "—"). Cache listSessions for the badge, seed memory on session ready, and drop the wake-hint closed selector. * fix(status-bar): update session inventory ref in an effect CodeRabbit/React Doctor flagged mutating sessionInventoryRef during render; keep the write in useEffect after commit. * fix(status-bar): follow daemon session lifecycle events * perf(status-bar): skip inventory scans for known PTYs * perf(status-bar): bound resource inventory refreshes --------- Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
…stablyai#12468) * fix(status-bar): invalidate the CLI session count on kill and restart `pty:management:killOne` / `killAll` / `restart` tear sessions down via `adapter.shutdown()` and broadcast nothing — unlike `pty:kill`, which ends in `sendPtyExitToRenderer`. The status-bar count is an event-sourced cache, so killing sessions from Manage Sessions or "Kill all terminals" left the `>_ N` chip frozen until the popover was opened, which itself triggers a refresh. > [!NOTE] > The dual-source split described in the issue text was already fixed by merged stablyai#9387. This closes a *different* remaining invalidation gap that produces the same reported symptom. Broadcast the teardown so the chip updates without needing the popover opened. Fixes stablyai#8372 Co-authored-by: Orca <help@stably.ai> * test(e2e): add recordable proof for status-bar-cli-session-count Fails on origin/main, passes on this branch. Test: drops after Manage Sessions kills a foreign daemon session, popover never opened Co-authored-by: Orca <help@stably.ai> * fix(status-bar): avoid duplicate inventory refresh after kill all --------- Co-authored-by: Orca <help@stably.ai>
Summary
Fixes the Resource Manager closed status-bar chip:
boundPtyIds), which inflated the badge (e.g.>_ 63with only a handful of live sessions).—until the popover is opened.Fixes #9386
Related: #8372 (same closed-vs-open counter dual source).
User-visible change
pty.listSessions()count—until clickClosed mode still does not continuously poll
listSessions(perf). It seeds on session ready, refreshes on open/kill, drops exited sessions viapty.onExit, and re-inventories once when a new live mounted PTY appears while closed.AI-agent review summary
pty.listSessions()(local daemon inventory); wake-hint IDs are no longer used as a closed proxy. Remote live ids that are not yet in the daemon list trigger a one-shot re-inventory when the live map changes.listSessions+memory.getSnapshotwhen session-ready; memory interval remains open-only.(N)suffix remains open-only.listSessions/getSnapshot/onExitonly.Test plan
resource-session-inventoryhelpersScreenshots (before; terminal / workspace names redacted)
—until click:Close-up of inflated closed chip:
Reliability contract
terminal-performance.no-hot-list-sessions— typing, focus, tab/workspace switch, visibility resume, resize, render, and per-pane liveness never call globalpty.listSessions().config/reliability-gates.jsonc; focused tests prove one readiness inventory seed, no closed interval, one coalesced read for unknown spawn IDs, zero additional reads for known-session reattach signals, exit fencing, and newest-refresh-wins ordering.