Skip to content

Remove legacy TUI/API fallback paths - #242

Merged
TraderSamwise merged 3 commits into
masterfrom
fix/tui-api-cleanup-next
Jun 24, 2026
Merged

Remove legacy TUI/API fallback paths#242
TraderSamwise merged 3 commits into
masterfrom
fix/tui-api-cleanup-next

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • remove the legacy tmux inbox popup and route Ctrl-A i through the dashboard Coordination screen
  • remove obsolete open-inbox API/client plumbing
  • make user-facing thread/task/worktree/graveyard CLI reads strict project-service API reads
  • align thread summary client contract/screens with the service's latestMessage response

Verification

  • yarn typecheck
  • yarn lint
  • yarn build
  • yarn vitest --run
  • cd app && yarn typecheck
  • cd app && yarn test lib/api.test.ts
  • cd app && yarn lint (passes with existing React hook warnings only)

Summary by CodeRabbit

  • New Features

    • Added support for opening the dashboard in a chosen screen, including a new coordination view.
    • Updated the tmux shortcut to open coordination directly in the dashboard.
  • Bug Fixes

    • Thread lists now show the most recent message consistently and sort by the latest activity.
    • Several inspection commands now always use live project data, improving consistency across views.
  • Refactor

    • Removed the older inbox popup flow in favor of the updated dashboard-based coordination experience.

@vercel

vercel Bot commented Jun 24, 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 24, 2026 9:48am

@coderabbitai

coderabbitai Bot commented Jun 24, 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 45 minutes and 24 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: bab87e74-0e11-4f3d-8245-9f5e5d697f40

📥 Commits

Reviewing files that changed from the base of the PR and between b142f41 and 47e94b5.

📒 Files selected for processing (2)
  • src/main.ts
  • src/tmux/control-script.test.ts
📝 Walkthrough

Walkthrough

The PR replaces the inbox control action/popup with a coordination action that persists a screen value into dashboard UI state and switches the tmux client to the dashboard window. It removes openInbox API/routes, adds a DashboardControlScreen union with a screen parameter to openDashboard, renames ThreadSummaryResponse.lastMessage to latestMessage, and migrates all CLI inspection commands from local-file fallback reads to always-live project service requests.

Changes

inbox → coordination & openDashboard screen selection

Layer / File(s) Summary
API contract: DashboardControlScreen, routes, latestMessage
src/project-api-contract.ts
Adds switchableAgents/openDashboard routes, removes openInbox route; introduces DashboardControlScreen union and optional screen on OpenDashboardRequest; renames ThreadSummaryResponse.lastMessage to latestMessage with ts/from/kind fields.
Metadata server: screen parsing, persistence, openInbox redirect
src/metadata-server.ts, app/lib/api.ts
Adds parseDashboardControlScreen validator; extends openDashboard to accept and persist screen in dashboard UI state for both focus paths; changes openInbox to emit open-dashboard action; removes exported openInbox function from app API.
Tmux coordination handler and runtime keybinding
scripts/tmux-control.sh, src/tmux/runtime-manager.ts
Replaces show_local_inbox_popup with persist_dashboard_screen + show_local_coordination that writes screen state then switches tmux client to the dashboard window; updates action allowlists and failure labels; changes prefix i keybinding from inbox to coordination.
Mobile UI: latestMessage rendering and openDashboard API calls
app/app/(main)/(tabs)/(threads)/threads.tsx, app/app/(main)/global-threads.tsx, app/lib/api.test.ts
Updates thread list preview and global-threads sort/snippet to consume latestMessage.ts/latestMessage.body; replaces openInbox test calls with openDashboard({screen: "coordination"}) and updates relay-proxy body assertions.
Tests: metadata-server, control-script, runtime-manager
src/metadata-server.test.ts, src/tmux/control-script.test.ts, src/tmux/runtime-manager.test.ts
Asserts screen: "coordination" in persisted dashboard UI state snapshots with no tmux mutation; adds test confirming switch-client (no popup) for coordination; adds test verifying prefix i binds to coordination path.

CLI: live-only project service reads

Layer / File(s) Summary
getLiveProjectServiceJson and CLI command migration
src/main.ts
Removes getProjectServiceJsonOrReadFallback, listVisibleLocalWorktrees, local thread/task/graveyard fallback imports, and inbox-popup command wiring; introduces getLiveProjectServiceJson that always requires the live daemon; migrates worktree, thread list/show, task list/show, and graveyard list to call the live service only.

Sequence Diagram(s)

sequenceDiagram
  rect rgba(100, 149, 237, 0.5)
    note over Client,TmuxClient: coordination action flow
  end
  participant Client
  participant openDashboard as openDashboard handler
  participant parseDashboardControlScreen
  participant DashboardUIState
  participant sendControlAction
  participant TmuxClient as tmux-control.sh

  Client->>openDashboard: POST /control/open-dashboard {screen: "coordination"}
  openDashboard->>parseDashboardControlScreen: validate "coordination"
  parseDashboardControlScreen-->>openDashboard: "coordination"
  openDashboard->>DashboardUIState: snapshot.screen = "coordination"
  openDashboard->>sendControlAction: action="open-dashboard"
  sendControlAction->>TmuxClient: run coordination
  TmuxClient->>DashboardUIState: persist_dashboard_screen "coordination"
  TmuxClient->>TmuxClient: switch-client to dashboard window
  openDashboard-->>Client: ControlActionResponse {ok: true}
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • TraderSamwise/aimux#173: Rebuilds coordination screen as a unified urgency-sorted worklist, directly consuming ThreadSummaryResponse.latestMessage renamed in this PR and receiving open-dashboard control actions now routed from openInbox.
  • TraderSamwise/aimux#187: Exposes openDashboard/openInbox as typed control actions in app/lib/api.ts/src/metadata-server.ts/src/project-api-contract.ts — the exact surfaces this PR removes openInbox from and extends with screen.
  • TraderSamwise/aimux#241: Modifies scripts/tmux-control.sh's dashboard targeting/reload logic (find_dashboard_candidate/focus_local_dashboard_target) that this PR's new show_local_coordination handler calls directly.

