feat: adopt existing cmux workspaces for supervision#261
Open
ss251 wants to merge 6 commits into
Open
Conversation
Register an already-running cmux workspace as a kind=adopted task with no worktree and no branch. Teardown un-registers without ever closing the workspace, the watcher exempts it from stale-pane wakes, and peek/send target it by pure UUID so the human's title is preserved. cmux-only and experimental; supervise-only (no delivery mode or PR). Refs kunchenguid#260
…tart and crew-state reads
Open
4 tasks
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.
Intent
Add an fm-adopt command so firstmate can supervise an already-running cmux workspace (kind=adopted) without spawning a new worktree or branch; peek/send/watcher work on it and teardown un-registers it without ever closing the workspace. Implements issue #260. cmux-only, experimental, supervise-only.
What Changed
bin/fm-adopt.shand tests for registering an existing cmux workspace askind=adoptedso firstmate can supervise it without spawning a new worktree, branch, or process.Risk Assessment
✅ Low: Captain, the change is scoped to cmux adoption paths and the shared watch/peek/send/teardown integrations look consistent with the intended supervise-only behavior.
Testing
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
bin/fm-adopt.sh:79-fm-adoptonly rejects an existing task id, but it never rejects an existingwindow=<workspace>:<surface>already registered under another id. The watcher andwindow_to_taskresolve a window to the first matching meta file, so double-adopting a surface or adopting a firstmate-spawned cmux task can make stale handling, peek/send ownership, and teardown bookkeeping attach to the wrong task or skip stale wakes entirely. After resolvingT, scanstate/*.metafor the samewindow=and refuse it.bin/fm-adopt.sh:98- Adoption accepts a live cmux surface based onlist-panes, butfm-crew-state.shlater treats non-tmux liveness asfm_backend_capture, which for cmux callsread-screen. The cmux adapter documents thatread-screenfails on fresh never-written surfaces, so an adopted live workspace can immediately reportbackend target gone. Usefm_backend_target_existsfor the adopted cmux liveness probe before falling through to busy/log classification.🔧 Fix: Harden adopted cmux supervision
✅ Re-checked - no issues remain.
⏭️ **Test** - skipped
Step was skipped.
✅ **Document** - passed
✅ No issues found.
⏭️ **Lint** - skipped
Step was skipped.
✅ **Push** - passed
✅ No issues found.