Repository navigation
Fix Resource Manager session polling lag - #7050
Conversation
Co-authored-by: Orca <[email protected]>
|
Ready to review this PR? Stage has broken it down into 3 individual chapters for you:
Chapters generated by Stage for commit a0e5286 on Jul 1, 2026 9:57pm UTC. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis change modifies Changes
Sequence Diagram(s)Included above in the hidden artifact for the polling effect layer. Suggested labels: area:renderer, status-bar, refactor Suggested reviewers: none identified from provided context 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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
🧹 Nitpick comments (4)
src/renderer/src/components/status-bar/ResourceUsageStatusSegment.session-polling.test.ts (3)
9-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftSource-string assertions are brittle proxies for behavior.
The test never renders the component or exercises timers; it checks for the literal absence of identifiers (
installWindowVisibilityInterval,SESSIONS_POLL_MS) and a static count oflistSessions()occurrences. A behavior-preserving rename or an additional, properly-gated call site would fail this test even though the actual regression (background polling while closed) is not reintroduced. Conversely, a regression that reintroduces polling under a differently-named helper or interval constant would slip through undetected.Consider replacing this with an actual behavioral test that renders
ResourceUsageStatusSegment, mockswindow.api.pty.listSessions, uses fake timers to advance well past the polling interval while the popover stays closed, and asserts the mock was not called — mirroring the manual E2E probe described in the PR objectives.
13-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueHardcoded call-count assertion is fragile.
toHaveLength(1)locks the test to exactly one textual occurrence ofwindow.api.pty.listSessions(). Any legitimate addition of another correctly-gated call site (e.g. a future explicit refresh trigger) breaks this test for reasons unrelated to the polling regression it's meant to catch.
15-21: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffOrdering check depends on exact substring match of the guard condition.
indexOf('if (!open || runtimeEnvironmentActive)')ties the test to the exact formatting/wording of the guard in the source file. Any harmless reformatting (e.g. splitting the condition across lines, renamingruntimeEnvironmentActive) silently makesopenEffectIndexreturn-1, and sinceindexOf(x, -1)behaves likeindexOf(x, 0),refreshIndexcould still be found after index-1, potentially producing a false pass on the ordering check while thetoBeGreaterThanOrEqual(0)assertion is what actually catches it. The test's protection here relies entirely on incidental string matching rather than verifying real effect-execution order.src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx (1)
980-987: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUpdate the orphan-count comment to match the new open gate.
Line 983 now intentionally returns 0 while closed, so the comment above should say orphan counts require daemon inventory and are only computed while the popover is open; the closed badge uses renderer-owned PTY bindings instead. As per coding guidelines,
When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9479c4bf-adab-4d72-871b-ecb3bd409958
📒 Files selected for processing (2)
src/renderer/src/components/status-bar/ResourceUsageStatusSegment.session-polling.test.tssrc/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx
Co-authored-by: Orca <[email protected]>
Added open-only sessions re-poll (SESSION_LIST_POLL_MS) and clear sessionsError on popover close; blocks stale-session (C1) and stuck daemon-unreachable badge (C2).
Added open-only sessions re-poll (SESSION_LIST_POLL_MS) and clear sessionsError on popover close; blocks stale-session (C1) and stuck daemon-unreachable badge (C2). Co-authored-by: orca-bug-scan-bot <[email protected]>
Co-authored-by: Orca <[email protected]>
…ai#7066) Added open-only sessions re-poll (SESSION_LIST_POLL_MS) and clear sessionsError on popover close; blocks stale-session (C1) and stuck daemon-unreachable badge (C2). Co-authored-by: orca-bug-scan-bot <[email protected]>
Summary
Measurement
Verification
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/status-bar/ResourceUsageStatusSegment.session-polling.test.ts src/renderer/src/components/status-bar/resource-session-bindings.test.tspnpm exec oxlint src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx src/renderer/src/components/status-bar/ResourceUsageStatusSegment.session-polling.test.tspnpm exec tsc --noEmit --project tsconfig.jsonwindow.api.pty.listSessions()stayed at 0 calls for 12.5s while Resource Manager was closed.Made with Orca 🐋