Repository navigation
fix(claude): keep --mux and ephemeral herdr runs from killing other sessions - #1276
Merged
Merged
Conversation
…essions --mux against the box's other multiplexer only checked the session being started, but starting moves the box's mux marker: the box's other sessions were then looked for in the wrong multiplexer -- claude ls showed them stopped, and attaching started a second Claude beside one. It's now refused while any Claude session runs in the other one. An ephemeral herdr run's pane stopped herdr's server when Claude exited even after the run had detached and kept the box, killing the box's other sessions. The pane now stops it only while a stop file exists, which the run removes when it keeps the box. Claude-Session: https://claude.ai/code/session_01Ba6Vc66D5hH1xSTvJcCbVz
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1276 +/- ##
==========================================
+ Coverage 50.64% 50.67% +0.02%
==========================================
Files 83 83
Lines 9822 9840 +18
==========================================
+ Hits 4974 4986 +12
- Misses 4848 4854 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes two
cmd/mux.gobugs found in the review that went with #1275.1.
--muxmoved the box to another multiplexer while sessions still ran thereuseBoxMuxchecked only whether the session being started was running in the box's other multiplexer. Every start overwrites the box's mux marker, though, so the box's other sessions were then looked for in the wrong multiplexer:claude-authis running and the main session is stopped.onctl claude --mux tmuxpasses the check, and the marker becomes tmux.claude lsnow shows auth as stopped.onctl claude --task authsees nothing running in tmux, so it starts a second Claude in the same worktree.Fix: with
--mux, the run lists the other multiplexer's sessions and refuses while any Claude session (claude,claude-<task>) is running there. The error names the sessions. Sessions in that multiplexer that aren't Claude's don't count.2. An ephemeral herdr pane stopped the server after the box was kept
An ephemeral run's pane ran
herdr server stopafter Claude exited, so the attached client would return and the box could be deleted. That command was fixed at start, so it still ran after the user detached and the run kept the box. If the user then started--box X --task foothere, the main Claude exiting stopped the server and killed foo's Claude.Fix: the pane stops the server only while
/run/boxctl/<session>.stopexists. The run creates that file at start and removes it when it decides to keep the box.Tests
TestHerdrStartEphemeralruns the pane's actual command against the fake herdr. With the stop file present, the server is stopped; once the file is removed (kept box), it isn't. A detached start makes no stop file.TestClaudeSessionschecks that Claude sessions are counted, other sessions aren't, and no herdr server means none.go test ./cmd/passes,golangci-lintreports 0 issues.Not tested end to end on a real box.
useBoxMuxitself needs ssh, so only its decision (claudeSessions) is unit-tested.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ba6Vc66D5hH1xSTvJcCbVz