From 5907fbbd4c61f1192b79286de1641cdb766156e2 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Thu, 19 Nov 2026 14:13:24 +0000 Subject: [PATCH 1/3] M3.7c watcher latency: 60 s tick, kick path unit, early close, decision-taken refused at PR-open - bin/systemd: timer every 60 s; new pyauto-orchestrator.path starts the tick when %S/pyauto/orchestrator.kick changes. worker_env sets PYAUTO_SHIFT_KICK (kick_path); worker, close-out and update templates append to it after their verdict file, best effort. - S7: _start_closeouts reads a PR's labels (one more field of gh_pr_state, once per PR per shift, unreadable waits) right after the tier check; a decision-taken PR is refused with no session, slot or CI read and stays an earlier PR in the merge order (ruling c). - Early close: early_close_ready/close_early post the digest on the tick that leaves nothing live, startable or unjudged (never paused, shadow, or before anything started); later ticks in the window are idle or late sweep. - Digest: "Closed early at ..." line and "### Waited behind your /prm" lines. - Docs: AUTONOMY.md, batch AGENTS.md (with Deploy), batch/cockpit skills. - Tests: tests/test_watcher_latency.py; multi-tick tests held open by the shift_held_open fixture. PyAutoLabs/PyAutoBrain#690 Co-Authored-By: Claude Opus 5.5 --- AUTONOMY.md | 39 +- agents/conductors/batch/AGENTS.md | 34 ++ agents/conductors/batch/_digest.py | 54 +++ agents/conductors/batch/_events.py | 6 +- agents/conductors/batch/_orchestrator.py | 232 +++++++++++- agents/conductors/batch/closeout_template.md | 3 +- .../batch/closeout_update_template.md | 3 +- agents/conductors/batch/worker_template.md | 5 +- bin/systemd/pyauto-orchestrator.path | 17 + bin/systemd/pyauto-orchestrator.timer | 8 +- skills/batch/batch.md | 2 +- skills/batch/reference.md | 3 +- skills/cockpit/cockpit.md | 6 +- tests/conftest.py | 14 + tests/test_closeout_at_pr_open.py | 4 + tests/test_orchestrator_closeout.py | 25 +- tests/test_orchestrator_dispatch.py | 3 + tests/test_orchestrator_mentions.py | 8 + tests/test_orchestrator_steering.py | 16 +- tests/test_orchestrator_throughput.py | 6 + tests/test_watcher_latency.py | 334 ++++++++++++++++++ 21 files changed, 783 insertions(+), 39 deletions(-) create mode 100644 bin/systemd/pyauto-orchestrator.path create mode 100644 tests/test_watcher_latency.py diff --git a/AUTONOMY.md b/AUTONOMY.md index dd12007c..46c845a5 100644 --- a/AUTONOMY.md +++ b/AUTONOMY.md @@ -539,7 +539,34 @@ tests and the targeted smoke (leg 2), and opens the PR as soon as they pass Outside a shift (an `--auto` chat) nothing changes. -Later rulings from the same review (S4, S7) are added to this section. +- **S7, `decision-taken` at PR-open** (M3.7c, PyAutoBrain#690). The + watcher refuses a `decision-taken` PR when it first sees it, from the + label alone. No close-out session starts, no merge slot is taken and CI + is not read. It reads the label once per PR per shift; a label it cannot + read is asked again next tick, never taken as absent. The PR keeps its + place as an earlier PR in the merge order (M3.6j ruling c, unchanged), so + later unattended merges on that library wait for the human's `/prm`. The + digest names the PRs that waited behind a `/prm`-bound PR, one line per + library. The close-out's own label check stays as a second layer. + +Watcher latency (M3.7c, the human's plan decisions of 2026-11-19): + +- The watcher ticks every 60 seconds. A worker writes its `.done`, and a + close-out or branch update its `.closeout`, then appends a line to the + kick file (`$PYAUTO_SHIFT_KICK`, `~/.local/state/pyauto/orchestrator.kick`). + A systemd path unit starts a tick when it changes. The kick is best + effort; the timer is the backstop. +- **Early close.** A shift posts its digest on the tick that leaves nothing + to do: no worker live, no re-dispatch owed, no close-out or branch update + running, every PR judged, and no task that could still start. A PR waiting + behind a `/prm`-bound PR does not hold the shift open. The digest says + "closed early at