Skip to content

fix: reconcile dashboard lifecycle transitions - #342

Merged
TraderSamwise merged 4 commits into
masterfrom
chore/core-sidecar-next-67
Jul 6, 2026
Merged

fix: reconcile dashboard lifecycle transitions#342
TraderSamwise merged 4 commits into
masterfrom
chore/core-sidecar-next-67

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep TUI agent/service pending actions visible when API settlement misses transiently
  • continue background reconciliation before escalating stuck lifecycle operations
  • update the north-star tracker for the lifecycle transition slice

Verification

  • yarn vitest run src/multiplexer/dashboard-ops.test.ts src/dashboard/pending-actions.test.ts src/multiplexer/dashboard-interaction.test.ts
  • yarn typecheck
  • yarn lint
  • yarn verify

Summary by CodeRabbit

  • New Features

    • Dashboard actions now support a new “pending” state for offline sessions and services while they are still reconciling.
  • Bug Fixes

    • Improved dashboard stability so pending actions are preserved during temporary refresh misses or slow snapshots.
    • Offline session and service resumes now avoid opening live windows or refreshing prematurely when reconciliation is still in progress.
    • Service creation, stopping, and restore flows now handle delayed consistency more reliably, with clearer escalation messaging when settlement takes too long.

@vercel

vercel Bot commented Jul 6, 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 6, 2026 3:46pm

@coderabbitai

coderabbitai Bot commented Jul 6, 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: 31 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: 1951b39e-3b63-4e65-af5c-cbb0dd810cdb

📥 Commits

Reviewing files that changed from the base of the PR and between 4b47fc4 and a6416a6.

📒 Files selected for processing (8)
  • src/dashboard/session-actions.test.ts
  • src/dashboard/session-actions.ts
  • src/multiplexer/dashboard-interaction.test.ts
  • src/multiplexer/dashboard-interaction.ts
  • src/multiplexer/dashboard-ops.test.ts
  • src/multiplexer/dashboard-ops.ts
  • src/multiplexer/notifications.test.ts
  • src/multiplexer/notifications.ts
📝 Walkthrough

Walkthrough

Introduces a DashboardMutationResult ("settled" | "pending" | "failed") type replacing the previous void-returning mutation flow. Reconciliation helpers were added to dashboard-ops.ts to poll for settlement, offline resume helpers now return this tri-state result, and dashboard-interaction.ts activation logic and DashboardActivationResult were updated to handle a new "pending" outcome. Tests and tracker docs updated accordingly.

Changes

Pending Mutation Result Contract

Layer / File(s) Summary
DashboardMutationResult type and reconciliation core
src/multiplexer/dashboard-ops.ts
Adds DashboardMutationResult union, DashboardMutationReconcileOptions, shared success/reconcile helpers, refactored enqueueDashboardAgentRestore, and updated runDashboardSessionMutation/runDashboardServiceMutation returning tri-state results instead of void.
Offline resume helpers return DashboardMutationResult
src/multiplexer/dashboard-ops.ts, src/multiplexer/dashboard-tail-methods.ts
resumeOfflineSessionWithFeedback/resumeOfflineServiceWithFeedback now return DashboardMutationResult; tail methods propagate the typed return instead of awaiting without returning.
Dashboard activation handling of pending resume outcomes
src/multiplexer/dashboard-interaction.ts
Removes prior service-resumption helpers, adds refreshDashboardAfterServiceOpen, extends DashboardActivationResult with "pending", and updates activateDashboardService/activateDashboardEntry to branch on "pending"/"failed" resume outcomes.
Test coverage for pending/settled outcomes
src/multiplexer/dashboard-interaction.test.ts, src/multiplexer/dashboard-ops.test.ts, src/multiplexer/notifications.test.ts
Updates mocks/assertions to expect "settled"/"pending" instead of undefined, and adds tests for reconciling agents/services and delayed settlement during create/stop/restore operations.
Tracker documentation update
docs/north-star-completion-tracker.md
Marks lifecycle-transition checklist items complete and updates the executive snapshot status describing pending-action settlement resilience.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant runDashboardSessionMutation
  participant scheduleDashboardMutationReconcile
  participant Dashboard

  Caller->>runDashboardSessionMutation: request mutation
  runDashboardSessionMutation->>runDashboardSessionMutation: check settle()
  alt settled immediately
    runDashboardSessionMutation->>Dashboard: applyDashboardMutationSuccess
    runDashboardSessionMutation-->>Caller: "settled"
  else not settled
    runDashboardSessionMutation->>scheduleDashboardMutationReconcile: schedule reconcile loop
    runDashboardSessionMutation-->>Caller: "pending"
    scheduleDashboardMutationReconcile->>scheduleDashboardMutationReconcile: poll settle() up to 60s
    scheduleDashboardMutationReconcile->>Dashboard: finalize success or clear pending + showDashboardError
  end
