Skip to content

fix(lifecycle): add shell init sleep in TmuxBackend.CreateSession (TASK-054)#65

Merged
jsell-rh merged 6 commits intomainfrom
fix/cwd-sleep-tmux-backend
Mar 10, 2026
Merged

fix(lifecycle): add shell init sleep in TmuxBackend.CreateSession (TASK-054)#65
jsell-rh merged 6 commits intomainfrom
fix/cwd-sleep-tmux-backend

Conversation

@jsell-rh
Copy link
Owner

Summary

  • Add time.Sleep(300ms) after tmux new-session in TmuxBackend.CreateSession before any send-keys calls
  • Fixes the working directory not being set when creating an agent from the UI

Root cause

TmuxBackend.CreateSession calls tmux new-session -d then immediately sends the cd <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)
  • Manual: create agent with custom working directory → verify agent starts in correct dir

🤖 Generated with Claude Code

jsell-rh and others added 6 commits March 9, 2026 16:15
…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>
@jsell-rh jsell-rh merged commit b97976f into main Mar 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant