Repository navigation
Description
Overview
Milestone task M3.6a of the autonomous-orchestrators epic (PyAutoBrain#574 programme). Shift 2026-11-16-pm lost launch time to four things the launch could have checked: no shift issue, an expired CLI login read as "blocked on a person", the watcher reading a stale brief from its env file, and a watcher that never stops. This adds those checks. Build first, in chat: a shift never changes its own watcher.
Plan
batch brief --new --outcreates the shift issue on PyAutoMind and writesissue:;brief --checkrefuses a live brief without it.- A login probe with no model call (
claude auth status --json:loggedIn,loginExpiresAt), inbrief --check(also refusing a login that expires beforereview-at) and the watcher's first tick; an expired login is its ownlogin-expiredevent and holds spawning. - The watcher finds the one open brief on Mind
origin/mainitself (dispatched <= now < review-at); two open briefs means idle with that reason;PYAUTO_SHIFT_BRIEF/--briefbecome an override honoured only inside its window. - After
review-at+ 45 min (digest posted) the watcher stops ticking and renewing leases. - Two dated AUTONOMY amendments (approved by the human 2026-11-17): the login probe on the watcher's surface, and
brief --new's onegh issue createas an exception to "The Brain reads no network". - Tier: judge — merge mode: human /prm
Detailed implementation plan
Affected Repositories
- PyAutoBrain (primary)
- PyAutoMind
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| PyAutoBrain (canonical) | main, 6 behind origin | untracked .worktrees/ only |
| PyAutoMind (canonical) | main, 72 behind origin | another session's uncommitted batches/2026-11-16-pm.md (left alone) |
Suggested branch: feature/shift-launch-preflight (worktree ~/Code/PyAutoLabs-wt/shift-launch-preflight/). Runs in parallel with M3.6d and M3.6e (file-disjoint apart from adjacent hunks; human approved the repo-claim coordination).
Implementation Steps
- New
agents/conductors/batch/_login.py:probe(run=None)→ ok | expired | unknown | skipped (PYAUTO_LOGIN_PROBE=off), fromclaude auth status --json(loggedIn,loginExpiresAt), also matching "Login reached its time limit";EXPIRED_LINE = "CLI login expired: run \claude /login`"`. _brief.py:LATE_WINDOW_S = 45*60,launch_errors(top, brief)(non-shadow brief without an issue URL).check()unchanged (the watcher calls it)._batch.py:--issue URL;create_shift_issue()(onegh issue create, URL parsed);new_brief(..., issue=)writes- issue:; the--new --outbranch creates the issue unless--issue/PYAUTO_BRIEF_ISSUE=off, reuses an existingissue:, writes nothing if gh fails;--checkappendslaunch_errorsand the probe (refuse on expired or on expiry beforereview-at;res["login"]in JSON)._events.py: kindlogin-expired, deriver after_impaired._orchestrator.py(only): imports; new_late_closedafterbrief_open; guard at the top of_tick's not-open branch;_tick_bodylogin hold before spawning (_login_hold, re-probe when a worker shows blocked); newshift_briefs/find_briefs/watchbeforemain(git ls-tree/showonorigin/main, no fetch; "checkout behind" idle when the pushed brief is missing from the tree);mainmakes--briefoptional. Not touched:_reap, close-out code,finish_shift,late_sweep.bin/systemd/pyauto-orchestrator.servicedrops--brief ${PYAUTO_SHIFT_BRIEF};_watch.LATE_WINDOW_Sfrom_brief;tests/conftest.pyautousePYAUTO_LOGIN_PROBE=off,PYAUTO_BRIEF_ISSUE=off.- Docs: AUTONOMY.md "Shift brief = launch" + the two dated amendments;
agents/conductors/batch/AGENTS.md;skills/batch/batch.mdlaunch step andreference.md. - Existing tests updated:
test_batch_brief_goals.py,test_premise_check.pyBRIEF,test_orchestrator_events.py_every_kind_results. - PyAutoMind PR:
batches/AGENTS.md"Shift brief" (issue required, only a pushed brief opens, no two open, watcher ends at review-at + 45 min);policy/shift_watcher.md(discovery, probe, end).
Witness mapping
tests/test_batch_brief.py::test_new_creates_one_shift_issue_and_writes_it::test_check_refuses_a_live_brief_without_issue::test_check_refuses_on_expired_login+tests/test_orchestrator_preflight.py::test_first_tick_logs_login_expired_not_blocked::test_watch_ticks_the_one_open_brief_on_origin+::test_two_open_briefs_idle::test_after_late_window_no_tick_and_lease_mtime_unchanged
Key Files
agents/conductors/batch/_orchestrator.py,_batch.py,_brief.py,_events.py, new_login.pybin/systemd/pyauto-orchestrator.service,tests/conftest.py, AUTONOMY.md
Original Prompt
Click to expand starting prompt
M3.6a Shift launch preflight: shift issue, login probe, the watcher finds the open brief
Type: feature
Target: PyAutoBrain
Repos:
- PyAutoBrain
- PyAutoMind
Difficulty: medium
Autonomy: supervised
Priority: high
Status: draft
Filed: 2026-11-17
Epic: autonomous-orchestrators
Phase: 10
Consequence: judge
Witness:python -m pytest tests/test_batch_brief.py tests/test_orchestrator_*.py -qpasses with new tests that fail on today's main: (1)batch brief --newwith a fakeghcreates one PyAutoMind issue and writes its URL asissue:; (2)brief --checkon a live brief withoutissue:exits non-zero and names the key; (3) a fakeclaudeprinting "Login reached its time limit" makesbrief --checkfail and makes the first tick log alogin-expiredevent, not "blocked on a person"; (4) with two brief fixtures on a fake Mind origin/main the watcher ticks the one whosedispatched:has passed andreview-at:has not, and with two open briefs it idles and logs "two open briefs"; (5) a tick afterreview-at:+ 45 min exits without ticking work and leaves every lease file's mtime unchanged
Lane: local-dev
Unattended: never
Why
Shift 2026-11-16-pm lost time at launch to four things the launch could have checked.
- No shift issue. The kick-off chat grepped
_brief.pyforissue:, found nothing and
dropped it.brief --checkpassed. So there was no live status comment, no steering by
comment, no/cap, and the digest and the late-arrival correction were never posted
(digest.posted: "the brief names no issue:"). - Expired CLI login. Both first workers stopped at 17:54:48Z and restarted at 17:56:36Z
after the human's/loginand a message from the kick-off chat. The watcher called it
"blocked on a person". - Watcher on the old brief. The 17:49Z tick read "idle: review-at 2026-11-14T19:35Z has
passed", becausePYAUTO_SHIFT_BRIEFin the env file still named the 14 Nov brief. The
human edited the env file and the chat fast-forwarded the shared Mind checkout. 5 minutes
lost. - The watcher never stops. On 2026-11-17 it was still ticking every 3 minutes and still
renewing the lease on the question the human had answered.
What
batch brief --newcreates the shift issue on PyAutoMind and writesissue:into the
brief.brief --checkrefuses a live brief (notshadow: yes) withoutissue:.- A login probe:
brief --checkand the first tick run a cheapclaudecall and refuse or
pause with their own event wording ("CLI login expired: runclaude /login"), distinct
from "blocked on a person". - The watcher finds the brief itself. It reads
batches/*.mdon Mindorigin/mainand takes
the one brief whosedispatched:has passed and whosereview-at:has not. Two open
briefs means it idles and says so. Only a pushed brief counts, so "pushing the brief is the
launch" keeps its meaning.PYAUTO_SHIFT_BRIEFbecomes an override, not the source. - Once the late window closes (
review-at:+ 45 min) the watcher stops ticking the slot and
renewing its leases.
Out of scope
- The watcher reading the shared Mind checkout at all: that is M4.3 and the infrastructure
review. - Worker SSH keys and the worker environment (infrastructure review).
- Raising caps by comment (
/capalready exists; it needs the issue this task creates).
Activity
Jammy2211 commentedon Nov 17, 2026
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.pyafter M3.6a: keep both imports).Heart RED override (development only), recorded
PyAutoMind: Tenant Firewall Gate failure on main(pre-existing generated-hook drift, PyAutoMind#575, run 43881901227). This branch does not touch it and does not claim to fix Heart.test_grouped_organ_consumers(also fails on origin/main); independent review CLEAN./prmwith every required check green. No release.docs: move the shift-brief launch detail into skills/batch/reference.md
Jammy2211 commentedon Nov 17, 2026
Shipped
Merged by the human's
/prm(2026-11-17): PyAutoMind#582, PyAutoBrain#664 (after merging main into the branch to keep both_loginand_merge_slotsimports; full Brain suite and CI green on the merged head). #582's cancelled Spawn Drift check (concurrency queue) was re-run on the human's word and passed. The Heart RED development override covered shipping only; the merge was this separate human command.Launch preflight:
brief --newcreates the shift issue and--checkrefuses a live brief without one;claude auth statuslogin probe (no model call) with alogin-expiredevent; the watcher finds the one open brief on Mind origin/main and stops after the late window once nothing is owed.Close-out: completion record in PyAutoMind
complete/2026/11/,active.mdrow released, dashboard regenerated.