fix(runner): a committing agent's work is no longer discarded as scaffold-only #407
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
toasterson/Anima!407
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/committing-agent-work-discarded"
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?
Regression repair for #396, which I merged earlier today.
#396 added a content gate to
open_or_update_pr: a scaffold-only staged diff yields no branch and no PR, so a poisoned round-1 branch cannot be inherited by the next dispatch. That gate is right. What it reads is wrong.It gates on
git::capture_diff, which stages the working tree. The forcing prompt asks the agent to commit its own work, and opencode does. Once it has,add -Afinds nothing left to stage, the diff is empty, and a completed turn is classified scaffold-only — so the branch is never pushed and the work is thrown away.head_ahead_of_baseexists precisely for this case; its doc comment describes the exact failure, observed 2026-07-25. But the gate returns early, so it is unreachable.Measured
Four consecutive sessions on 2026-07-28, all
stop_reason=end_turn, all loggingskipping commit/push/PR: staged diff is scaffold-only … bytes=0while their worktrees each held a real commit one ahead of base:WI-387's lost turn was ~1000 events: a
TurnOutcomeenum on the witness, migration 082, activity-event plumbing and 8 new tests. The agent reported "all 323 unit tests pass". I recovered that commit from the runner's worktree volume — it is #406.The change
When nothing is staged, the content gate takes its input from the branch (
git::diff_against_base,origin/<base>..HEAD) instead of the working tree.Both gates still apply, to the same content:
.anima/scaffold is still skipped;Those are the two cases #396 exists to catch, and each has a regression test alongside the positive case.
Verification
cargo check --workspace --all-targetsclean;cargo test -p anima-runner83 passed.Deploy note: this is runner-side. It needs the compose fleet image rebuilt and the runners recycled — the k8s roll does not carry it.
🤖 Generated with Claude Code