Cut offline lifecycle writes to topology - #353
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 38 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughOffline session state persistence is refactored across ChangesOffline topology persistence
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant SessionRuntimeCore
participant RuntimeState
participant PersistenceMethods
participant TopologyStore
participant Host
SessionRuntimeCore->>TopologyStore: upsertTopologySession(offline entry, exit)
SessionRuntimeCore->>Host: loadOfflineTopologySessions()
RuntimeState->>TopologyStore: upsertTopologySession(offline entry, stop/resume)
RuntimeState->>Host: loadOfflineTopologySessions()
PersistenceMethods->>TopologyStore: resurrectTopologySession(sessionId)
PersistenceMethods->>Host: loadOfflineTopologySessions()
PersistenceMethods->>Host: invalidateDesktopStateSnapshot / writeStatuslineFile / notifyChange
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/multiplexer/session-runtime-core.test.ts (1)
487-487: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winSelect the expected offline row by id.
listTopologySessionStates({ statuses: ["offline"] })[0]makes these assertions depend on topology row order. Use.find((s) => s.id === expectedId)so the tests validate the intended session when additional offline rows exist.Also applies to: 527-530, 601-601
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/multiplexer/session-runtime-core.test.ts` at line 487, The offline-session assertions in session-runtime-core.test.ts rely on array index order from listTopologySessionStates({ statuses: ["offline"] }), which can break when more offline rows exist. Update the affected tests to select the expected session by id using listTopologySessionStates(...) and .find((s) => s.id === expectedId) before calling toMatchObject, so the assertions target the intended row regardless of ordering.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/multiplexer/runtime-state.ts`:
- Line 533: The topology/session writes in runtime-state should not rely on
projectRootFor(host) when host.projectRoot is missing, because it can fall back
to process.cwd() and attach the row to the wrong rig. Update the lifecycle
write(s) around upsertTopologySession in runtime-state.ts to use getRepoRoot()
as the fallback, matching the existing default behavior in
upsertTopologySession, and apply the same change to the other affected writes in
this area.
In `@src/multiplexer/session-runtime-core.ts`:
- Around line 27-29: The fallback in projectRootFor is using process.cwd(),
which can override the initialized repo root and write topology data under the
wrong rig. Update projectRootFor so it falls back to the repo root used by
initialization (the same default path as upsertTopologySession/getRepoRoot), and
keep the existing host.projectRoot trimming logic intact.
---
Nitpick comments:
In `@src/multiplexer/session-runtime-core.test.ts`:
- Line 487: The offline-session assertions in session-runtime-core.test.ts rely
on array index order from listTopologySessionStates({ statuses: ["offline"] }),
which can break when more offline rows exist. Update the affected tests to
select the expected session by id using listTopologySessionStates(...) and
.find((s) => s.id === expectedId) before calling toMatchObject, so the
assertions target the intended row regardless of ordering.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 87e60a9a-1234-4861-959c-4c32a6fd3a77
📒 Files selected for processing (6)
src/multiplexer/persistence-methods.test.tssrc/multiplexer/persistence-methods.tssrc/multiplexer/runtime-state.test.tssrc/multiplexer/runtime-state.tssrc/multiplexer/session-runtime-core.test.tssrc/multiplexer/session-runtime-core.ts
💤 Files with no reviewable changes (1)
- src/multiplexer/persistence-methods.ts
|
Sub-agent review finding fixed in 0bbad64: preserved runtime exits now reload the offline projection from topology before saveState(), and explicit stops prune stale projection entries before saveState(), with regression coverage using real saveState reconciliation. |
Summary
Verification
Summary by CodeRabbit