Skip to content

fix+feat: shift numbers right and kept; blocked-worker @mention (M1.5 #610, M1.6 #611) - #612

Merged
Jammy2211 merged 3 commits into
mainfrom
feature/watcher-numbers-and-push
Nov 12, 2026
Merged

Jammy2211 merged 3 commits into
mainfrom
feature/watcher-numbers-and-push

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Programme M1.5 and M1.6, the last two tasks of M1. Closes #610. Closes #611.

M1.5: a shift's numbers are right and kept. Findings CODE-4, ORCH-7, ORCH-8, FLOW-6 and SIG-5 were re-checked on 68e263a.

  • Tokens:
    • Every live, parked and close-out session's usage is read every tick, and each reading replaces the last.
    • Usage is deduplicated by message id. Cache-read and subagent transcripts are reported separately.
    • An unreadable transcript gives None, which refuses spawning. After 3 unreadable reads in a row, the session's reservation counts instead.
    • A spawn reservation lets the budget bind on tick 1.
  • The digest:
    • Counters come from per-worker exit records and from GitHub's merged state, read after a final reap.
    • New ### Workers and ### Refusals sections.
  • One batches/pilot/pilot.jsonl line per shift, written through one-Mind-writer upserts:
    • pilot.md is rendered from it, and unmeasured tokens are written null.
    • A late arrival amends the line and posts one correction comment.
    • A failed post is retried, at most 3 attempts, never after a timeout.

M1.6: a blocked worker reaches the human. ORCH-13 was re-checked and holds.

  • A worker that parks, or parks on its issue with a question, gets one comment on the digest issue @-mentioning mention_login.
  • The trigger comes from durable state, the post is marked before posting, and failures are retried, including in the late sweep.
  • Posts use PYAUTO_SHIFT_GH_TOKEN, a bot account per the human's ruling. That token is never passed to workers or close-outs.
  • The digest warns when the poster is the mentioned account.

AUTONOMY.md: the watcher network-surface amendment, dated 2026-11-12, was signed off in full by the human on #611. It now includes the read-only gh api user once per shift.

Test plan

  • New tests: test_orchestrator_tokens.py, test_digest_counters.py, test_orchestrator_mentions.py, and test_the_watchers_posting_token_never_reaches_a_worker_or_closeout.

  • Brain pytest tests/: 1747 passed, 1 skipped. The known environmental failure test_grouped_organ_consumers remains.

  • Skill line counts OK. Tenant firewall OK.

  • The independent review took three rounds of FINDINGS, all fixed or ruled by the human:

    • a self-mention cannot notify;
    • the amendment went beyond the ruling;
    • a mention was lost on a crashed tick;
    • one unreadable transcript blocked all spawns;
    • subagent tokens were missed;
    • the bot token leaked to workers;
    • the gh api user call was unlisted;
    • the doc did not match the code.

    Final: clean.

  • Before the next live shift, the human must: create the bot token (PyAutoMind issues: write), set PYAUTO_SHIFT_GH_TOKEN, and set shift_watcher.mention_login.

Heart RED override (development only)

Authorization from the live human in the programme session, 2026-11-12: "Override + merge". This authorizes the development-only RED override for #610 and #611 and gives the merge command (Mind doc PR first, then Brain), conditional on every required check being green within the turn.

Heart verdict RED (pyauto-heart readiness, ts 2026-11-12T20:14:16Z). The current RED reasons, verbatim: "PyAutoNerves: 2 commit(s) behind origin"; "PyAutoArray: 2 commit(s) behind origin"; "PyAutoGalaxy: 14 commit(s) behind origin"; "PyAutoLens: on branch feature/non-imaging-features-review (not main)"; "PyAutoLens: 4 uncommitted source change(s)"; "PyAutoCTI: 2 commit(s) behind origin"; "install verification FAILED (testpypi; checks F)"; "release validation FAILED (stage integrate)"

None of these is in PyAutoBrain or PyAutoMind. Branch gates passed: tests, review clean after three rounds, smoke not applicable. This PR does not fix Heart, and Heart stays RED for release.

Tier: glance. Merge mode: auto-merge on green if the Witness passes, with a post-merge summary. A RED override additionally needs the human's merge command, which was given in the same turn.

🤖 Generated with Claude Code

Jammy2211 and others added 3 commits November 12, 2026 20:14
…an (M1.5 #610, M1.6 #611)

M1.5 (#610):
- tokens: every live, parked and close-out session's usage is read each
  tick and stored per session (replaced, never added); transcript_usage
  dedupes by message id, reports cache-read apart and returns None when
  unavailable, which refuses the next spawn ("token usage unavailable");
- a per-worker reservation (default token-budget / max-sessions) makes the
  budget bind on the first tick;
- digest counters from per-worker exit records (spawned/finished/crashed/
  parked/late, one launch-failed record per task) and from GitHub's merged
  state read once at review-at; a ### Workers section, one line per worker;
- finish_shift reaps first; issue URLs kept out of `prs`;
- one batches/pilot/pilot.jsonl line per shift, pilot.md its render, both
  upserted by slot through the one Mind writer (new jsonl-upsert and
  table-upsert ops); the late sweep amends the line and posts one
  correction comment; a post gh said failed is retried (3 tries, never
  after a timeout).

M1.6 (#611):
- a worker parked (blocked past the grace) or parked on its issue posts one
  comment on the shift's digest issue @-mentioning the login from
  PYAUTO_SHIFT_MENTION or config/policy.yaml shift_watcher.mention_login;
  one per worker per state, marker before post, retried on failure; counted
  in `pushes`. AUTONOMY.md network surface amended (2026-11-12 ruling).

Tests run offline: conftest stubs the watcher's GitHub seams unless a test
passes its own run=.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s, subagents, posting identity

- mentions derive from durable state (parked tasks, issue-only .done) with
  no posted marker, so a tick that dies after parking still mentions on the
  next; failed mentions are also retried by the late sweep (same 3 tries);
- after 3 unreadable reads in a row a session is `unmeasured`: it stops
  refusing every spawn, its reservation counts, and the pilot row writes
  tokens null / `unmeasured`; the digest lists every spawn refusal with its
  reason (### Refusals);
- transcript_usage includes <sid>/subagents/agent-*.jsonl, deduped by
  message id, reported as `subagents`;
- PYAUTO_SHIFT_GH_TOKEN, when set, is GH_TOKEN for the watcher's own gh
  calls only; `gh api user` once per shift, and the digest warns when the
  mentioned login is the posting account. AUTONOMY.md records the human's
  2026-11-12 posting-identity ruling (#611); batch AGENTS.md documents the
  token and its scope (fine-grained, PyAutoMind issues:write only).

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

- worker_env drops PYAUTO_SHIFT_GH_TOKEN, and any GH_TOKEN/GITHUB_TOKEN that
  carries the same value, from every worker and close-out session; the
  human's own gh auth is kept;
- AUTONOMY.md network surface lists the one read-only `gh api user` per
  shift, under the posting token, that warns when it equals the mention
  login (#611).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit f80cba7 into main Nov 12, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/watcher-numbers-and-push branch November 12, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant