Skip to content

fix: in-shift merges take a merge-cap slot; R3 in AUTONOMY (M3.6e) - #665

Merged
Jammy2211 merged 5 commits into
mainfrom
feature/shift-notify-merge-cap
Nov 17, 2026
Merged

Jammy2211 merged 5 commits into
mainfrom
feature/shift-notify-merge-cap

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

M3.6e of the autonomous-orchestrators epic (PyAutoBrain#661). In shift 2026-11-16-pm (merge-cap: 1) two workers merged notify PRs in-turn while a third, on the same bug · safe · notify header, left its PR for /prm, and the snapshot read "2 merged of merge-cap 1". Human ruling R3 (2026-11-17) settles it; this builds it.

  • One merge-slot count per shift: pyauto-brain merge-slot take|release|status <pr-url> --task <task> (file-locked, atomic, fails closed; canonical PR URL only; a slot answers only to its own task). A worker takes a slot as its own bare call before a bare gh pr merge, frees it if the merge fails, and leaves the PR for /prm when refused or paused. Watcher close-outs take from the same count.
  • The watcher's "only glance merges unattended" refusal for notify goes: it closes out a notify PR a worker left open on glance terms (free slot, witness run by the close-out session, refused with no Witness:). judge, undeclared and decision-taken still go to /prm. notify close-outs add no glance Shadow-window/stage-2 row.
  • The digest labels each merge from slot evidence: "merged in-turn by the worker (merge slot)" or "merged in-turn with NO merge slot" (flagged, counted by /cap).
  • pyauto-brain merge-mode <prompt> [--auto] [--in-shift] prints effective level: <level>; merge mode: <mode>; start_dev step 3 uses it.
  • AUTONOMY.md: the R3 ruling as a dated H3 inside "Merge authority follows Consequence" (human-approved wording; only <pr> → <pr-url>), with pointers from "Levels × checkpoints" and Decide-and-flag.

API Changes

New CLIs pyauto-brain merge-slot and pyauto-brain merge-mode; new module agents/conductors/batch/_merge_slots.py; _sizing.merge_mode(). Watcher close-outs now admit notify.
See full details below.

Test Plan

  • Witness, new tests fail on origin/main and pass here: tests/test_closeout_merge_slots.py (merge-cap 1 refuses a second in-turn notify merge — fake gh logs one merge; atomic across processes; worker and watcher share slots; cross-repo PR numbers never share; take/release must match the task) and tests/test_orchestrator_merge_slots.py (auto·safe·notify bug with witness merges and counts "1 merged of merge-cap 1"; merge-mode line; slotless merge flagged; notify close-out refuses without Witness)
  • grep -n "2026-11-17" AUTONOMY.md → R3 H3 + two pointers
  • Full suite: 2218 passed, 1 skipped; 1 failure test_grouped_organ_consumers is environmental (fails on origin/main under activate.sh)
  • Independent review (Fable 5.2, author Opus 5.5): FINDINGS → fixed → CLEAN
  • Trial merge after M3.6d + M3.6a: one import-line conflict in _orchestrator.py (keep both import _login and import _merge_slots)
Full API Changes (for automation & release notes)

Added

  • pyauto-brain merge-slot take|release|status <pr-url> [--task T] [--why W] — exit 0 taken/not in a shift, 1 refused, 2 cannot tell / bad input
  • pyauto-brain merge-mode <prompt> [--auto] [--in-shift]
  • _merge_slots.publish/take/release/used/why_unmerged; _sizing.merge_mode(p, level, *, auto, in_shift)

Changed Behaviour

  • _start_closeouts: notify admitted on R3 terms; cap enforced by take before spawn
  • _cmd_cap merges: slots taken plus slotless in-shift merges
  • digest merge labels from slot evidence

Mind half: the PyAutoMind PR on the same branch (lifecycle.py close row matching). Refs PyAutoBrain#661. Merge after M3.6a (rebase for the import line).

Heart RED override (development only)

  • Authorization (live human, 2026-11-17, this session): asked "Do you authorize the AUTONOMY 'Human override for Heart RED (development only)' to push and open their PRs [M3.6a feat: shift launch preflight — issue, login probe, brief discovery (M3.6a) #659, M3.6d fix: shift ledger edit op; hold completion on a set-aside (M3.6d) #660, M3.6e fix: in-shift merges take a merge-cap slot; R3 in AUTONOMY (M3.6e) #661]? Merging stays with your /prm." — answered "Override all three".
  • Exact current RED reason (pyauto-heart readiness --dev --repos PyAutoBrain,PyAutoMind): PyAutoMind: Tenant Firewall Gate failure on main — pre-existing generated-hook drift from PyAutoMind#575 (run 43881901227, 2026-11-16); this branch does not touch those hooks and does not claim to fix Heart.
  • Branch gates passed: witness and review-round tests fail on base and pass; full Brain suite 2218 passed (1 environmental failure, also on origin/main); Mind lifecycle tests 179 passed, Mind suite 1046 passed; independent Fable 5.2 review CLEAN.
  • Permitted: commit, push, open this PR. Merge needs a separate human /prm with every required check green. No release.

🤖 Generated with Claude Code

Jammy2211 and others added 4 commits November 17, 2026 13:48
Shift 2026-11-16-pm read "2 merged of merge-cap 1": workers merged
notify PRs in-turn without consulting the cap, and the watcher refused
notify as "only glance merges unattended". Ruling R3 (2026-11-17):

- _merge_slots.py: one file-locked merge-slot count per shift; the
  watcher publishes cap and pause each tick, fails closed.
- pyauto-brain merge-slot take|release|status (bin/merge_slot.py): a
  worker's separate bare call before a bare gh pr merge.
- watcher: notify PRs are closed out on glance terms; judge/undeclared
  go to /prm; close-outs take a slot just before spawn and release it on
  refusal; notify close-outs add no stage-2 row; /cap merges counts slots.
- digest: an in-turn merge reads "merged in-turn by the worker (merge slot)".
- sizing.merge_mode + pyauto-brain merge-mode: the one-line effective
  level and merge mode start_dev step 3 prints.
- skills, worker and close-out templates, AUTONOMY.md R3 H3 + pointers.

Refs #661.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs PyAutoBrain#661

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t evidence

Review findings on #661:
- merge-slot take accepts only a https://github.com/<owner>/<repo>/pull/<n>
  URL (normalised; anything else exits 2) and requires --task in a shift;
  a held slot answers yes only to the same task (the worker, or the
  close-out of the task the watcher took it for). PR #12 of two repos no
  longer shares a slot.
- digest labels an in-turn merge from the slot file: merge slot, or
  "merged in-turn with NO merge slot" (needs you, R3 revert evidence);
  /cap merges counts slots plus unslotted in-turn merges.
- close-out refuses a notify task that declares no Witness:.
- worker template and /prm pass <pr-url> --task; AUTONOMY R3 code span
  reads <pr-url>.

Refs #661.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every worker and close-out session holds as one class, so release now
takes the task and frees a slot only when the holder's task matches;
the CLI refuses another task's slot (exit 1, naming the holder) and a
release with no task cannot tell (exit 2), as for take.

Refs #661 (re-review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
start_dev (SKILL.md + start_dev.md) was 205 lines, over the 200-line
skill budget CI checks. Step 3 keeps the instruction to run
pyauto-brain merge-mode; the tier table and R3 note move to
reference.md "Tier + merge mode line". Now 194 lines.

Refs #661.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit c2dce4e into main Nov 17, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/shift-notify-merge-cap branch November 17, 2026 15:21
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