Today flow do <task> calls liveClaudeSessions() to detect duplicate-tab races before spawning. If ps fails (sandboxed env, broken shim, etc.) the function returns (nil, err) and the live-session guard in internal/app/do.go:176 silently falls through to the spawn path:
if live, err := liveClaudeSessions(); err == nil {
// ... focus / refuse logic
}
The error is swallowed with no user-visible signal. In environments where ps reliably fails, users will silently see duplicate-spawn behavior with no indication that the safety check was skipped.
Proposed change
When liveClaudeSessions returns a non-nil error, print a single line to stderr before falling through:
warning: live-session check skipped: <error>
Then continue to the spawn path as today. Behavior on the happy path is unchanged.
Files
internal/app/do.go:175-197 — add the stderr line in the else branch of the err == nil check
internal/app/do_test.go — extend an existing test (or add one) that stubs psRunner to return an error and asserts the warning is written to stderr
Notes
- Best-effort signal: the check is non-blocking by design, so behavior must NOT change to error-out. Only the stderr surface changes.
- Match the tone of the existing duplicate-process warning at
do.go:179.
Acceptance
Today
flow do <task>callsliveClaudeSessions()to detect duplicate-tab races before spawning. Ifpsfails (sandboxed env, broken shim, etc.) the function returns(nil, err)and the live-session guard ininternal/app/do.go:176silently falls through to the spawn path:The error is swallowed with no user-visible signal. In environments where
psreliably fails, users will silently see duplicate-spawn behavior with no indication that the safety check was skipped.Proposed change
When
liveClaudeSessionsreturns a non-nil error, print a single line to stderr before falling through:Then continue to the spawn path as today. Behavior on the happy path is unchanged.
Files
internal/app/do.go:175-197— add the stderr line in theelsebranch of theerr == nilcheckinternal/app/do_test.go— extend an existing test (or add one) that stubspsRunnerto return an error and asserts the warning is written to stderrNotes
do.go:179.Acceptance
go test ./...greengo vet ./...cleanpsRunnererror path