Skip to content

Add operator-invoked resume flag for failed groups (re-spawn worker on the existing worktree) #201

Done

Description

@w4ffl35

Problem

When a group fails for a transient, operator-fixable reason after its round is over, there is no supported way to resume it on the same worktree. Real case 2026-12-05 (airunnerweb round): group w8 failed on OpenRouter HTTP 402 (per-key usage limit). The worktree had salvageable progress (2 commits on #439 plus uncommitted edits for #435/#437/#439/#441) and the fix was operator-side (raise the key limit). The iteration-cap continuation path (--max-continuations, same-worktree re-spawn with a *-continueN.md task file) already exists inside a live round, but once the round exits there is no CLI entry point to do the same thing - the operator must hand-roll run-worker.sh <worktree> <hand-written-task-file> --mode <slug> by reading cli.ts internals to replicate env/selection args.

Worse, the hand-rolled path is fragile: my first attempt exported the key slightly differently from what scripts/headlesscode-orchestrate.sh does and the worker died on iteration 1 with 401, which a first-party resume path would have avoided by reusing the round's own key resolution.

Proposal

headlesscode orchestrate --resume --repo <path> --group <name> [--group <name> ...] (name bikeshed welcome; --retry-group also fine):

  1. Refuses unless the group is terminal-failed in .orchestrator-state.json and its worktree still exists with salvageable progress (same check the max-iterations rule uses: not at the same commit as base, or human explicitly overrides).
  2. Writes a *-continueN.md task file with the same builder the in-round continuation uses, noting the previous failure reason from the state file.
  3. Re-spawns via the exact same spawn path/env as in-round continuations (same model, executor, iteration cap, key resolution) - no hand-rolled env.
  4. Patches the group back to running so a subsequent orchestrate status --wait picks it up.

Acceptance

  • --help documents the flag; attempting it on a done group or a missing worktree errors clearly instead of spawning into the void.
  • The w8 case above is reproducible through the flag alone with no manual env assembly.

Activity

  1. w4ffl35 commented on Dec 6, 2026

    @w4ffl35
    MemberAuthor

    Done in PR #205 (commit 38901b2). headlesscode orchestrate --resume --retry-failed / --retry-group forces a continuation spawn on terminal-failed groups via the same handleIterationExhaustion spawn path/env as in-round continuations. Refuses done groups ('not terminal-failed'), missing worktrees, and empty worktrees (override with --force-retry); --help documents both flags. Verified: All 56 resume tests passed, tsc clean, zero NEW standards/arch findings in the touched files.

  2. added a commit that references this issue on Dec 6, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions