Skip to content

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

Closed

Description

@Jammy2211

Overview

Milestone task M3.6e of the autonomous-orchestrators epic. 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: the bug cap does not stop a notify self-merge under --auto, and it counts against merge-cap. This makes every in-shift merge take a slot from one counter, writes R3 into AUTONOMY.md, has start_dev print the effective level and merge mode, and fixes lifecycle.py close row matching. Build first, in chat.

Plan

  • One merge-slot counter per shift (pyauto-brain merge-slot take|release|status, file-locked, fails closed); a worker takes a slot before its bare gh pr merge 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 the same terms as glance (free slot, witness run by the close-out session, Heart not RED, nothing never-auto-merged). judge, undeclared and decision-taken still go to /prm.
  • The digest says whether each merge was in-turn by the worker or a close-out.
  • pyauto-brain merge-mode <prompt> [--auto] prints effective level: <level>; merge mode: <mode>; start_dev step 3 uses it.
  • R3 written into AUTONOMY.md as a dated H3 inside "Merge authority follows Consequence" (wording approved by the human 2026-11-17), with pointers from "Levels × checkpoints" and Decide-and-flag.
  • PyAutoMind: lifecycle.py close finds the active.md row by slug, then prompt path, then issue URL.
  • Tier: judge — merge mode: human /prm
Detailed implementation plan

Affected Repositories

  • PyAutoBrain (primary)
  • PyAutoMind (added: scripts/lifecycle.py lives there)

Branch Survey

Repository Current Branch Dirty?
PyAutoBrain (canonical) main, 6 behind origin untracked .worktrees/ only
PyAutoMind (canonical) main, behind origin another session's uncommitted batches/2026-11-16-pm.md (left alone)

Suggested branch: feature/shift-notify-merge-cap (worktree ~/Code/PyAutoLabs-wt/shift-notify-merge-cap/). Parallel with M3.6a/M3.6d.

