diff --git a/AUTONOMY.md b/AUTONOMY.md index 80f94b12..fb8ba960 100644 --- a/AUTONOMY.md +++ b/AUTONOMY.md @@ -771,6 +771,39 @@ the exemption it runs under is `PyAutoMind/policy/shift_watcher.md`). second issue comment in one shift — retires the watcher to fake mode until the cause is found and this section is re-approved. +**Amendment — 2026-11-12 (PyAutoBrain#610, #611).** The human ruled the +channel for a blocked worker on 2026-11-12: a GitHub @mention in a comment on +the shift's digest issue (GitHub mobile pushes it; no new credentials). The +watcher's comments on the brief's `issue:` are now, and only: + +- **the digest**, once per shift; +- **one mention per worker per state that needs the human** — a worker + `blocked` on a person past the stall grace (parked), or one that parked on + its issue with a question — @-mentioning the login set by + `PYAUTO_SHIFT_MENTION` or `config/policy.yaml` `shift_watcher: + mention_login:` (never written in code). Each counts as a push under "The + push-notification test" and in the digest's `pushes` counter; a crash, a + refusal, an obsolete premise or a finished worker waits for the digest; +- **one correction comment per shift**, when a worker arrives after + `review-at:` and the record and pilot row are amended. + +Each comment's marker is created exclusively **before** its post, so a crash +leaves no comment rather than two. A post `gh` says failed is retried on a +later tick, at most three tries in all; one that timed out may have landed and +is never retried. The watcher also reads `gh pr view --json +state,mergedAt,mergedBy` for the PRs its own workers named — the close-out's +merge truth (#603) and, once at `review-at:`, the digest's `merges` (#610). +It also makes one read-only `gh api user` per shift, under the posting token, +to warn when it equals the mention login (#611). +The revert condition now reads: one network call outside these, or a comment +beyond these (a second digest, a second mention for the same worker and +state, a second correction), retires the watcher to fake mode. **Posting identity, ruled +by the human 2026-11-12 (PyAutoLabs/PyAutoBrain#611):** the watcher's GitHub +writes use a separate bot or machine account's token, set by the human as +`PYAUTO_SHIFT_GH_TOKEN` (fine-grained, PyAutoMind issues:write only); until it +is set they post as the human's account and the digest warns that the +mention will not notify. + ## Human override for Heart RED (development only) Heart RED still parks every autonomous run and blocks every release. After the diff --git a/agents/conductors/batch/AGENTS.md b/agents/conductors/batch/AGENTS.md index 36624b11..615665cf 100644 --- a/agents/conductors/batch/AGENTS.md +++ b/agents/conductors/batch/AGENTS.md @@ -217,9 +217,23 @@ honoured by `--bg`). Each tick reads `claude agents --json --all` once: `working` → heartbeat; `blocked` (waiting on a person) → `stalled_since`, and after `STALL_GRACE_S` (15 min) the task is **parked** — never killed, never re-dispatched, named in the digest; `done` with the marker → released, without -it → crashed (re-dispatched once). A finished worker's tokens (input + output + -cache creation) are summed from its local transcript, named by the full -`sessionId`, and the brief's `token-budget:` refuses the next spawn once spent. +it → crashed (re-dispatched once). **Tokens (PyAutoBrain#610)** are read every +tick for every live, parked and close-out session from its local transcript +(named by the full `sessionId`): input, output and cache creation, once per +message id, with cache reads reported apart; each read **replaces** that +session's entry in `counters.json` `usage`, never adds. No transcript is +`None`, never 0: it keeps the last read and refuses the next spawn (`token usage +unavailable`) — until `UNREADABLE_READS` (3) reads in a row fail, when the +session is `unmeasured`: it stops blocking, its reservation counts as its +usage, and the pilot row's `tokens` is `null` (`unmeasured` in `pilot.md`), +never 0. Subagent transcripts (`/subagents/agent-*.jsonl`) are included +and reported as `subagents`. The digest's `### Refusals` lists every spawn +refusal with its reason. A real worker holds a reservation from its spawn (default +`token-budget / max-sessions`) until its usage passes it, so the budget binds on +the first tick; `token-budget:` refuses a spawn once spent, or once committed +usage plus a new reservation would pass it. Every worker has one exit record +(`workers`: `spawned/finished`, `spawned/crashed`, `spawned/parked/late/finished`; +a failed launch is one `launch-failed` record per task) with its blocked minutes. `worker-mode:` defaults to `auto` (human, 2026-11-03); `dontAsk` and `acceptEdits` are allowed, `bypassPermissions` never. @@ -254,8 +268,14 @@ its `why:`, one proof packet per started task or a stub that says none was written, every counter) to `/digest.md`, appends it to the record through the one Mind writer, writes `digest.html` only under `packet: yes`, then **exclusive-creates `digest.posted` before** the one `gh issue comment` on the -brief's `issue:`. A crash between the two leaves no comment, never two; a failed -post is not retried; nothing is read back from GitHub. Health per PR is one +brief's `issue:`. A crash between the two leaves no comment, never two; a post +`gh` said failed is retried by a later tick, three tries in all (#610), and a +timed-out one never. It reaps first, so a `.done` written after the last live +tick is in the digest, and reads each worker PR's `gh pr view` once: `merges` +counts the PRs GitHub shows merged by `review-at:`, whoever merged them, and +`workers-crashed` counts exit records, not a tally. A `### Workers` section +prints one line per worker (`