Repository navigation
feat(personal): first mate 1.5.0 with a kill-safe detector, loop rules and references - #12
Merged
Merged
Conversation
…and loud Two-phase save (--peek/--commit) bound to a state digest and a loop txn, flock-serialized local file work, optional own-login filter (default off), merge-state collapse with UNKNOWN retry, auto-prune, current head and stale review marker, absolute FIRST_MATE_DIR, last-run age in status, a cap-expiry line, and an 8 hour default cap.
Fake gh and paseo on PATH; wired into personal/scripts/verify and the ruff lint paths. test-wait-lock now expects the cap-expiry line.
…irst mate 1.5.0 Bump the skill to 1.5.0 with a changelog entry. SKILL.md gains a read-first loop rule, the heartbeat backstop as default, a Secrets section, reporting rules, permission-prompt handling, and troubleshooting rows. Longer procedures (delegation prompt, status doc, handoff and successor, host commands, stacking, cross-PR checklist) live in references/ and are listed in spec.yaml.
…eartbeat watch for stale runs Reviewer findings: the loop rule said the loop stops silently at its cap, was not scoped to the confirmed coordinator, the heartbeat was still described as an alternative, and the heartbeat prompt ignored the stale-run WARNING.
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
The input was the lessons from one two-day coordination session (about 28 PRs, up to 4 delegated agents, a wait loop, a heartbeat, a coordinator handoff). The two worst failures: the loop ended (on a change, then at its cap) and was not restarted, so reviews sat unseen for about three hours; and a loop killed between "report saved" and "report delivered" lost the change for good.
AI-assisted change: written with OpenCode (model claude-sonnet-5.5). Human review required.
What changed
Assets (
assets/first-mate-check.py,assets/first-mate-wait.sh; start from the locally patched copies, reviewed and corrected)--peekprints and stages a pending save bound to a digest of the saved state and to the loop'sFIRST_MATE_TXN;--commitapplies it only if both still match. The loop runs peek, prints, then commit. A kill in between yields a duplicate report, never a miss.--commit,add, and--show). A separate report lock makes concurrent one-step runs take turns. Writes are atomic with fsync;--resetclears pending too. Withoutfcntl(Windows) it runs unserialized.statusprintslast-run=<age> agoand aWARNINGwhen older than twice the interval (a loop younger than two intervals does not warn). Cap expiry (exit 3) prints one line. A detector that exits non-zero with no output is reported instead of looping quietly. Default cap 60 -> 480 minutes (8 hours): sessions ran 10 hours; the skill recommends 480 to 600.conflict,behind,ok.UNKNOWNis re-queried 3 times, then keeps the previous value (the patched version could report a flip took).PRUNED ....autoprune offand the manualpruneremain. Matching now parses the state field instead of searching for" CLOSED "anywhere in the line.stale-review=[...]when a reviewer's latest approval or change request was on an older head.FIRST_MATE_DIRtmp/no longer createstmp/tmp.SKILL.md (version 1.5.0 with changelog entry;
descriptionunchanged, scope did not change): a read-first Loop Rule scoped to the confirmed coordinator; hourly heartbeat backstop as part of the default procedure (with the prompt shape and path placeholders); Secrets section; Reporting section; permission-prompt handling (deny with a message; archive a stuck idle agent; standing-policy line); credential-limit note; successor pointer; troubleshooting rows. The output-contract sections (Summary, Critical Path, Actions, Verification) are intact.references/ (linked from SKILL.md and listed in
personal/spec.yaml):delegation-prompt.md,status-doc.md,handoff-and-successor.md,host-commands.md,stacking.md(points to github/gh-stack's own skill instead of repeating it),cross-pr-checklist.md.Kit:
personal/spec.yaml(6 new files),personal/README.md,personal/TROUBLESHOOTING.md,personal/scripts/verify(new section 4c),personal/scripts/test-wait-lock(cap-expiry now expects one line),Makefilelint paths.Verification
All run in this sandbox (Linux, Python 3.14.4 and 3.9.25, bash 5.3 and a bash 3.2.57 musl build).
python3 personal/scripts/test-first-mate-detector.py(34 tests)FIRST_MATE_TEST_BASHset to bash 3.2.57FIRST_MATE_ASSETS)tmp/tmp, auto-prune, stale marker, cap line, cap default, status age)bash personal/scripts/test-wait-lockbash personal/scripts/verify(also viapython scripts/run-kit-tests.py personal)acq kit validateskipped:acqnot installed)make lint validate PATTERNS=.patterns(pinned patterns checkout, hash-locked venv)python -m pytest scripts/tests -qshellcheck --severity=warningon the wait scriptpip_auditonrequirements-dev.lockscan_unsafe_shell.pyon the skill directory;gitleaks git .gitleaks diron claude-code, codex, antigravity, scriptsFixtures:
ghandpaseoare fake executables on PATH inside a temp directory. The fakeghanswerspr view(with a scriptedmergeStateStatussequence),api user,api .../pulls/N/comments, andapi .../commits/BRANCH, and fails on anything else, includingauthandtokencalls (the tests assert none are made and that a fakeGITHUB_TOKENvalue never appears in any output). Covered: repeat-peek identical; peek without commit consumes nothing; state moved between peek and commit drops the commit; txn mismatch; kill before commit loses nothing; concurrent one-step runs report once; own-login filter on and off; merge-state flicker; UNKNOWN retry and never-settles; auto-prune and its switch; stale-review marker; absolute directory; status age and warning; cap-expiry line; default cap.Not run or not verified
gh pr view --jsonfields the code uses; real output may differ at the edges (for example howreviews[].commitorsubmittedAtappear for old reviews).make testkit suites foropencode-go-providerandpi-coding-agent(npm install needed), the other kits' scripts,pip_auditof the claude-code lock, andacq kit validatewere not run. The first two do not touch this change.gitleaks dir personalreports 2generic-api-keyhits inpersonal/vendor/diagram-design.json, identical on the base commit (a provenance hash false positive that CI handles via.gitleaksignore/its own scope).gitleaks git .is clean.env -uis from one session on one Paseo and gh-stack version and is labelled as such. The label re-parenting viapaseo_update_agentis marked untested.Adversarial review (read-only, blocker-only subagent, two rounds): round 1 found four SKILL.md blockers (loop rule claimed a silent cap exit; not scoped to the confirmed coordinator; heartbeat still described as an alternative; heartbeat prompt ignored the stale-run
WARNING). All fixed; round 2: no blockers. It found no blockers in the detector for kill, crash or concurrency, secrets, or Python 3.9 and bash 3.2 compatibility (the 3.2 point was reviewed statically; I additionally ran the suite under bash 3.2.57).Not adopted, and why
ERRORlines: not shown to be a failure and would add state.git clone --config, forced re-materialization, signing, PATH narrowing).Merge Danger
Door: two-way. Revert the commits; sandboxes pick up the kit by pinned SHA, so existing sandboxes are unaffected until re-pinned.
Blast Radius: personal kit only, the First Mate skill and its scripts. Risk is concentrated in the detector changes (two-phase save, locking, prune): a bug could make the loop miss or repeat a change. The design prefers duplicates to misses, and a kill between report and commit is covered by tests, but real-GitHub behavior is unverified. State saved by 1.4.0 holds the old merge wording, so run
first-mate-check.py --resetonce after upgrading (or expect oneCHANGEDper PR); this is in Troubleshooting.first-mate-wait.sh statusnow prints extra lines after the first; callers must parse only the first word, as the skill already says.No new network allowances, startup commands, or credentials. The scripts call only
ghandpaseoand never read or print a token.Rollback
Revert the merge, re-pin the previous kit SHA, recreate the sandbox. For a local copy in a coordinator's
tmp/, copy the 1.4.0 scripts back and runfirst-mate-check.py --reset.AI-assistance disclosure: this change was written by an AI coding agent (OpenCode, claude-sonnet-5.5) and adversarially reviewed by a second agent; it needs human review before merge.