Loading
sequenceDiagram
  participant activateDashboardEntry
  participant resumeOfflineSessionWithFeedback
  participant Dashboard

  activateDashboardEntry->>resumeOfflineSessionWithFeedback: resume offline session
  resumeOfflineSessionWithFeedback-->>activateDashboardEntry: "pending" | "failed" | "settled"
  alt pending
    activateDashboardEntry-->>Dashboard: return "pending"
  else failed
    activateDashboardEntry-->>Dashboard: return "error"
  else settled
    activateDashboardEntry->>Dashboard: refresh model, render, open live window
  end
Loading

Possibly related PRs

  • TraderSamwise/aimux#222: Both PRs modify runDashboardSessionMutation/runDashboardServiceMutation in src/multiplexer/dashboard-ops.ts, directly intersecting on the same functions' behavior.
  • TraderSamwise/aimux#225: Both PRs modify the offline resume flows in dashboard-ops.ts to return a tri-state result and gate UI updates using lifecycle/activation tokens.
  • TraderSamwise/aimux#325: Both PRs modify dashboard-ops.ts/dashboard-interaction to preserve pending transition state across transient refresh/settlement misses.
🚥 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 matches the main change: reconciling dashboard lifecycle transitions and pending-action handling.
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-67

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

@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.

Actionable comments posted: 3

🤖 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/dashboard-interaction.ts`:
- Around line 776-778: The early returns after resumeOfflineServiceWithFeedback
in the dashboard activation flow bypass the stale-activation guard. Update the
pending/failed branches to re-check isCurrentDashboardActivation before
returning, matching the settled-path logic already used elsewhere in the same
activation method. Apply the same freshness check in the other resume outcome
branches referenced by the comment so only the current dashboard activation can
return a result.

In `@src/multiplexer/dashboard-ops.ts`:
- Around line 946-976: The restore flow in dashboard-ops.ts drops teammate
warnings when runDashboardSessionMutation returns "pending" because
restoreWarningLines(resumeResult) is only checked after the main await. Move the
warning handling into the mutation’s onAfterSettle path (near
runDashboardSessionMutation and restoreWarningLines) so both immediate and
delayed settlements can call host.showDashboardError with the warning lines when
the lifecycle is still current.
- Around line 978-979: The non-dashboard resume path in
runResumeOfflineSessionWithFeedback is swallowing failures by always returning
"settled" after the helper call, even when the resume or waitForSessionStart
flow fails. Update runResumeOfflineSessionWithFeedback to return a
success/failure result instead of void, then in the caller branch map a failure
outcome to "failed" rather than unconditionally returning "settled". Use the
existing symbols runResumeOfflineSessionWithFeedback, waitForSessionStart, and
the session resume branch in dashboard-ops to keep the fix localized.
🪄 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: c12f52c1-0d4e-4665-852e-db9f1c907eb1

📥 Commits

Reviewing files that changed from the base of the PR and between 73a671b and 4b47fc4.

📒 Files selected for processing (7)
  • docs/north-star-completion-tracker.md
  • src/multiplexer/dashboard-interaction.test.ts
  • src/multiplexer/dashboard-interaction.ts
  • src/multiplexer/dashboard-ops.test.ts
  • src/multiplexer/dashboard-ops.ts
  • src/multiplexer/dashboard-tail-methods.ts
  • src/multiplexer/notifications.test.ts

Comment thread src/multiplexer/dashboard-interaction.ts
Comment thread src/multiplexer/dashboard-ops.ts
Comment thread src/multiplexer/dashboard-ops.ts Outdated
@TraderSamwise
TraderSamwise merged commit 4547fbc into master Jul 6, 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