Skip to content

(bg-agents): hold a respawn's marker until the new worker is published #1033

Closed

Description

@devsuitup

Follow-up to #1032 (#1020).

In src/main/bg-agents/bg-agents-ipc.js (around :91 and :127), the per-job respawn flight is released as soon as runVerb returns. A restore waits for the worker's descriptor only after that, for up to 15 s. During that gap, a manual Respawn click in the Agents view, or a handoff, starts a fresh check, sees the job still dead, and can run a second claude respawn. The test at test/bg-duplicate-1020.test.js (around :308-310) currently allows that second respawn.

This needs a user action within seconds; the automatic overlap is already handled.

Fix: keep a per-job marker until the descriptor is published, or for 15 s, and make same-job callers join it.

Also decide how to treat a runVerb that returns ok:false without a refusal, such as the 60 s VERB_TIMEOUT_MS: the CLI may already have started the worker, so it should count as uncertain rather than allow a retry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions