Skip to content

feat: shift launch preflight — issue, login probe, brief discovery (M3.6a) - #664

Merged
Jammy2211 merged 6 commits into
mainfrom
feature/shift-launch-preflight
Nov 17, 2026
Merged

Jammy2211 merged 6 commits into
mainfrom
feature/shift-launch-preflight

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

M3.6a of the autonomous-orchestrators epic (PyAutoBrain#659). Shift 2026-11-16-pm lost launch time to four things the launch could have checked. This adds them:

  • batch brief --new --out creates the shift issue on PyAutoMind and writes issue:; brief --check refuses a live brief without one, and refuses an expired login or one that expires before review-at.
  • A login probe with no model call (claude auth status --json): an expired login is its own login-expired event and holds spawning, never "blocked on a person".
  • The watcher finds the one open brief on Mind origin/main itself (no fetch): two open briefs → idle with that reason; a pushed brief missing from the checkout → idle "checkout behind"; --brief/PYAUTO_SHIFT_BRIEF become an override honoured only inside its own window.
  • After review-at + 45 min the watcher stops ticking and renewing leases, once nothing is owed (digest posted, no post retry due, no queued Mind op); it catches up a missed digest for up to 24 h and then names the abandoned slot once.
  • AUTONOMY.md: launch preflight in "Shift brief = launch"; two dated 2026-11-17 amendments (login probe on the watcher's network surface; brief --new's one gh issue create as the fourth exception to "The Brain reads no network").

API Changes

CLI only: batch brief --new gains --issue <url> and creates the shift issue with --out; orchestrator_watch.py --brief is now optional (discovery on origin/main); the systemd unit no longer passes --brief. New module agents/conductors/batch/_login.py; new event kind login-expired.
See full details below.

Test Plan

  • Witness, new tests fail on origin/main and pass here: tests/test_batch_brief.py (new issue, refuse without issue, expired login) and tests/test_orchestrator_preflight.py (login-expired not blocked, one open brief ticked, two open idle, late window no tick + lease mtimes unchanged), plus review-round tests (stale override, past-window catch-up, due retry, queued op, write-failure hint, abandoned slot named once)
  • Full suite: 2217 passed, 1 skipped; 1 failure test_grouped_organ_consumers::test_hygiene_map_and_heart_board_find_grouped_checkouts is environmental (fails on origin/main under activate.sh's PYAUTO_MIND)
  • Independent review (Fable 5.2, author Opus 5.5): FINDINGS → fixed → CLEAN
  • Trial merge with M3.6d and M3.6e: only conflict is one import line in _orchestrator.py (keep both)
Full API Changes (for automation & release notes)

Added

  • _login.probe(run=None) → {state: ok|expired|unknown|skipped, detail, expires_at}; PYAUTO_LOGIN_PROBE=off
  • _brief.LATE_WINDOW_S, _brief.launch_errors(top, brief)
  • _batch.create_shift_issue(...); batch brief --issue URL; PYAUTO_BRIEF_ISSUE=off
  • _orchestrator.find_briefs, watch, late_owed, _login_hold, _late_closed
  • event kind login-expired

Changed Behaviour

  • orchestrator_watch.py: --brief optional, an in-window override only
  • brief --check: refuses a live brief without issue: and an expired/expiring login

Mind half: PyAutoMind PR on the same branch (batches/AGENTS.md, policy/shift_watcher.md).
Refs PyAutoBrain#659. Merge order suggested: M3.6d, then this, then M3.6e.

Heart RED override (development only)

🤖 Generated with Claude Code

Jammy2211 and others added 4 commits November 17, 2026 13:40
…finds the open brief

M3.6a (#659). Shift 2026-11-16-pm lost launch time to
a missing shift issue, an expired CLI login read as "blocked on a person",
a stale brief in the watcher's env file, and a watcher that never stopped.

- `batch brief --new --out` makes one `gh issue create` on the Mind's origin
  repo and writes `- issue:` (reuses an existing one; `--issue <url>` or
  PYAUTO_BRIEF_ISSUE=off skips; writes nothing if gh fails).
- `batch brief --check` adds `_brief.launch_errors` (a live brief needs its
  issue) and the login probe (`_login.probe`: `claude auth status --json`,
  no model call): refuses an expired login or one lapsing before review-at.
  `_brief.check` is unchanged for the watcher.
- The watcher holds every spawn on an expired login (`_login_hold`, probed on
  the first spawning tick, after an expiry, and when a worker shows blocked)
  and records its own `login-expired` needs-you event.
- `orchestrator_watch.py` finds the brief itself on Mind origin/main
  (`shift_briefs`/`find_briefs`/`watch`; local git ls-tree/show, no fetch):
  the one open brief plus late ones; two open briefs idle; a pushed brief the
  checkout lacks idles; `--brief`/PYAUTO_SHIFT_BRIEF is an override honoured
  only inside its window. The systemd unit no longer passes --brief.
- After review-at + 45 min with the digest posted, a tick returns idle before
  the lock: no reap, no lease renewal, no log line (`_late_closed`).
- AUTONOMY.md: launch preflight under "Shift brief = launch", and the two
  human-approved 2026-11-17 amendments (login probe; brief --new's one
  gh issue create). Docs in batch AGENTS.md and skills/batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n, after the watcher's

Refs PyAutoBrain#659

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pen brief, late catch-up, issue before write

Review of M3.6a (#659):

- find_briefs: an override takes the open brief's place only while it is
  open itself; in its late window it is one more late brief ticked beside
  the open one, so a stale PYAUTO_SHIFT_BRIEF never displaces the next shift.
- A brief past review-at + 45 min is still ticked (up to CATCH_UP_S, 24 h)
  while its slot owes something (`late_owed`: digest unclaimed, a digest or
  correction post retry due, a queued Mind op); the late-window stop in
  `_tick` now waits for the same, so a laptop that was off catches up.
- brief --new makes the shift issue after the heart-green lane, just before
  the write; a write that fails after it prints the URL to re-run with
  `--issue <url>`.
- skills/batch: discovery reads the Mind checkout's origin/main ref without
  fetching; fetch or push from it before launch.

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

Re-review of M3.6a (#659): a slot still owing its
digest (or a post retry, or a queued Mind op) past CATCH_UP_S was dropped
with only "no open brief". `find_briefs` now adds, once per slot (claimed by
an `abandoned.noted` marker), "abandoned: <slot> past catch-up (<what it
owes>; N leases) — run `batch digest --record …` and close it by hand".
The cap value is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jammy2211 and others added 2 commits November 17, 2026 14:44
The batch skill's primary files were 210 lines against the 200-line budget
(CI `Skill line-count budget`). The launch-preflight paragraph moves to
reference.md "Launching a shift brief"; batch.md keeps a one-line pointer.
Now 199 lines (SKILL.md 17 + batch.md 182).

Refs #659.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in and _merge_slots imports)

Refs PyAutoBrain#659

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