sandcastle: cap pr-fixer maxIterations and escalate to human on exhaustion #41
Labels
No labels
in-review
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
weiwen/evie#41
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Priority: highest.
Problem
The
pr-fixerstep (.sandcastle/pr-fixer-prompt.md, invoked at.sandcastle/main.mts:188) runs withmaxIterations: 100on sonnet. A CI fix that needs 100 turns is a runaway, not a fix.Token accounting (see
.sandcastle/token-usage.sh) shows a single pr-fixer run (issue #23's CI rework) consumed 5.26M billed input tokens — 8% of all sandcastle spend across the entire project, from one invocation. The bloat is structural: pr-fixer re-runs the fullnix develop .#ci -c just checkgate and the large build/test log lands in context, then gets re-read every turn. Over up to 100 turns that compounds badly.Change
In
.sandcastle/main.mts:190, lowermaxIterationsfrom100to~25, and make the prompt escalate to a human on exhaustion instead of silently churning.Add to
.sandcastle/pr-fixer-prompt.md: if the check gate is still red after exhausting iterations, post a PR comment summarising what was tried and what is still failing, and stop — do not keep churning. (The PR staysready-for-human; a human takes over.)Scope
Scoped to the iteration cap + escalation only. Deliberately NOT in scope (premature until we see the fixer still bloating after the cap):
just checkgate on the verify stepAcceptance