fix(tmux): stabilize flaky tests with WaitForShellReady
Some checks failed
CI / Check for .beads changes (push) Has been skipped
CI / Check embedded formulas (push) Failing after 22s
CI / Test (push) Failing after 1m30s
CI / Lint (push) Failing after 24s
CI / Integration Tests (push) Failing after 43s
CI / Coverage Report (push) Has been skipped
Windows CI / Windows Build and Unit Tests (push) Has been cancelled
Some checks failed
CI / Check for .beads changes (push) Has been skipped
CI / Check embedded formulas (push) Failing after 22s
CI / Test (push) Failing after 1m30s
CI / Lint (push) Failing after 24s
CI / Integration Tests (push) Failing after 43s
CI / Coverage Report (push) Has been skipped
Windows CI / Windows Build and Unit Tests (push) Has been cancelled
TestIsAgentRunning and TestEnsureSessionFresh_ZombieSession were flaky because they checked the pane command immediately after NewSession, before the shell had fully initialized. Added WaitForShellReady calls to wait for shell readiness before assertions. Closes: gt-jzwx Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -260,6 +260,12 @@ func TestEnsureSessionFresh_ZombieSession(t *testing.T) {
|
||||
}
|
||||
defer func() { _ = tm.KillSession(sessionName) }()
|
||||
|
||||
// Wait for shell to be ready - avoids flaky tests where the pane command
|
||||
// is briefly something other than the shell during initialization
|
||||
if err := tm.WaitForShellReady(sessionName, 2*time.Second); err != nil {
|
||||
t.Fatalf("WaitForShellReady: %v", err)
|
||||
}
|
||||
|
||||
// Verify it's a zombie (not running Claude/node)
|
||||
if tm.IsClaudeRunning(sessionName) {
|
||||
t.Skip("session unexpectedly has Claude running - can't test zombie case")
|
||||
@@ -332,6 +338,12 @@ func TestIsAgentRunning(t *testing.T) {
|
||||
}
|
||||
defer func() { _ = tm.KillSession(sessionName) }()
|
||||
|
||||
// Wait for shell to be ready - avoids flaky tests where the pane command
|
||||
// is briefly something other than the shell during initialization
|
||||
if err := tm.WaitForShellReady(sessionName, 2*time.Second); err != nil {
|
||||
t.Fatalf("WaitForShellReady: %v", err)
|
||||
}
|
||||
|
||||
// Get the current pane command (should be bash/zsh/etc)
|
||||
cmd, err := tm.GetPaneCommand(sessionName)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user