Skip to content

feat(do): warn when live-session check fails #56

Description

@unni-facets

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

  • go test ./... green
  • go vet ./... clean
  • Test covering the psRunner error path

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions