Skip to content

Cut agent resume to topology authority - #351

Merged
TraderSamwise merged 2 commits into
masterfrom
chore/core-sidecar-next-76
Jul 7, 2026
Merged

Cut agent resume to topology authority#351
TraderSamwise merged 2 commits into
masterfrom
chore/core-sidecar-next-76

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • require topology ownership before resuming offline agents
  • require topology ownership before sending stale offline rows to graveyard
  • prune stale dashboard offline cache rows instead of launching or graveyarding from cache-only state

Verification

  • yarn typecheck
  • yarn lint
  • yarn vitest
  • yarn build

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of offline sessions so stale cached entries are removed instead of lingering in the app.
    • Resuming or graveyarding an offline session now behaves more consistently when the session is no longer available.
    • Desktop status updates and snapshot refreshes continue to run even when a stale offline session is pruned.
    • Dashboard views now refresh correctly after stale offline session cleanup.

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jul 7, 2026 2:54am

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 72b69b2e-998f-49f9-bf61-95ec3e6072c8

📥 Commits

Reviewing files that changed from the base of the PR and between ba892ca and 944508e.

📒 Files selected for processing (1)
  • src/multiplexer/runtime-state.ts
📝 Walkthrough

Walkthrough

Adds internal helpers findTopologySession and pruneOfflineSessionCache in runtime-state.ts, and reworks graveyardSession and resumeOfflineSession to derive existence from topology rows rather than the in-memory offline cache, pruning stale cache entries when topology authority is absent. Test file updates a helper and adds new coverage.

Changes

Topology-authoritative offline session pruning

Layer / File(s) Summary
Topology lookup and cache pruning helpers
src/multiplexer/runtime-state.ts
Adds findTopologySession to query topology rows by id/status and pruneOfflineSessionCache to remove a session id from host.offlineSessions.
graveyardSession rewrite
src/multiplexer/runtime-state.ts
Uses findTopologySession to check existence; when absent, prunes offline cache and updates snapshot/statusline/dashboard instead of graveyarding.
resumeOfflineSession rewrite
src/multiplexer/runtime-state.ts
Safely derives sessionId, prunes offline cache when runtime is live or topology row missing, and rebuilds session from the topology row with forced offline lifecycle/status.
Test helper and existing test updates
src/multiplexer/runtime-state.test.ts
Adds seedOfflineSession helper and updates existing resumeOfflineSession tests to seed topology rows instead of relying solely on in-memory offlineSessions.
New pruning behavior tests
src/multiplexer/runtime-state.test.ts
Adds tests verifying resumeOfflineSession and graveyardSession prune stale offline cache rows and skip session creation/graveyarding when topology authority is missing.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • TraderSamwise/aimux#100: Both PRs modify resumeOfflineSession in src/multiplexer/runtime-state.ts, touching the same core resume/offline-cache logic.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: offline agent resume now depends on topology authority.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/core-sidecar-next-76

Comment @coderabbitai help to get the list of available commands.

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/multiplexer/runtime-state.ts (1)

78-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Import RuntimeTopologySessionStatus instead of repeating the union.

findTopologySession should use the shared RuntimeTopologySessionStatus export from src/runtime-core/topology-sessions.ts instead of duplicating the status list inline. That keeps this helper aligned with the canonical session state contract.

🤖 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/runtime-state.ts` around lines 78 - 83, findTopologySession
is duplicating the topology session status union inline instead of using the
shared RuntimeTopologySessionStatus type. Update the statuses parameter in
findTopologySession to reference RuntimeTopologySessionStatus from
src/runtime-core/topology-sessions.ts, and keep the listTopologySessionStates
call unchanged so the helper stays aligned with the canonical session-state
contract.
🤖 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.

Nitpick comments:
In `@src/multiplexer/runtime-state.ts`:
- Around line 78-83: findTopologySession is duplicating the topology session
status union inline instead of using the shared RuntimeTopologySessionStatus
type. Update the statuses parameter in findTopologySession to reference
RuntimeTopologySessionStatus from src/runtime-core/topology-sessions.ts, and
keep the listTopologySessionStates call unchanged so the helper stays aligned
with the canonical session-state contract.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 87fa066b-168b-4130-a849-90971a594354

📥 Commits

Reviewing files that changed from the base of the PR and between f2025c9 and ba892ca.

📒 Files selected for processing (2)
  • src/multiplexer/runtime-state.test.ts
  • src/multiplexer/runtime-state.ts

@TraderSamwise
TraderSamwise merged commit e971cf4 into master Jul 7, 2026
3 checks passed
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