Skip to content

Headless runs give up on 529 after 3 retries while claude code retries ~10 — workers die in transient capacity cascades #349

Description

@dahai80

Observed

A headless dispatch (fusion-code -p "<task>" run by fusion-console's worker fleet) through our local gateway failed after ~1 minute with:

API Error: Repeated 529 Overloaded errors

The gateway logged the requests fine (auth, route decision, several clean streamed turns), then the cloud glm-5 backend intermittently returned 529. Plain claude workers dispatching through the same gateway at the same time all completed — only the fusion-code worker died.

Root cause: 529 retry budget differs from claude code

src/services/api/withRetry.ts:

  • MAX_529_RETRIES = 3 (line 71; enforced at line 364 → throws REPEATED_529_ERROR_MESSAGE), while DEFAULT_MAX_RETRIES = 10 applies to other retryable errors. Claude code keeps retrying overloaded responses up to ~10 attempts with exponential backoff, so a short 529 cascade is transparent to it; fusion-code converts the same blip into a hard failure after 3 strikes (~seconds of backoff).
  • The persistent retry mode (FUSION_CODE_UNATTENDED_RETRY — 429/529 retried indefinitely with a 5-minute backoff cap, purpose-built for unattended sessions) exists but is gated behind feature("UNATTENDED_RETRY") (line 128, marked "ant-only"), so external builds (brew / install.sh) cannot enable it — headless workers shipped outside the internal environment have no escape hatch.

Headless -p runs are exactly the workload that should ride out capacity blips: there is no human watching, and the caller (console worker fleet) treats the abort as a failed task.

Suggested fix

  1. Make the 529 retry budget for foreground/headless sources env-tunable (e.g. FUSION_CODE_MAX_529_RETRIES), default unchanged for interactive REPL use.
  2. And/or expose FUSION_CODE_UNATTENDED_RETRY (or a smaller "headless" variant: ~10 retries, longer backoff) outside the ant-only feature gate.

Env on the failing run: fusion-code 0.8.5 (brew), gateway = fusion-gateway dual-protocol, backend = cloud glm-5 intermittently returning 529 while local MLX was memory-overloaded.

🤖 Generated with Claude Code

Activity

  1. dahai80 commented on Nov 26, 2026

    @dahai80
    OwnerAuthor

    Fix in #352: FUSION_CODE_MAX_529_RETRIES env override (clamped to 10, default unchanged at 3). For the failing worker fleet: set FUSION_CODE_MAX_529_RETRIES=10 in the worker environment and 5-short-cascade blips ride out transparently, matching claude code's behavior on the same gateway. Option 2 (persistent retry outside the ant-only gate) deliberately not included — the budget override covers the observed mode without widening the indefinite-retry surface.

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