Skip to content

fix: deliver only the diff the Judge saw; DOT never closes the card - #180

Merged
egagofur merged 1 commit into
mainfrom
fix/deliver-judged-diff
Nov 24, 2026
Merged

egagofur merged 1 commit into
mainfrom
fix/deliver-judged-diff

Conversation

@egagofur

Copy link
Copy Markdown
Owner

Why

In a real DOT project, a run got stuck after Judge PASS. Test fixes for Devil's Advocate findings changed the diff, gate maker --from-git overwrote the judged diff.patch, and the only way out was run --abandon. The MR, card and Mattermost steps still went ahead, but the run never passed the delivery gate.

We reproduced it on 3.0.1 in scratch repos (same flow as bench/sandbox/scenario.sh) and found that the e2e happy scenario never edits code after PASS. Four gaps came up:

# Gap on 3.0.1 Now
1a verify ran on the working tree but recorded evidence against the stale diff.patch hash, so a fix made after gate maker was verified while DA and the Judge reviewed the old diff refused; the fix names run --reopen
1b deliver never compared the committed code with the judged diff, so code added after PASS was DELIVERED unjudged refused; the fix names run --reopen
2 gate maker --from-git wrote diff.patch before checking state, so any call after MAKER_COMPLETE corrupted the run permanently, with misleading WHY/FIX refused before writing
3 no rework path from MAKER_COMPLETE/VERIFIED/REVIEWED/JUDGED_PASS run --reopen --reason starts a new iteration and archives the old evidence
4 --from-git diffed against HEAD, so committing before the Maker gate gave "no changes against HEAD" with no WHY/FIX diffs against the run's startedRevision

The ITERATE path (DA HIGH → Judge ITERATE → iteration 2) was already fine and still works.

Also in this PR

The DOT adapter now states that delivery never closes the card. GitLab closes an issue on merge to the default branch when a commit or MR text says Closes/Fixes/Resolves/Implements #n. References must now be Refs #<iid>, Related to #<iid> or the bare URL, and glab issue close is forbidden. The Coreview commit template no longer reads resolve <...>. tests/dot-no-auto-close.test.js scans every DOT adapter file for closing keywords. (The CHANGELOG line for this already landed with #179; the docs and test did not.)

Changes

  • lib/change-diff.js (new): one diff capture against startedRevision, shared by the Maker gate, verify and deliver
  • lib/gates.js, lib/run-state.js, lib/workflow-runtime.js, bin/ai-engineering-loop.js, lib/cli-args.js: reopen, assertMakerDiffWritable, judged-diff checks
  • skill-src/ael/references/loop-deliver.md, loop-judge.md (and the rebuilt host copies), core/iteration-policy.md: tell the agent to reopen instead of abandoning
  • bench/sandbox: new rework scenario
  • Tests: tests/rework-after-pass.test.js, tests/dot-no-auto-close.test.js

Verification

  • npm run check:skills: pass
  • npm test: 924/926. The two failures (hosts-registry.test.js:164, setup-run-flags.test.js:33) also fail on main on this machine, because a local opencode install leaks into host detection.
  • Scratch-repo repros for all gaps now refuse. Recovery run --reopen → loop → commit → deliver reaches DELIVERED.

🤖 Generated with Claude Code

- `verify` and `deliver` refuse code that differs from the gated diff.patch
  (committed or not), so evidence, review and verdict always match what ships.
- `gate maker --from-git` refuses to overwrite a gated diff and diffs against
  the Run's starting commit, so an early commit no longer hides the change.
- New `run --reopen --reason` starts a fresh iteration from MAKER_COMPLETE
  through JUDGED_PASS instead of forcing `run --abandon`.
- DOT adapter: delivery never closes the card; reference issues as
  `Refs #<iid>`, never after a GitLab closing keyword.
- Tests: rework-after-pass, dot-no-auto-close; bench sandbox `rework` scenario.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@egagofur
egagofur merged commit e90c485 into main Nov 24, 2026
10 checks passed
@egagofur egagofur mentioned this pull request Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant