Repository navigation
feat(batch): hold a library only while its worker runs; merge its PRs in order (M3.6j) - #684
Merged
Merged
Conversation
…es wait in PR order (M3.6j, #683) - released_picks: a finished pick frees its library for a start, PR open or not; questions, parks, pending re-dispatch and answered restarts still hold; a /drop'ped task with no live worker holds nothing. - New worker on a library with this shift's open PRs gets SIBLING_NOTE (branch from main, never stack; ruling e for worktree_check_conflict). - _start_closeouts: a library PR waits (no close-out, no slot, no refusal) behind any earlier known PR on the same repo until GitHub says MERGED or CLOSED (rulings b, c, f); counters["merge_waits"] rebuilt each tick; a workspace PR waits behind its own task's library PR. - A PR cut before an earlier PR merged gets a branch-update session (closeout_update_template.md: gh pr update-branch, never force; ruling a) under its merge slot; `updated`/`current` re-checked each tick; merge close-out only on CI green at the new head, with a merge-order step 4b. UPDATE_LIMIT 2, UPDATE_CHECKS_GRACE_S 600. - carry_in carries updated/waiting PRs with what they waited behind. - Digest: waits-behind / updated states and a per-library "Merge order" block; events: `waiting`, and a refused PR names how many wait behind it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…683) - batch AGENTS.md: replace the #679 paragraph (a library is held while its worker runs; merges wait in PR order) and add the branch-update step to the close-out description. - skills/batch/batch.md: the planner's new held-library reason. - AUTONOMY.md: rulings a-f dated 2026-11-19 under "Unattended glance merges", and the per-tick blocking-PR read in the network surface. - test: a non-library example repo for the workspace-PR wait (tenant firewall). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…F5; #683) - F1: `merge-slot take` refuses a notify worker's in-turn merge while an earlier shift PR on the same library is open (in_turn_merge_blockers, the close-out's rule; unreadable blocks, unreadable counters exit 2); worker_template and SIBLING_NOTE say: end at PR-open. - F2: the spawn loop refuses a task whose library a live, parked or re-dispatch-pending task holds, whatever the plan's order made of it. - F5: gh_pr_state also reads headRefOid; an `updated` PR's CI is read only once GitHub shows the update's head; a head that moved refuses for /prm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Summary
A shift used to hold a library repo from a task's start until its PR merged (#680). A PR waiting for the human's
/prm(decision-taken, judge, public name) therefore stalled every later named task on that library for the rest of the shift: 4 of 7 tasks unstarted in shift 2026-11-18-pm, 2 of 4 in -pm2, about an hour idle each time.Now a shift holds a library for starting only while a worker on it is live, and serialises the merges instead (M3.6j):
obsoleteif a sibling already fixed it./prm), a short update session runsgh pr update-branch(a merge from main, never a rebase or force-push) and ends. A later tick runs the normal close-out once CI is green on the new head; the close-out checks the earlier merge commit is an ancestor of the head. A conflict, red CI on the new head, or a third update refuses it to/prm.waitingkind.The human's rulings a–f (2026-11-19, "approved, all six yes") are recorded in AUTONOMY.md. Ruling (a): only the update session pushes, and only via
gh pr update-branch; the watcher still writes no repository.Closes #683
API Changes
None to the public API — internal changes to the batch watcher only. New template
agents/conductors/batch/closeout_update_template.md; the held-library rejection text changes.See full details below.
Test Plan
tests/test_batch_*.py tests/test_orchestrator_*.py695 passed, 1 skipped (re-run before push)carry_inbehind; digest Merge order; eventswaitingFull API Changes (for automation & release notes)
Added
_orchestrator:SIBLING_NOTE,sibling_prs,UPDATE_TEMPLATE,update_prompt,after_step,_known_prs,_earlier_prs,_merge_blockers,_merged_after_start,_gh_once; constantsUPDATE_CHECKS_GRACE_S = 600,UPDATE_LIMIT = 2; counters keymerge_waitscloseout_update_template.md;{after_step}incloseout_template.md_digest: waits-behind / updating / updated / current states,### Merge order;_events:waitingkindChanged Behaviour
released_picks(counters, live=): any finished pick without a question is released (park, pending re-dispatch, in-shift restart still hold); a dropped pick with no live worker is released_start_closeouts: waits, update sessions, re-examinesupdated/current;reap_closeouts:updated/currentverdicts;carry_in: carriesupdated/currentandbehindDeviations from the plan (worker's)
_status.pyunchanged — the live view already uses_digest.task_state, so waits show there.after=andbefore=(step 4b).updated/currentwithin the review-at cutoff is left alone, not refused.Review fixes (b7c04fa)
notifyworker's in-turn merge could jump the order:bin/merge_slot.py takenow refuses (exit 1) while an earlier shift PR on the same library is open, using the close-out's own_merge_blockersrule viain_turn_merge_blockers; the worker ends at PR-open and the watcher's wait/update path takes over. Unreadable counters exit 2._library_holder) refuses a task whose library a live, parked or re-dispatch-pending task holds, whatever the plan's ranking.Known gaps
.doneis read, a moment before the worker session exits.updatedcan get one wasted close-out session (reaped as merged-outside, slot released).claude --bg.Heart (dev-ship gate for PyAutoBrain; reasons shown, not blocking)
Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code