fix(sling): verify session survives startup before returning success
The Start() function was returning success even if the pane died during initialization (e.g., if Claude failed to start). This caused the caller to get a confusing "getting pane" error when trying to use the session. Now Start() verifies the session is still running at the end, returning a clear error message if the session died during startup. Fixes: gt-0cif0s Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -250,6 +250,16 @@ func (m *SessionManager) Start(polecat string, opts SessionStartOptions) error {
|
||||
time.Sleep(2 * time.Second)
|
||||
debugSession("NudgeSession PropulsionNudge", m.tmux.NudgeSession(sessionID, session.PropulsionNudge()))
|
||||
|
||||
// Verify session survived startup - if the command crashed, the session may have died.
|
||||
// Without this check, Start() would return success even if the pane died during initialization.
|
||||
running, err = m.tmux.HasSession(sessionID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("verifying session: %w", err)
|
||||
}
|
||||
if !running {
|
||||
return fmt.Errorf("session %s died during startup (agent command may have failed)", sessionID)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user