Repository navigation
feat: shift watcher 60 s tick, early close, decision-taken refused at PR-open (M3.7c) - #691
Merged
Merged
Conversation
…on-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. #690 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e limits, bounded label reads - early_close_ready: never closes on a tick whose steering read failed (commands_unread) or whose plan failed closed on Mind origin/main. - service: StartLimitIntervalSec=0; path unit: TriggerLimitIntervalSec=10s, TriggerLimitBurst=20; docs say a kick during a tick is dropped (edge- triggered) and the 60 s timer covers it. - S7 label read: at most 3 failed reads per PR per shift, then refused "labels unreadable after 3 reads → your /prm", counted in the digest. - The label read runs after the carried-PR check. - Tests for the guards: updated PR, lease in grace, pending re-dispatch, unreadable carried PR, unread steering, Mind fail-closed. #690 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er 15 minutes - A PR whose labels cannot be read goes to /prm only after LABEL_READS (3) misses AND LABEL_READ_GRACE_S (900 s) since the watcher first saw it, so a short gh outage refuses nothing; at most one read a tick, as before. - Digest, AUTONOMY.md network surface and batch AGENTS.md wording match. - Deploy paragraph: restart the path unit if it ever shows failed; systemd 249 ignores the TriggerLimit keys with a warning. - One FAIL_CLOSED constant for on_origin, early_close_ready and the digest. #690 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
M3.7c of the autonomous-orchestrators epic (closes #690). Ruling S7 (human, 2026-11-19) and the watcher latency work, with the human's plan decisions 1 to 3.
pyauto-orchestrator.pathunit starts the same service when the kick file%S/pyauto/orchestrator.kickchanges. Workers (after.done), close-outs and branch-update sessions (after.closeout) append one line to$PYAUTO_SHIFT_KICK, best effort.PathChangedis edge-triggered: a kick that lands while a tick runs is dropped and the timer covers it. The service setsStartLimitIntervalSec=0; the path unit'sTriggerLimit*keys apply from systemd 250 (249 ignores them with a warning, checked withsystemd-analyze verify).labelsin thegh pr viewit already makes, once per PR per shift. Adecision-takenPR is refused for/prmfrom the label alone: no close-out session, no merge slot, no CI read. It stays an "earlier" PR, so later PRs on its library wait until GitHub says MERGED or CLOSED (M3.6j ruling c unchanged). An unreadable label waits, at most one read a tick, and is refused for/prmonly after 3 misses over 15 minutes./prm-bound PR.API Changes
None to any library. Brain internals:
_orchestrator.kick_path(),early_close_ready(),close_early(),finish_shift(closed_at=),gh_pr_statereturnslabels;_digest.FAIL_CLOSED. See full details below.Risks
/prms a blocker mid-shift, then the waiting PR is updated and merged) runs only while other work keeps the shift open; otherwise the waiting PR goes to the next shift./addposted after an early close is not read, the same as afterreview-at:.shift_held_open, so they test their own behaviour with the shift kept open. The reviewer re-ran them without the fixture: about 33 fail, every one a scenario the design now closes on purpose; none showed a close while something was running.Deploy (human, when no shift is live; not done here)
After merge and pulling the canonical Brain checkout:
Test Plan
tests/test_watcher_latency.py(32 tests). 15 failed on main in round 0 (units, kick, S7 refusal, label wait, waits behind MERGED/CLOSED, digest line, early close, parked closes, NO-CHECKS grace then close); review-round tests failed before each fix.bin/check_skill_line_counts.sh 200 PyAutoBrain, tenant firewall,install.sh --check-project-discovery: OK.systemd-analyze --user verifyon the three units: clean except the two expectedTriggerLimit*warnings on systemd 249.Full API Changes (for automation & release notes)
Added
bin/systemd/pyauto-orchestrator.path— kick-file path unit._orchestrator.KICK_ENV,kick_path(),early_close_ready(),close_early(),LABEL_READS,LABEL_READ_GRACE_S,LABELS_UNREADABLE_WHY._digest.FAIL_CLOSED(shared with_orchestrator.FAIL_CLOSED).Changed Behaviour
StartLimitIntervalSec=0.worker_envsetsPYAUTO_SHIFT_KICK; worker, close-out and update templates write it.gh_pr_statereturnslabels._start_closeoutsrefusesdecision-takenat PR-open (after the carried-PR check)._tickcloses the shift early when nothing is live or startable;finish_shift(closed_at=)counts merges to that time.🤖 Generated with Claude Code