Skip to content

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

Merged
Jammy2211 merged 3 commits into
mainfrom
feature/shift-library-slot-frees-after-merge
Nov 18, 2026
Merged

Jammy2211 merged 3 commits into
mainfrom
feature/shift-library-slot-frees-after-merge

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

A shift's library slot now frees once the task holding it has merged. Before this, the planner admitted one task per library repo per plan, and the watcher kept every task the shift had picked in each later plan, so the first PyAutoGalaxy pick held PyAutoGalaxy until review-at: even after its glance close-out had merged it. A brief naming five PyAutoGalaxy bugs ran one.

The rule exists because concurrent library PRs collide at merge. A task whose PRs have all merged collides with nothing, so its library is released and the next named task on it starts on a later tick, from a worktree cut from the merged main. Two tasks never run on one library at once.

A pick is released when it is done or abandoned and either every PR it opened is in its merged outcome, or it ended with no PR and no open question. It still holds while live, parked, pending re-dispatch, or with any PR open or refused (a judge PR awaiting /prm, a glance PR past merge-cap:).

Closes #679

API Changes

None to the public API — internal changes only. _batch.plan() gains an optional keyword released; callers that omit it plan as before. The one-per-library rejection now names its holder.
See full details below.

Test Plan

  • pytest tests/test_batch_*.py tests/test_orchestrator_*.py — 665 passed, 1 skipped (re-run at 0221a70)
  • full pytest tests — 2380 passed, 1 skipped
  • New test_679_* tests drive real watcher ticks with two named glance tasks on PyAutoGalaxy: second waits while the first is live or its PR open; starts once the first's PRs are all merged; open/refused PR, parked question, one-of-two PRs merged all still hold; abandoned with no PR frees. The release and claim tests fail on unmodified main; the hold tests pass on main (regression guards).
  • After merge: fast-forward the watcher's Brain checkout and run batch brief --check on PyAutoMind batches/2026-11-18-pm.md (7 named glance bugs: 5 PyAutoGalaxy, 2 PyAutoFit) — later same-library tasks should read "will start after 's PR merges".
Full API Changes (for automation & release notes)

Added

  • agents.conductors.batch._batch.plan(..., released: set[str] | None = None) — task ids that stay members but claim no library.
  • agents.conductors.batch._orchestrator.released_picks(counters) — this shift's picks that no longer hold their libraries.

Changed Signature

  • _orchestrator.on_origin(..., released=None, slot_name="") — a released pick's leftover active.md claim holds nothing, only when its - session: is this slot's own shift worker.
  • _orchestrator._held_for(..., ignore=frozenset()).

Changed Behaviour

  • Rejection text: "<repo> already claimed this shift" → "<repo> held by <task> — will start after <task>'s PR merges" (named tasks) / "<repo> held by <task> until its PR merges" (others).
  • The watcher's per-tick plan releases a library once its pick has merged.

Notes for review

  • Leftover claim: the close-out normally queues drop-section active.md <slug> before the next plan, but a set-aside op, failed push, missing .closeout or an in-turn worker merge can leave the section. Only this slot's own released picks' claims are ignored; every other claim still holds.
  • Edge case: a worker that crashes twice after opening a PR but before writing .done is abandoned with no recorded PR and frees its library. That PR gets no close-out, so it waits for a human /prm; at worst it needs a rebase.

Heart (dev-ship gate GREEN for PyAutoBrain; shown, not blocking)

  • manifest drift: end-at-deliverable blocks (generated) — 46 mismatch(es) vs PyAutoMind/repos.yaml
  • manifest drift: generated hooks (session-start + end-at-deliverable) — 2 mismatch(es) vs PyAutoMind/repos.yaml
  • release validation incomplete: no rehearsal for current source

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…ed (#679)

The planner admits one task per library repo per plan, and the watcher
keeps a shift's own picks in every later plan, so the first pick on a
library held it until review-at even after its PR merged. Now a pick that
is done (or abandoned) with every PR merged, or with no PR and no open
question, is passed to _batch.plan as `released`: it stays a member (never
re-dispatched) but holds no library. A claim such a pick left in Mind
origin/main active.md, written by this shift's own worker, no longer holds
its repo either. The rejection names the holder: "<repo> held by <task>
until its PR merges".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jammy2211 and others added 2 commits November 18, 2026 14:31
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…irewall, #679)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 6c804c6 into main Nov 18, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/shift-library-slot-frees-after-merge branch November 18, 2026 14:43
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.

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

1 participant