feat(agent-mux): tear down docker when a cmux workspace closes - #32
Open
mhardingjones-lupa wants to merge 9 commits into
Open
feat(agent-mux): tear down docker when a cmux workspace closes#32mhardingjones-lupa wants to merge 9 commits into
mhardingjones-lupa wants to merge 9 commits into
Conversation
Previously, the marker was written unconditionally even when the `docker compose down` command failed (the failure was suppressed by `|| true`). Now the marker is only written inside an `if` guard that ensures the teardown succeeded. Regression test added: verifies that when cd into the docker directory fails (missing directory), no marker is written. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lk-close debounce
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.
What
Automatically tears down a worktree's docker compose stack when its cmux workspace is closed, and re-ups it on reattach. Closing a workspace previously left containers running indefinitely (observed: 23 running, several idle 20–45h) because closing a cmux tab only detaches the tmux session — neither the
session-closedhook nordocker-start.sh's Ctrl+C teardown fires.How
dev-tmux-titled.sh— each ~15s tick it now also tails cmux's~/.cmuxterm/events.jsonlforworkspace.closedevents (non-blocking file read, no socket auth needed) and cleans up.dev-close-cleanup.sh(unit-tested with stubs + fixtures, 24 asserts).dev.shwrites aworkspace_id → worktreeregistry (on create + reattach) and re-ups torn-down docker on reattach.Key behaviours
docker compose downonly — never--volumes(data preserved; reopening re-ups fast).working_dirlabel, not the worktree basename (handles branch-named projects, e.g.eng-7925-3→ projectmatt-eng-7925-2-batches-at-conversion).~/workspace; explicit denylist forlupa-proxy/supabase_*/buildx_buildkit_*; collision-free marker keys (full-path hash) for case-insensitive FS + nested worktrees; no event-history replay (boot-aware cursor).Testing
agent-mux/tests/test-close-cleanup.sh— 24 asserts,failed 0. Reviewed per-task and via a whole-branch review; the critical marker-collision bug, the bulk-guard tick-split gap, and an infra-denylist hardening were caught in review and fixed.🤖 Generated with Claude Code