docs(orchestrate): pin the target workspace before spawning; kill agents before closing panes - #6
Open
tawman wants to merge 2 commits into
Open
Conversation
…awning agents
wmux layout grid anchors to the caller's WMUX_SURFACE_ID; in background or
resumed coordinator sessions that env var is often stale (points at a dead
surface), and the app then falls back to whatever workspace the USER has
active. spawn-agents.sh passes no --workspace either, so a whole
orchestration grid + agents can land in an unrelated workspace the user is
working in (their --cwd still governs where they work, but it hijacks the
user's screen and breaks pane counting).
Docs-only change; the wmux CLI already supports everything referenced
(agent spawn / layout grid / list-panes / agent list all take --workspace,
and list-workspaces returns { id, title, isActive, cwd }):
- Phase 6b: resolve the target workspace at orchestration start via
list-workspaces (multiple workspaces can share a cwd — resolve by id)
and record it in state.json's workspaceId field, which has existed in
the schema all along but was never populated.
- Phase 6d: pin before spawning — primary path is select-workspace right
before spawn-agents.sh (OOTB-compatible); focus-preserving alternative
is layout grid --workspace + per-agent agent spawn --pane. Also fix the
stale claim that the script grids via 'wmux split' (it uses layout grid).
- Phase 7: scope agent list with --workspace (default is ALL workspaces,
so the listing may include the user's own agents from other sessions);
never kill an agent this orchestration didn't spawn.
… trees Closing an agent's pane before killing the agent leaves the registry stale — agent list keeps reporting the agent as running, agent kill then fails with "Agent not found" — and the launcher process tree (shell → node → claude) survives the pane close, invisibly burning CPU and tokens. - Phase 7 wave transition: if closing finished agents' panes to make room, reap in order (agent kill, then close-pane). - Phase 9: state the ordering rule, the stale-registry failure mode, and the recovery path (kill the process TREE by pid from agent list — Windows: taskkill /F /T /PID — and judge liveness by the process, not the registry status).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docs-only update to the orchestrate skill, from two failure modes hit in real multi-wave runs. No script changes — the wmux CLI already supports everything referenced.
1. Panes/agents spawn into the ACTIVE workspace, not the coordinator's
wmux layout gridanchors to the caller'sWMUX_SURFACE_ID. In background or resumed coordinator sessions that env var is often stale (points at a dead surface), and the app then falls back to whatever workspace the user currently has active.spawn-agents.shpasses no--workspaceeither — so an entire orchestration grid plus its agents can materialize in an unrelated workspace the user is working in. Their--cwdstill governs where they work, so the run succeeds, but it hijacks the user's screen and breaks pane-hygiene counting.CLI facts the new text relies on (all already shipped):
agent spawn,layout grid,list-panes, andagent listall accept--workspace <id>;list-workspacesreturns{ id, title, isActive, cwd }— and multiple workspaces can share a cwd, so the target must be resolved by id.Changes:
state.json'sworkspaceIdfield (which has existed in the schema all along but was never populated).wmux select-workspace <id>right beforespawn-agents.sh(works with the script unchanged); focus-preserving alternative islayout grid --workspace+ per-agentagent spawn --pane. Also fixes the stale claim that the script creates panes viawmux split— it useswmux layout grid(6d and 6e).agent listwith--workspace(the default is ALL workspaces, so the listing can include the user's own agents from other sessions) and never kill an agent the orchestration didn't spawn.2. Teardown order:
agent killBEFOREclose-paneClosing an agent's pane first leaves the agent registry stale —
agent listkeeps reporting the agent asrunning,agent killthen fails with "Agent not found" — and the launcher process tree (shell → node → claude) survives the pane close, invisibly burning CPU and tokens.Changes: