Skip to content

feat(batch): a shift's library slot frees once its task's PR has merged #679

Closed

Description

@Jammy2211

Overview

The batch planner admits one task per library repo per plan, and the watcher keeps a task the shift already picked in every later tick's plan. So a shift's first PyAutoGalaxy task holds PyAutoGalaxy until review-at:, even after its glance close-out has merged it, and a brief naming five PyAutoGalaxy bugs runs only one. The rule exists because concurrent library PRs collide at merge; a task whose PR has already merged collides with nothing. This frees the library slot at merge, so named tasks on one library run one after another.

Plan

  • Hold a library only while the earlier task on it could still collide at merge: running, PR open, or parked on a question.
  • Release the library once that task is done and every PR it opened has merged, or it ended with no PR and no open question.
  • The released task stays in the plan, so it is never re-dispatched and the digest still counts it.
  • The next task on that library starts on a later tick, from a worktree cut from the merged main.
  • Never two tasks on one library at once; judge PRs and PRs past merge-cap: keep holding.
  • Tier + merge mode: effective level: supervised; merge mode: human /prm
Detailed implementation plan

Affected Repositories

  • PyAutoBrain (primary)

Branch Survey

Repository Current Branch Dirty?
./organs/PyAutoBrain main clean

Suggested branch: feature/shift-library-slot-frees-after-merge
Worktree: ~/Code/PyAutoLabs-wt/shift-library-slot-frees-after-merge/

Implementation Steps

  1. agents/conductors/batch/_orchestrator.py plan() (~line 1841): compute released — this shift's own picks in counters["done"] (or abandoned) whose outcomes[task] has every prs URL in merged, or no PRs and no questions — and pass _batch.plan(..., released=released).
  2. agents/conductors/batch/_batch.py plan() (~line 514): new keyword released: set[str] | None = None; a member whose task_id is in it stays in members but does not libs.update(...). Callers that do not pass it behave exactly as today.
  3. Rejection wording names the holder: "<repo> held by <task> until its PR merges", surfaced by brief --check.
  4. Docs: agents/conductors/batch/AGENTS.md ("The watcher", the caps/plan paragraph) and one line in skills/batch/batch.md.
  5. Tests (tests/test_batch_plan.py / tests/test_batch_named_tasks.py), per the prompt's Witness:: (1) second same-library task held while the first is live or its PR open; (2) admitted once the first's PRs have all merged; (3) open/refused PR or parked question still holds; (4) abandoned with no PR frees it.
  6. Run tests/test_batch_*.py and tests/test_orchestrator_*.py.

Key Files

  • agents/conductors/batch/_batch.py — plan(), the one-per-library clash
  • agents/conductors/batch/_orchestrator.py — plan() per tick, on_origin keeps own picks
  • agents/conductors/batch/AGENTS.md, skills/batch/batch.md — the rule in prose

Original Prompt

Click to expand starting prompt

M3.6i A shift's library slot frees once its task's PR has merged

Type: feature
Target: PyAutoBrain
Repos:

  • PyAutoBrain
    Difficulty: small
    Autonomy: supervised
    Priority: high
    Status: draft
    Filed: 2026-11-18
    Epic: autonomous-orchestrators
    Consequence: judge
    Witness: python -m pytest tests/test_batch_plan.py tests/test_batch_named_tasks.py -q passes with new tests that fail on today's main: (1) a brief naming two glance tasks on PyAutoGalaxy plans only the first while the first is live or its PR is open; (2) once the watcher's counters record the first as done with every PR in its merged list, the next tick's plan admits the second; (3) a first task done with an open (unmerged or refused) PR, or parked on a question, still holds the library; (4) a first task abandoned with no PR frees it
    Lane: any
    Unattended: ready

Request (verbatim)

Human, 2026-11-18, while launching shift 2026-11-18-pm (7 named glance bugs: 5 on PyAutoGalaxy,
2 on PyAutoFit): "but we can do the shift it does one task per library but over the shift it
will do all 7 in the end right one after another?" — then, told it does not: "do B".

Option B as offered: change the rule so a library's next named task starts once the previous
one on that library has merged.

Why

_batch.plan admits one task per LIBRARY_REPOS repo per plan (" already claimed this
shift"). The watcher re-plans every tick, and on_origin keeps a task the shift already picked
in every later plan ("A task this shift already picked stays"). So the first PyAutoGalaxy pick
holds PyAutoGalaxy until review-at:, even after its glance close-out has merged it. A brief
naming five PyAutoGalaxy bugs runs one of them; the rest sit idle for hours.

The rule exists because concurrent library PRs collide at merge: the first merge moves main
and stales the others' test and smoke evidence. A task whose PR has already merged collides
with nothing, so holding its library past the merge serves no purpose.

What to change

  • The watcher tells the planner which of this shift's own picks no longer hold their
    libraries: done, with at least one PR and every PR in its outcomes[task].merged; or done or
    abandoned with no PR and no open question.
  • _batch.plan keeps such a pick in the plan (so it is still known, counted and never
    re-dispatched) but does not add its repos to the claimed-library set.
  • Anything else still holds: live, parked on a question, done with an open or refused PR (a
    judge PR waiting for /prm, a glance PR past merge-cap:).
  • The next task on that library starts on a later tick, from a worktree cut from the merged
    main (start_library already branches from origin/main).
  • AGENTS.md "The watcher" and batch.md say the slot frees at merge; brief --check wording
    stays ("will not start yet — PyAutoGalaxy held by until its PR merges" is a nicer
    message than "already claimed this shift", if cheap).

Not in scope

  • Running two tasks on one library at once.
  • Raising merge-cap: or changing close-out guards.

Activity

  1. Jammy2211 commented on Nov 18, 2026

    @Jammy2211
    ContributorAuthor

    Library PR opened: #680 (commit 0221a70). Tests: batch + orchestrator 665 passed / 1 skipped; full suite 2380 passed / 1 skipped. Heart dev-ship gate GREEN for PyAutoBrain. Tier judge → stops at PR-open for human /prm. No workspace impact (organ repo). After merge: fast-forward the watcher's Brain checkout, then launch shift 2026-11-18-pm.

  2. Jammy2211 commented on Nov 18, 2026

    @Jammy2211
    ContributorAuthor

    Shipped: #680 merged 2026-11-18T14:43Z (merge 6c804c6). A shift's library slot now frees once the task holding it has all its PRs merged (or ended with no PR and no open question); the next named task on that library starts on a later tick. CI green on 75258ef after two follow-up commits (skill line budget; tenant-firewall-neutral test names).

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