Skip to content

feat: tmux pane mirroring, subagent hard context cap, routing resilience fixes, and AI-assisted install guide - #2

Merged
mrzturn merged 10 commits into
mainfrom
dev
Sep 6, 2026
Merged

mrzturn merged 10 commits into
mainfrom
dev

Conversation

@mrzturn

@mrzturn mrzturn commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

  1. Add tmux pane mirroring for dispatched subagents, including reopening the mirrored pane for resumed (task_id) dispatches, with alt+up/alt+down mirror-key hints in the /modelRank filter placeholder
  2. Add a hard context cap for shell subagent sessions and document it in both READMEs
  3. Fix routing resilience: keep lane chains servable when providers or pools die, and surface newly added provider models without a restart
  4. Extend /modelRank with ctrl+up/ctrl+down reorder hotkeys and add an uncheck-all shortcut to the /poolConfig model dialog
  5. Add an AI-assisted install section at the top of the install flow in both READMEs: a copy-paste prompt that anchors the repo and npm package and walks any AI through npm-latest install, opencode-switchman.jsonc configuration, and /switchman-doctor + banner/load verification

Verification

  • bun test: 411 tests across 29 files, 0 fail (includes new tmux/subagent-cap/routing/scoring suites)
  • bun run typecheck: passes

1. Split the home tmux window 40/60: dispatched subagents render live via opencode attach in a right-hand column (max 3 panes, FIFO queue takes over freed panes in place, column shrinks back to the full main view as children finish)
2. Correlate child sessions via dispatch intents plus session.created/idle/deleted events; startup sweep clears leftover panes; fail-open everywhere and fully inert outside tmux
3. Add optional tmux config section (enabled/rightPct/maxPanes/mini) with SWM037 validation, 17 behavioral tests, and bilingual docs with a live screenshot
1. Register switchman.rank.move-up/down in a separate fail-open keymap layer (ctrl+arrows with alt mirrors); the open ranking dialog claims a module-level context so the keys are silent no-ops elsewhere
2. Extract the shared reorder semantics into the pure applyRankMove helper (pin/±1/unranked rules) and reuse it from the per-model action dialog
3. Cursor follows the moved model via the DialogSelect current prop; boundary hits toast without writing
4. Cover applyRankMove with a standalone unit suite
…laceholder

1. Show the mirror-key hint in the dialog filter placeholder so it stays visible while filtering
1. Clear the checkbox state in place with no disk write: exiting with none
   checked keeps the previous pool selection, the first check after the
   clear materializes the new explicit list (src/tui.tsx PoolModelsDialog)
2. Document the shortcut in both READMEs and the changelog
3. Regenerate the shell matrix manifest via gen:shells (timestamp bump)
1. Provider cache older than 24h (or with an unparseable timestamp) now
   triggers a live provider.list probe before the superset build; the
   stale cache stays the fail-open fallback (providerCacheStale /
   providerCacheAgeMs in src/state.ts, stale branch in the config hook)
2. Background watchdog detects model-list drift against the superset the
   running session was built from and rebuilds it in place via
   MatrixManager.updateSuperset — shell-superset manifest, /modelRank and
   /poolConfig lists, banner and activation view turn consistent
   immediately (src/matrix-manager.ts, computeSupersetFace in src/index.ts)
3. Dispatching the brand-new shells still needs one opencode restart
   (cfg.agent is injected once — platform constraint); the status log
   states it explicitly
4. Behavioral contract tests for the freshness gate, model delta and
   in-place rebuild (test/provider-refresh.test.ts)
1. A task call carrying task_id reuses the previous child session, so no session.created fires and the pane never (re)opened; the allowed dispatch sites now trigger it directly after verifying the reused session exists (a stale task_id falls back to a fresh session, still covered by the event path)
2. Sweep dead panes before the duplicate check in noteChild, so a viewer pane the user just closed no longer swallows the re-display
3. Cover both layers with manager-level and index-wiring tests
1. Filter matrix-down shells before seat allocation and backfill an otherwise-empty chain once via a relaxed-gate ranking pass, so vision/review no longer collapse to "all unavailable" while healthy lower-tier shells exist
2. Exclude proven-exhausted pools from chain seats via a snapshot-driven poolUnavailable resolver (selection only, observe-only safe); dropped candidates may re-enter as the chain tail through the backfill pass
3. Blink the [RESTART NEEDED] tag in the TUI sidebar while restartRequired is non-empty
1. Terminate a subagent at the cap (default 100k tokens, config context.subagentForceTokens/subagentCap): every further tool call in that session is denied with a wrap-up order, and the next text-only answer (detailed progress summary) becomes the task result returned to the delegator
2. Persist terminated sessions in subagent-cap.json — task_id resume denials are permanent across restarts; fresh dispatches without task_id are unaffected
3. Pre-arm compliance via SHELL_BODY rule 6 and document the orchestrator-side contract in the bundled protocol (section 2.4)
4. Cover the contract in test/subagent-cap.test.ts (termination, tool deny, resume deny, internal-session exemption, restart survival)
1. Add a dedicated feature section (EN/zh) covering the cap semantics, the wrap-up order on tool denials, and permanent task_id resume termination
2. Add context.subagentForceTokens/subagentCap rows to the options table and fix the stale shell-sessions-exempt claim
3. Announce the feature in the What's New lists with section anchors
…h READMEs

1. Add a "let your AI install it" section strongly recommending AI-driven setup for a lower error rate
2. Provide a copy-paste prompt anchoring the repo and npm package, covering npm latest install, opencode-switchman.jsonc configuration, and /switchman-doctor + banner/load verification
@mrzturn
mrzturn merged commit 1ae876d into main Sep 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