Skip to content

Use tmux root metadata for TUI project ownership - #211

Merged
TraderSamwise merged 3 commits into
masterfrom
chore/tui-next-43
Jun 21, 2026
Merged

Use tmux root metadata for TUI project ownership#211
TraderSamwise merged 3 commits into
masterfrom
chore/tui-next-43

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • detect meta-dashboard/global expose projects from tmux @aimux-project-root metadata instead of derived session names
  • pass root-matched session sets into fast-control so rows and selection use the same source of truth
  • preserve discovered target sessions for meta-dashboard and global Exposé jumps, preferring host targets over linked client targets
  • remove shell-side last-used.json writes from tmux-control local fallback

Verification

  • yarn typecheck
  • yarn lint
  • yarn build
  • yarn vitest
  • git diff --check
  • pre-push hook: yarn typecheck && yarn lint && yarn test

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved window discovery for root-matched tmux sessions across projects, including correct deduping and session attribution.
    • Updated dashboard “running” detection to use per-session project-root metadata, improving accuracy.
    • Fixed cross-project dashboard jumps so the target session name is no longer rewritten.
    • Improved opening of cross-project client-session targets inside tmux by resolving through the correct host session context.
    • Fixed local window switching to align with updated argument handling (removing an unintended “last used” side effect).
  • Refactor

    • Streamlined session selection and consolidated session-root mapping for item discovery.

@vercel

vercel Bot commented Jun 21, 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 21, 2026 12:43am

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 21, 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 commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e3a9e77f-4746-471f-ad65-d850434c4b74

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Session discovery is refactored to read @aimux-project-root tmux option per session instead of using canonical host-session name lookups. A new buildSessionsByProjectRoot helper maps project roots to session name lists. FastControlContext gains sessionNames, propagated through buildSwitchableAgentItems, buildMetaDashboardModel, and listAllProjectsExposeItems. resolveJumpTarget, expose.ts, and the tmux shell control script remove their getProjectSession-based session name overrides. Cross-project client-session targets now resolve through their host session when opened inside tmux.

Changes

Root-metadata session discovery and override removal

Layer / File(s) Summary
FastControlContext.sessionNames contract and buildSessionsByProjectRoot helper
src/fast-control.ts, src/meta-dashboard-model.ts
Adds optional sessionNames?: string[] to FastControlContext and introduces buildSessionsByProjectRoot, which reads @aimux-project-root per tmux session and builds a Map from resolved project root paths to session name lists, silently skipping sessions lacking the option.
Multi-session window aggregation in buildSwitchableAgentItems
src/fast-control.ts, src/fast-control.test.ts
buildSwitchableAgentItems now iterates all context.sessionNames, aggregates managed windows across sessions, deduplicates by windowId preferring non-client-session entries, and extends activityByWindowId collection via flatMap over all session names. New test validates root-matched session listing independent of canonical host name.
buildMetaDashboardModel and listAllProjectsExposeItems using sessionsByRoot
src/meta-dashboard-model.ts, src/meta-dashboard-model.test.ts
Both functions now compute sessionsByRoot once and derive per-project sessionNames from it, returning running: false with empty groups when no sessions match a project root. FastControlContext passed to listItemsFn now includes sessionNames. Tests updated with getSessionOption-aware fakes and new assertions for root-matched propagation and no-metadata non-running detection.
Remove getProjectSession session-name overrides
src/tmux/meta-dashboard.ts, src/tmux/meta-dashboard.test.ts, src/tmux/expose.ts, scripts/tmux-control.sh, src/tmux/control-script.test.ts
resolveJumpTarget drops the hostSessionFor callback and returns target as-is; performJump removes the corresponding getProjectSession call. expose.ts passes item.target directly to openTarget without overriding sessionName. The shell script's switch_local_window drops its second argument and removes the last-used state update, with both call sites updated. Tests reflect the simplified signatures and assert absence of last-used.json.
Cross-project client-session host-session resolution in openTarget
src/tmux/runtime-manager.ts, src/tmux/runtime-manager.test.ts
openTarget now computes a host-session override when insideTmux is true and the target session is a client session, using this openSessionName for subsequent resolution. resolveOpenSessionName now returns early for client-session inputs and fetches @aimux-project-root only for managed or insideTmux contexts. New test verifies cross-project client-session targets resolve through their host session.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • TraderSamwise/aimux#126: Both PRs touch the cross-project meta-dashboard/Exposé jump pipeline—main PR removes the hostSessionFor-based session name rewriting from resolveJumpTarget, which directly inverts the session name override behavior introduced in that PR.
  • TraderSamwise/aimux#134: Both PRs modify src/tmux/expose.ts's cross-project tile jump/openTarget path (main PR removes the derived sessionName injection when calling tmux.openTarget, while the other PR rewrites the cross-project selection logic for the same Exposé flow).
  • TraderSamwise/aimux#188: Both PRs modify src/fast-control.ts to refine which tmux sessions' managed windows feed buildSwitchableAgentItems—main PR changes to aggregate across multiple root-matched sessions, while the retrieved PR adds tmux.isWindowAlive(...) filtering to the same window-listing path.

Poem

🐇 No more asking "which host is the one?"
I read the root option and now I'm done!
Each session declares where its project lives,
The @aimux-project-root is all it gives.
getProjectSession sleeps, the map takes reign —
Hippity-hop down the multi-session lane! 🗂️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% 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 and concisely summarizes the main change: updating project ownership detection to use tmux root metadata instead of derived session names, which aligns with the primary objective and the substantial architectural changes across multiple files.
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 chore/tui-next-43

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

@TraderSamwise TraderSamwise changed the title Remove stale TUI tmux ownership paths Use tmux root metadata for TUI project ownership Jun 21, 2026
@TraderSamwise

Copy link
Copy Markdown
Owner Author

Sub-agent findings fixed in 3d3bc99. Client-session targets now resolve through @aimux-host-session before openTarget chooses the caller's explicit client session, with a runtime-manager regression covering cross-project client-session targets.

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

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

Copy link
Copy Markdown
Owner Author

Second sub-agent finding fixed in 5db85be. openTarget now treats any tmux session with @aimux-project-root as an Aimux host for explicit client resolution, so noncanonical root-metadata hosts and client-session targets both resolve into the caller's per-client session. Added runtime-manager regressions for both cases.

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 21, 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 88c6feb into master Jun 21, 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