Implementation Steps

  1. New agents/conductors/batch/_merge_slots.py: merge_slots.json per slot under fcntl.flock, atomic os.replace; publish(slot, cap, paused), take(slot, pr, by, task) -> (ok, why) (idempotent per PR; refusals recorded; no published cap or paused → refuse), release, used, why_unmerged.
  2. New bin/merge_slot.py wired as pyauto-brain merge-slot take|release|status <pr>; exit 0 taken or not in a shift, 1 refused, 2 cannot tell.
  3. _orchestrator.py (only): imports; _closeouts publishes the cap; reap_closeouts releases the watcher's slot on a refused close-out; _start_closeouts: notify admitted under R3 terms, judge/no tier "never merged unattended", take just before spawn (replacing the counter check), release on spawn failure; _cmd_cap counts via _merge_slots.used.
  4. _digest.py: "merged in-turn by the worker (merge slot)" vs close-out.
  5. agents/faculties/sizing/_sizing.py: merge_mode(p, level, *, auto, in_shift) beside effective_autonomy; new bin/merge_mode.py wired as pyauto-brain merge-mode.
  6. Skill text: start_dev.md step 3 and reference.md --auto; prm/reference.md "Tiered merge" (in a shift, merge-slot take first; R3 witness condition); ship_library.md, ship_workspace.md pointers; worker_template.md take a slot before merging.
  7. AUTONOMY.md: R3 H3 plus two pointer lines.
  8. Update test_a_non_glance_task_is_never_closed_out (notify reason; add a judge case).
  9. PyAutoMind PR: scripts/lifecycle.py close_registries returns (reg, heading) matched by slug → prompt: path → issue: (from new --issue or the prompt's Issue:; only when exactly one row matches); cmd_close prunes by the matched heading and prints it.

Witness (amended: tests/test_closeout*.py matched no file)

python -m pytest tests/test_orchestrator_*.py tests/test_closeout_merge_slots.py -q in PyAutoBrain, and python -m pytest tests/test_lifecycle_close.py -q in PyAutoMind:

  1. tests/test_closeout_merge_slots.py::test_merge_cap_1_refuses_second_in_turn_notify_merge
  2. tests/test_orchestrator_merge_slots.py::test_auto_safe_notify_bug_with_witness_merges_and_counts
  3. tests/test_orchestrator_merge_slots.py::test_merge_mode_prints_effective_level_line
  4. Mind tests/test_lifecycle_close.py::test_close_drops_active_row_by_prompt_path, ..._by_issue_url
    plus grep -n "2026-11-17" AUTONOMY.md.

Key Files

  • agents/conductors/batch/_orchestrator.py, new _merge_slots.py, _digest.py, agents/faculties/sizing/_sizing.py
  • skills/prm/reference.md, skills/start_dev/, AUTONOMY.md
  • PyAutoMind scripts/lifecycle.py

Original Prompt

Click to expand starting prompt

M3.6e Shift workers merge notify-tier PRs in-turn past the shift's merge-cap, and inconsistently

Type: bug
Target: PyAutoBrain
Repos:

  • PyAutoBrain
    Difficulty: small
    Autonomy: supervised
    Priority: high
    Status: draft
    Filed: 2026-11-16
    Epic: autonomous-orchestrators
    Phase: 10
    Consequence: judge
    Witness: python -m pytest tests/test_orchestrator_*.py tests/test_closeout*.py -q passes with new tests that fail on today's main: (1) in a shift with merge-cap: 1, a second in-turn notify merge is refused and left for /prm (the fake gh logs one merge call); (2) under --auto a bug prompt with Autonomy: safe, Consequence: notify and a held witness merges in-turn and the snapshot shows "1 merged of merge-cap 1"; (3) start_dev prints one line "effective level: ; merge mode: " for that prompt; (4) lifecycle.py close finds the active.md row by prompt path or issue URL when the heading does not match the slug; and grep -n "2026-11-17" AUTONOMY.md shows the R3 ruling
    Lane: any
    Unattended: never

Seen in shift 2026-11-16-pm (brief merge-cap: 1). Events, from ~/Code/PyAutoLabs-wt/.orchestrator/2026-11-16-pm/events.jsonl:

  • 18:33Z dashboard_recent_lists_planned_tasks_twice opened PyAutoBrain#654 (notify): the watcher said "Not merging: tier notify — only glance merges unattended. Left for your /prm."
  • 18:44Z dashboard_md_epic_ledger_backticks_render_literally merged PyAutoBrain#655 in-turn (notify), and seed_samplers_for_byte_stable_rerenders merged autofit_visualization#8 in-turn (notify), both as the human's login at 18:41Z.
  • The next snapshot read "2 merged of merge-cap 1".
  1. Cap: a worker's in-turn tiered merge (ship_* → /prm "Tiered merge", AUTONOMY.md "Merge authority follows Consequence") does not consult the shift's merge-cap. Inside a shift, every merge (in-turn or close-out) should take a merge slot from the watcher first, and refuse when none is left, leaving the PR for /prm.
  2. Consistency: same tier, two outcomes (fix: dashboard Recent lists a planned task once, not as row + draft #654 left for /prm, fix(intake): render epic ledger paths as <code> in dashboard.md #655 and PyAutoBrain: full Stages 0-3 release-validation orchestrator (M4) #8 merged in-turn). Decide which is the rule for notify inside a shift (the watcher's "only glance merges unattended" or the worker's in-turn merge) and make the worker contract and the watcher agree; the digest should say which path each merge took.
  3. Close-out row match (seen in the /prm close-out after the shift): lifecycle.py close found no active.md row to drop for validation_wall_estimates_miss_eval_count_and_sampler_floor and dashboard_recent_lists_planned_tasks_twice, because the row headings did not match the task slug; the rows were removed by hand. Make the match use the prompt path or issue URL, not only the slug.
  4. Tests for each.

Added 2026-11-17 (M3.6e, from the shift 2026-11-16-pm review)

This prompt is now milestone task M3.6e of the autonomous-orchestrators epic. The #654 worker
recorded why it did not merge: "effective level supervised (header safe, bug cap supervised)
→ --auto ship sign-off is decide-and-flag". The #655 worker, on the same bug · safe · notify header, merged. The doctrine did not say which was right.

Human ruling R3 (2026-11-17): the bug work-type cap does not stop a notify self-merge
under --auto. A notify bug with a held witness merges, and it counts against
merge-cap. That settles item 2: the worker's in-turn merge is the rule, and the watcher's
"only glance merges unattended" refusal for notify changes to match.

  1. start_dev prints the effective level and merge mode in one line before work starts,
    so a worker and a reader see the same answer.
  2. Write R3 into AUTONOMY.md with its date, beside "Merge authority follows Consequence",
    and make the worker contract and the watcher read it the same way.

Out of scope: the unattended glance grant itself (the M3 gate), and any change to which
tiers merge outside a shift.

Activity

  1. Jammy2211 commented on Nov 17, 2026

    @Jammy2211
    ContributorAuthor

    Library PRs created

    Built test-first (new tests fail on origin/main, pass on the branch), independently reviewed by Fable 5.2 (author Opus 5.5): FINDINGS → fixed → CLEAN. Workspace impact: none (organ-only change). Merge: human /prm. Suggested order across M3.6: M3.6d (#660, Mind PR first), then M3.6a (#659), then M3.6e (#661, which needs a one-line import resolution in _orchestrator.py after M3.6a: keep both imports).

    Heart RED override (development only), recorded

  2. Jammy2211 commented on Nov 17, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    Merged by the human's /prm (2026-11-17): PyAutoMind#583 (f7b4986f3), PyAutoBrain#665 (c2dce4e). CI green on the merged heads; the Heart RED development override covered shipping only, and the merge was this separate human command.

    One merge-slot count per shift (merge-slot take|release <pr-url> --task), shared by worker in-turn merges and watcher close-outs; the watcher closes out notify on R3 terms; digest labels merges from slot evidence; merge-mode prints the effective level and merge mode; R3 in AUTONOMY.md; lifecycle.py close matches rows by prompt path or issue.

    Close-out: completion record in PyAutoMind complete/2026/11/, active.md row released, dashboard regenerated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions