Skip to content

fix-swarm template: patch export is overwritten per attempt — a bad retry can destroy a good attempt-1 patch #41

Description

@mlava

Symptom

templates/fix-swarm/checks/fix-swarm.py writes <key>.patch on every check run. If attempt 1 produced a correct patch but the check failed for an unrelated reason (e.g. a buggy verify assertion), the retry — steered by that misleading failure context — can mangle the tree, and attempt 2's check run then overwrites the good patch.

Evidence

Near-miss on 2026-07-14 (protocol-spec-fixes, specs-registry lane): attempt 1's patch was the exactly-correct 8-line change; attempt 2 burned ~70k tokens trying to satisfy a verify assertion that could not pass on a pristine repo, and only by luck did not alter the file before its check run re-exported the patch.

Proposed fix

In the template's check script: export <key>.attempt<N>.patch per attempt and copy the final one to <key>.patch (preserving the current interface for orchestrators). The orchestrator can then recover attempt 1's work after diagnosing a check bug.

Size: S, template-only — no ringer.py change.

🤖 Generated with Claude Code

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