Skip to content

Fix TUI API retry bookkeeping - #246

Merged
TraderSamwise merged 11 commits into
masterfrom
fix/tui-api-cleanup-next-5
Jun 25, 2026
Merged

Fix TUI API retry bookkeeping#246
TraderSamwise merged 11 commits into
masterfrom
fix/tui-api-cleanup-next-5

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • normalize dashboard SSE endpoint cleanup through the shared project-root resolver
  • add a coalesced retry queue for idempotent TUI notification context / mark-seen mutations
  • clear pending/in-flight retry state during dashboard teardown

Verification

  • yarn typecheck
  • yarn lint
  • yarn vitest src/multiplexer/tui-runtime-mutations.test.ts src/multiplexer/project-event-stream.test.ts src/multiplexer/dashboard-control.test.ts src/multiplexer/session-launch.test.ts --run
  • yarn vitest --run
  • yarn build
  • git diff --check

Summary by CodeRabbit

  • New Features

    • TUI runtime updates are now batched and coalesced, making notification and status changes more consistent.
    • Session focus now routes its notification and “seen” updates through the batched runtime flow.
  • Bug Fixes

    • Improved SSE reconnect cleanup to target the correct project area.
    • Fixed shutdown behavior to clear pending runtime update retries and timers.
  • Tests

    • Expanded runtime mutation queue test coverage and updated session-focus assertions.
    • Added a small timing adjustment in one test to prevent flaky expectations.

@vercel

vercel Bot commented Jun 25, 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 Jun 25, 2026 2:28am

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@TraderSamwise, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 6 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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

🚦 How do rate 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 see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d550e6c6-40e3-4c1a-bc53-25c173ffa0c3

📥 Commits

Reviewing files that changed from the base of the PR and between b624e67 and b999b34.

📒 Files selected for processing (3)
  • src/multiplexer/session-launch.test.ts
  • src/multiplexer/session-runtime-core.test.ts
  • src/multiplexer/session-runtime-core.ts
📝 Walkthrough

Walkthrough

Adds a queued TUI runtime mutation layer for notification-context and session-seen updates, routes session focus and dashboard control through it, exports dashboardProjectRoot for SSE reconnect cleanup, and updates teardown and tests for the new async behavior.

Changes

TUI mutation queue and project-root reuse

Layer / File(s) Summary
Queue implementation and teardown
src/multiplexer/tui-runtime-mutations.ts, src/multiplexer/runtime-lifecycle-methods.ts, src/multiplexer/tui-runtime-mutations.test.ts
Adds the per-host TUI mutation queue, flush and retry handling, queue clearing, teardown clearing, and tests for coalescing, retry, and disposal.
Session focus uses queued TUI updates
src/multiplexer/dashboard-control.ts, src/multiplexer/session-launch.ts, src/multiplexer/dashboard-control.test.ts, src/multiplexer/session-launch.test.ts
Dashboard control and session launch enqueue notification-context and seen updates through the queue helpers, and the live tmux and focus-session tests wait for queued effects before asserting calls and state.
Dashboard project root helper
src/multiplexer/dashboard-control.ts, src/multiplexer/project-event-stream.ts, src/multiplexer/project-event-stream.test.ts
dashboardProjectRoot is exported from dashboard control, used in SSE reconnect metadata cleanup, and mocked in the event-stream test from host.projectRoot or process.cwd().

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • TraderSamwise/aimux#245: Shares the SSE reconnect cleanup path in src/multiplexer/project-event-stream.ts that now uses dashboardProjectRoot.
  • TraderSamwise/aimux#245: Also overlaps on the dashboard/project-root handling that replaced the local helper in project-event-stream.ts.

Poem

I hopped through tmux with ears held high,
Queues of little updates drifted by.
A seen mark here, a screen there too,
Then roots and retries all flushed through.
🐇✨ The carrot trail is tidy now.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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: fixing TUI API retry bookkeeping with queued mutation handling.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tui-api-cleanup-next-5

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: 1

🤖 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/tui-runtime-mutations.ts`:
- Around line 53-57: The notification patch queue is overwriting partial updates
instead of merging them, causing fields from earlier writes to be lost. Update
the mutation queuing logic in requeueContext and the flush/retry path around the
context handling so NotificationContextPatch values are coalesced into the
existing queued patch rather than replaced outright. Use the existing
queue/context flow in tui-runtime-mutations.ts to merge incoming patch objects
with any pending context, preserving fields like screen, sessionId, and
panelOpen across multiple partial updates.
🪄 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: 6f3f6052-2e44-4fc1-a4e2-13d76ed98442

📥 Commits

Reviewing files that changed from the base of the PR and between ed3aad8 and 79f41f2.

📒 Files selected for processing (8)
  • src/multiplexer/dashboard-control.test.ts
  • src/multiplexer/dashboard-control.ts
  • src/multiplexer/project-event-stream.test.ts
  • src/multiplexer/project-event-stream.ts
  • src/multiplexer/runtime-lifecycle-methods.ts
  • src/multiplexer/session-launch.ts
  • src/multiplexer/tui-runtime-mutations.test.ts
  • src/multiplexer/tui-runtime-mutations.ts

Comment thread src/multiplexer/tui-runtime-mutations.ts Outdated
@TraderSamwise
TraderSamwise merged commit 72d7082 into master Jun 25, 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