feat(factory): tmux terminals + pane/viewing-in on Factory Floor (extension half of #731)#734
Conversation
…ive) Replace the default-off boolean agents.enableTmux with an enum agents.terminalMode: 'auto' (default) runs agents inside tmux when isTmuxAvailable() (macOS/Linux), else native; 'tmux' forces tmux and warns+falls-back when unavailable; 'native' never uses tmux. The decision is a pure resolver (src/core/terminalMode.ts) so extension.ts never re-derives it inline. openSingleAgent, the H/V split handlers, the enable/disableTmux commands, and updateContextKeys all read the setting. createTmuxTerminal and the native path are reused unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
snapshotOwnTerminals now enriches each published LiveTerminal with tmuxSession, tmuxPane (from a new async getTmuxInfo getter in tmux.ts that lazily reads the %pane off the shared socket), and tabIndex (the 1-based editor-tab position resolved by a pure src/core/tabIndex helper matching the terminal name against its TabInputTerminal tab label). These three fields are the data contract the CLI reads to render 'Codium tab N' and to address panes uniquely. tmuxPane + tabIndex join the republish hash so a tab move re-publishes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> # Conflicts: # apps/factory/src/core/tabIndex.test.ts # apps/factory/src/core/tabIndex.ts
Code ReviewerVerdict: Ready to merge (with one minor fix recommended) Build: Confirmed PR-specific test targets:
What works wellThe Issues that need attention1 —
// floorAdapter.test.ts:309
const base: RemoteSessionLike = {
host: 'this-mac', sessionId: 's1', ..., replyMuxSocket: '',
// ← tmuxPane: string is missing; this is a type error
}This slips past Fix (two options):
Option 2 is slightly cleaner since 2 — // extension.ts:3877
const tmuxEnabled = normalizeTerminalMode(config.get('terminalMode')) !== 'native';With the new default of On a Windows install or a machine without tmux, users see the "Disable Tmux" command even though tmux was never used. Clicking it just sets the mode to This is a minor UX issue, not a correctness bug. A tighter version would call Things to verify manuallyThe pane-ID read ( Reviewed by Code Reviewer — ran Instruction files read: |
…parity sync) Rebuilt on current main (post apps/factory tmux merge #734), reconciling the feed model so both the tmux pane/viewing-in fields and the parity-sync fields coexist. - Fan-out remote-session enrichment: correct per-device attribution (machine), worktree slug + live preview + structured ticket + real branch surfaced on cards. - resolveStartedAtMs caches start time by PID (no more Date.now() drift per republish). - Single @shared feed model with a MISSING_EXPORT build-time drift guard. - Merge reconciliation: FloorAgent/RemoteSession carry both viewingIn/tmuxPane (#734) and preview/pr/worktree/machine (this PR); normalizeRecentSession defaults the live-only tmux fields to '' for idle/historical rows. - Add apps/factory/CHANGELOG.md so scripts/release.sh preflight passes (was missing; every release attempt would exit 1 on the CHANGELOG grep). Supersedes #732 (which was based on the pre-#734 layout and conflicted).
What
Extension half of the tmux terminal standardization (companion to CLI #731). Makes the Factory Floor feed workable by giving every agent terminal a stable, external address (a tmux pane) and surfacing where each agent is being viewed.
Same-cwd agents were previously indistinguishable and VS Code terminal tabs had no external addressing — the root cause behind the feed bugs (#145 host mis-attribution, #147 drifting startedAt, #149 status-bar-wrong-session). tmux panes give a uniform, resumable, trackable identity.
Changes
agents.terminalMode: auto | tmux | native, replaces the old booleanagents.enableTmux).autoruns agents inside tmux on macOS/Linux for uniform addressing/resume/tracking, falling back to a native VS Code terminal on Windows or when tmux is missing. —terminalMode.ts(pure, unit-tested),extension.tstabIndex.ts(pureresolveTabIndex, unit-tested),tmux.ts,foreman.registry.tsremoteSessions.ts,FeedItem.tsx,floorAdapter.ts,floorModel.tsTesting
tsc -p ./clean (0 errors)tabIndex.test.ts+remoteSessions.test.ts— 55/55;terminalMode.test.tspresent and greengenerateCommitMessageWithClaude,draftDispatchPrompt,resolveAlias,SessionWatcher5s timeout), none touching any file in this diffNotes
apps/factory/layout (branch base predates the restructure); three-dot PR diff is 14 files, all underapps/factory/.tmuxSession/tmuxPane/tabIndex/viewingIn.