Poem

🐇 Hoppity-hop, the inbox is gone,
Coordination takes over from now on!
latestMessage ts ticks along,
The popup replaced by a switch so strong.
Live service reads, no fallback in sight —
The rabbit ships features, everything's right! ✨

🚥 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 accurately summarizes the main change: removing legacy fallback paths across the TUI and API/client layers.
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

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

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 24, 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/metadata-server.ts (1)

591-605: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse a shared screen allowlist for runtime validation.

DashboardControlScreen is type-only, so this parser repeats the same literals from src/project-api-contract.ts. A future contract change can compile while the server still rejects the new screen. Export a const tuple from the contract and derive both the union and parser from it.

Refactor sketch
+export const DASHBOARD_CONTROL_SCREENS = [
+  "dashboard",
+  "coordination",
+  "project",
+  "library",
+  "topology",
+  "graveyard",
+] as const;
-export type DashboardControlScreen = "dashboard" | "coordination" | "project" | "library" | "topology" | "graveyard";
+export type DashboardControlScreen = (typeof DASHBOARD_CONTROL_SCREENS)[number];
+const DASHBOARD_CONTROL_SCREEN_SET = new Set<string>(DASHBOARD_CONTROL_SCREENS);
+
 function parseDashboardControlScreen(input: unknown): DashboardControlScreen | undefined {
   if (typeof input !== "string") return undefined;
   const screen = input.trim();
-  if (
-    screen === "dashboard" ||
-    screen === "coordination" ||
-    screen === "project" ||
-    screen === "library" ||
-    screen === "topology" ||
-    screen === "graveyard"
-  ) {
-    return screen;
-  }
-  return undefined;
+  return DASHBOARD_CONTROL_SCREEN_SET.has(screen) ? (screen as DashboardControlScreen) : undefined;
 }
🤖 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/metadata-server.ts` around lines 591 - 605, The runtime screen validation
in parseDashboardControlScreen is duplicating the DashboardControlScreen
literals, which can drift from the shared contract. Move the allowlist into
src/project-api-contract.ts as an exported const tuple, derive the
DashboardControlScreen union from that tuple, and update
parseDashboardControlScreen in metadata-server to validate against the shared
tuple instead of hardcoded strings.
🤖 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/main.ts`:
- Line 1886: The thread/task read routes still call getProjectServiceJson
directly, so they can bypass ensureDaemonProjectReady and fail when endpoint
metadata is stale. Update the affected read paths in main.ts, including the
thread/task handlers around getProjectServiceJson for /threads, to route through
the same live helper used by worktrees and graveyard so readiness and
version-drift repair always run before the request. Keep the existing route
behavior, but replace the direct project-service read flow with the helper that
performs the daemon readiness check first.
- Around line 479-487: The live project service read path in
getLiveProjectServiceJson can hang indefinitely because requestJson is called
without a timeout. Update the requestJson call in getLiveProjectServiceJson to
pass a finite timeout for these GET requests, using a sensible hard limit so
stalled project services fail fast instead of blocking the CLI forever.

In `@src/tmux/control-script.test.ts`:
- Around line 808-814: The popup assertion in control-script.test should check
the full logged command entry instead of only the bare command name. Update the
expectation around readLog(envRoot) and switch-client so it matches complete
command strings, using the existing log assertions in the test to verify that no
display-popup invocation appears with its arguments rather than just the
substring “display-popup”.

---

Nitpick comments:
In `@src/metadata-server.ts`:
- Around line 591-605: The runtime screen validation in
parseDashboardControlScreen is duplicating the DashboardControlScreen literals,
which can drift from the shared contract. Move the allowlist into
src/project-api-contract.ts as an exported const tuple, derive the
DashboardControlScreen union from that tuple, and update
parseDashboardControlScreen in metadata-server to validate against the shared
tuple instead of hardcoded strings.
🪄 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: 06c1b7ea-bae5-4896-b335-9cb736659fad

📥 Commits

Reviewing files that changed from the base of the PR and between e0c2192 and b142f41.

📒 Files selected for processing (13)
  • app/app/(main)/(tabs)/(threads)/threads.tsx
  • app/app/(main)/global-threads.tsx
  • app/lib/api.test.ts
  • app/lib/api.ts
  • scripts/tmux-control.sh
  • src/main.ts
  • src/metadata-server.test.ts
  • src/metadata-server.ts
  • src/project-api-contract.ts
  • src/tmux/control-script.test.ts
  • src/tmux/inbox-popup.ts
  • src/tmux/runtime-manager.test.ts
  • src/tmux/runtime-manager.ts
💤 Files with no reviewable changes (1)
  • src/tmux/inbox-popup.ts

Comment thread src/main.ts
Comment thread src/main.ts
Comment thread src/tmux/control-script.test.ts Outdated
@TraderSamwise

Copy link
Copy Markdown
Owner Author

Sub-agent review finding resolved in 47e94b5: thread/task show commands now preserve friendly not-found handling for API 404s without reintroducing local disk fallback reads.

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 24, 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.

@TraderSamwise
TraderSamwise merged commit b57a262 into master Jun 24, 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