fix(lifecycle): add shell init sleep in TmuxBackend.CreateSession (TASK-054)#65
Merged
fix(lifecycle): add shell init sleep in TmuxBackend.CreateSession (TASK-054)#65
Conversation
…ckend (TASK-054) Without a sleep after tmux new-session, the first send-keys (cd workDir) races shell startup and is silently dropped, causing agents to start in the wrong working directory. Add 300ms sleep before sending any keys — matches the pattern already used in handleAgentSpawn (lifecycle.go). The original fix targeted agent_backend.go which no longer exists after the SessionBackend interface refactor (PR #58); this applies the same fix to the correct file: session_backend_tmux.go. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
time.Sleep(300ms)aftertmux new-sessioninTmuxBackend.CreateSessionbefore anysend-keyscallsRoot cause
TmuxBackend.CreateSessioncallstmux new-session -dthen immediately sends thecd <workDir>keystroke. Without a delay, this races shell initialization — the shell hasn't started yet, so the keystroke is silently dropped and the agent starts in the default directory (not the requested working directory).The same pattern was already used in
handleAgentSpawn(lifecycle.go) which added a 5s sleep before sending the ignite command.Note
The original fix from LifecycleMgr targeted
agent_backend.go, which no longer exists after the SessionBackend interface refactor (PR #58). This PR applies the same fix to the correct file:session_backend_tmux.go.Test plan
go test -race ./internal/coordinator/passes (188 tests)🤖 Generated with Claude Code