Auto-merge requires the agent's setReadyForMerge signal (#1363) - #1392
Merged
Conversation
Merge is now authorized, not just configured (rule settled on #1390): an armed merge runs only when (a) the agent declared the session done via setReadyForMerge() — mirroring the on-before-mergeable check — and (b) the session's own TODO_<SESSION_NAME>.agent.md has no open entries (a temporary safety belt, built to be deleted). The global TODO_AGENTS.md queue never withholds: it is decoupled from sessions. A withheld merge is not a skipped handoff — push and PR go ahead, the PR opens as a draft, and the handoff event + transcript line say why the merge did not run. The system prompt's closing instruction becomes a required terminal action, so agents reliably signal — without this, gating on the signal would silently stop auto-merge on simple runs (live matrix row 3: the daemon merged 3s after the PR opened, the signal never emitted). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
brillout
reviewed
Jul 30, 2026
| After you're done, consider whether <SESSION_NAME> is finished and there isn't any work left to do — if that's the case then call setReadyForMerge() | ||
| After you're done, decide: is <SESSION_NAME> finished, with no work left to do? | ||
| - Yes: call setReadyForMerge() — required, the work is never merged without it | ||
| - No: don't call it; say what's left instead |
suleimansh
marked this pull request as ready for review
July 30, 2026 20:57
suleimansh
added a commit
that referenced
this pull request
Jul 30, 2026
Both PRs edited maybeAutoHandoff's neighborhood: the merge keeps the #1363 merge gate and adds this branch's `fixes` ride-along beside it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 30, 2026
suleimansh
added a commit
that referenced
this pull request
Jul 31, 2026
…p the obsolete uncommitted-changes step Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
suleimansh
added a commit
that referenced
this pull request
Jul 31, 2026
* sync system_prompt.md from #326: issue edit left every PR's drift check red Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Apply suggestion from @brillout Co-authored-by: Rom <git@brillout.com> * re-sync from the corrected #326: keep the #1392 required wording, drop the obsolete uncommitted-changes step Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Rom <git@brillout.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR: an armed merge now runs only when the agent called
setReadyForMerge()and its own session TODO file has no open entries. Push and PR are untouched; a withheld merge opens the PR as a draft and says why. The system prompt now makes the signal a required terminal action. Implements the rule settled on #1390 (fix #1363).The two halves (they must ship together)
maybeAutoHandoffwithholds the merge unless (a)journal.sawReadyForMerge()(same signal the on-before-mergeable step already requires) and (b)TODO_<SESSION_NAME>.agent.mdhas no open entries. NeverTODO_AGENTS.md: the global queue is decoupled from sessions, or auto-merge would never fire while any backlog exists.00-21-32-410Z) merged 3s after the PR opened with the signal never emitted.Built to be deleted
(b) is the temporary safety belt from #1390 — the agent's word should ultimately be enough. Deleting it = removing
sessionTodoOpenfromwithheldMerge()andsessionTodoPending()in todo-loop.ts; both say so in their comments.Visibility
A withheld merge is not a skipped handoff: the branch pushes, the PR opens (as a draft, since
draft: !intent.merge), and thehandoffevent carriesmerge: { outcome: 'withheld', reason }. The transcript now renders every merge outcome — before this, a merged/withheld/failed merge was invisible in a dashboard transcript.Tests
withheldMergedecision table (run-handoff.test.ts)sessionTodoPendingreads only the session file, ignoresTODO_AGENTS.md, refuses path-escaping names (todo-loop.test.ts)Not yet done: a live matrix row (needs the main checkout's daemon — will dogfood after merge like rows 1–3).
@brillout this touches
prompts/system_prompt.md— the new wording is the smallest change I could make that turns the suggestion into a required decision; rephrase freely.🤖 Generated with Claude Code