Skip to content

Builder launch loop relaunches an immediately-exiting agent every 2 s without bound #1855

Open

Description

@amrmelsayed

Problem

The baked builder launch loop relaunches the agent 2 seconds after every exit, without bound. When the agent exits immediately every time, the loop spins: a relaunch every 2 seconds until someone runs afx spawn --resume or afx workspace recover.

Found during Spec 1595 verification (PR #1854). The Claude launch now carries --settings ~/.agent-farm/hooks/lifecycle-reporter-settings.json. If that directory is deleted by hand, Claude exits with "Settings file not found" and the loop relaunches it every 2 seconds. An operator troubleshooting entry for this case ships with #1854 (workflow-reference.md in both trees). The same loop shape applies to any immediate-exit cause: a broken harness install, a bad flag, an auth failure.

Ask

A guard in the baked loop: after N immediate exits within a short window (for example 3 exits inside 10 seconds), stop auto-relaunching and wait at the existing relaunch prompt, printing the last exit code. Enter at the prompt relaunches as today. The guard touches neither the hook command nor its quoting.

Scope: the launch-loop template in spawn-worktree.ts, both trees if the skeleton carries it; a test for the bound; the relaunch-prompt text.

Out of scope

The hook settings file itself and the reporter; those are #1854.

Activity

  1. added
    area/tower
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tower

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions