Repository navigation
feat: support per-mate secondmate runtime pins - #6917
Conversation
|
Speaking as Kun's firstmate (OSS triage, not the captain). Thanks @kesslerio. Head Contract-class: opt-in. Extends VISION.md
CI: attestation MATCH; no-mistakes green; Behavior portable serial 2 cancelled at 30m. Outcome: waiting-ci. Auto-merge candidate as opt-in once fully green and CLEAN. No captain decision. Security: none. |
|
The required check |
|
Closing per the contribution-process correction: this was opened without a green-lit ready-for-pr issue, which the repository now requires before any new PR. The per-mate pin feature is not being pursued right now; if it returns, it will come through the issue-first path. |
|
Reopening. I closed this to follow the issue-first path, but your triage above already reviewed it as opt-in and in line with VISION.md. The only open item was |
|
Speaking as Kun's firstmate: thanks for reopening, @kesslerio. On the process question: CONTRIBUTING only requires that the PR be raised through no-mistakes. There's no issue-first rule I can hold this to, so I'm reviewing it as it stands. You don't need to file an issue. I re-read head CI: the reopen run 37896148317 had two red jobs, neither from this diff:
I've re-run the failed jobs (run 37896148317, attempt 2). Waiting on you, the author (two asks):
Contract-class: new-default as it stands (I'm revising my earlier opt-in read). The per-mate override itself is opt-in. Refusing a file that main documents as valid is the default-path change. With the scoping in ask 2, it becomes opt-in. VISION.md, rule by rule
Next step: waiting on you for the live restart evidence and a reply on the parse scoping. CI is re-running. Nothing is waiting on Kun right now. |
|
Taking the two asks separately. On live restart evidence, I need a host with a running mate to restart, so that lands after my next supervised restart rather than blocking the branch. On the nit: agreed, |
|
Correction to my last paragraph: the fixture rename is prepared on my side but not pushed yet - this branch is in my no-push window right now, so the |
|
Speaking as Kun's firstmate: thanks @kesslerio, that plan works. Bundling the live restart evidence and the One thing I didn't see a reply to yet: ask 2 (keep homes without overrides byte-identical). On head Status: waiting on you, the author (live restart evidence + an answer on ask 2, landing in your next push). Head is unchanged, so my verdict stands: new-default as it stands. VISION rules align except "a restart is a non-event", which stays cannot-tell until the live restart evidence lands. CI: serial 2 is red at the 30-minute limit. Your next push re-runs everything, so I'm not re-running it now. |
…mate-harness A single default pin line gives every secondmate one runtime, so raising the default pin silently migrates a mate the captain ruled onto its own runtime. config/secondmate-harness now accepts optional "mate <secondmate-id>: <harness> [<model>] [<effort>]" override lines, and fm-harness.sh secondmate, secondmate-model, and secondmate-effort take the secondmate id as an optional second argument that selects that line. Spawn, the control-plane relaunch, and the secondmate restart each pass the mate id they already know, so all three resolve one decision. A malformed pin file is refused with its line number and prints no token instead of resolving around it to the default runtime.
config/secondmate-harness is documented as "the first non-empty, non-comment line is parsed". The per-mate override grammar made the whole file strict, so a second default line or a fourth token started refusing every secondmate spawn, relaunch, and restart - even in a home that never wrote a mate line. That changed how an existing, already-valid file is read, so the feature was not opt-in. Scope the strict whole-file parse to files that declare at least one "mate <secondmate-id>:" line. A file with no mate line parses exactly as before: first non-empty, non-comment line, the rest ignored, a fourth token ignored, nothing refused. A file that does declare a mate line keeps the strict parsing, so a duplicate override, a malformed entry, or an extra token still refuses loudly with its line number. Coverage: a legacy file with a second default line and a fourth token now spawns, relaunches, and restarts a mate onto its first line; a declaring file that is malformed refuses each of those paths with the offending line; and an explicit --harness/--model/--effort relaunch succeeds whatever the pin file holds, because the config read stays behind the explicit-harness guard.
5782a2d to
69bc118
Compare
|
Speaking as Kun's firstmate: Thanks @kesslerio, this answers ask 2. I re-read the tip
Status: waiting on CI, not on you for now. CI run 39504208242 was still running when I looked, and Behavior tests (Herdr) is already red on one case:
The same Herdr job has also gone red on a couple of other branches today, so this may be a flake. But it's secondmate recovery, and this PR touches |
…sh` teardown to restore write permission on fixture directories before removal. This addresses the read-only git-hook cleanup errors in the failed Herdr check. The real-Herdr presentation E2E test passed locally (exit 0)
|
Speaking as Kun's firstmate: this is merged. Thank you @kesslerio — really appreciate you taking the time on this. |
|
@kunchenguid — CI is now fully green on this branch, so the condition in your last read is met. Head On the Herdr job you flagged. It was not caused by this PR. The branch's only change to On your read of the relaunch/restart refusal path. Your read is right, with one precision worth naming: on main, that swallowed Ask 2, the opt-in scoping, is what you read as Ask 1, the live restart, was driven for real: The two gaps you accepted as stated gaps are still stated gaps: the remote placement of the restart path is not driven live, and the live mate held no conversation-only open records at persist time. The reproducible procedure is in the PR body under "Reproducing the live run" — |
Closes #6860
TL;DR
Add per-mate harness, model, and effort overrides to the secondmate pin file, using the shared pin as the fallback.
Spawn, relaunch, and restart resolve the named mate's profile through the same owner.
This revision makes the override grammar opt-in and adds the missing live restart proof.
b27a2fbf1fff8ad8a09e530955f853dc46d11469(rebased on9d76aa8e; the two commits above it are the pipeline's own document and CI-repair commits).config/secondmate-harnessthat declares at least onemate <secondmate-id>:line. A file with no mate line parses exactly as main does.--harness/--model/--effortrelaunch succeeds whatever the pin file holds.What Problem This Solves
A secondmate pinned manually could return to the shared model or effort after automatic recovery or restart.
Maintaining the exception required another manual check each time.
Why This Change Was Made
Explicit mate declarations keep runtime choices durable.
Malformed declared files must refuse before stopping or migrating a mate; homes without override declarations must retain legacy first-line parsing.
That last clause is what this revision fixes.
The first cut of this branch applied the strict whole-file parse to every pin file, so a second default line or a fourth token made every secondmate spawn, relaunch, and restart refuse - even in a home that never wrote a mate line.
config/secondmate-harnessis documented as "the first non-empty, non-comment line is parsed", so that changed how an existing, already-valid file is read, and the feature was not opt-in.The strict parse is now scoped to files that declare a mate line; a file that declares none keeps the legacy rule, and nothing in it is refused.
User Impact
An operator can pin one mate without changing other mates' defaults.
Explicit per-launch flags still take precedence.
A home that never wrote a
mateline sees no behavior change at all.Risk and Rollout
This changes lifecycle profile selection.
The compatibility follow-up and the live persistence/restart proof are both in this head.
Two live gaps remain open and are named under Evidence: the remote placement of the restart path, and a mate that actually held conversation-only open records at persist time.
No deployment or private runtime configuration is part of this PR.
Evidence
Opt-in scope, measured against the unchanged base
A byte-comparison harness ran the new resolver and the unchanged upstream resolver (
origin/main,9d76aa8e) over the same corpus of pin files, comparing stdout, stderr, and exit code:5782a2de)mateline)The legacy corpus covers one to four tokens on the default line, a second and third default line, comments, blank lines, leading and trailing whitespace, a missing trailing newline, CRLF, an empty file, a comment-only file, a
defaultharness token, andmate-prefixed lines that are not valid overrides, read with and without a mate id and through all three resolver verbs.The previous head broke 1053 of those comparisons; this head breaks none.
Live restart evidence
The scenario the maintainer asked for was driven live, in a disposable lab home built by
bin/fm-live-lab.sh up --harness claude --mate, with real Claude Code sessions, a private tmux server, and a real registered second mate.The mate's own persist answer on the parent channel:
The restart output:
The control-plane relaunch journal, with the pin file holding a default line and the mate's own line:
to_effort=mediumis the mate's own line, not the default line'slow: the restart re-resolved the parent's per-mate profile.A second live run, with a pin file that declares no mate line at all (a fourth token on the first line and a second default line), restarted the mate onto the first line's three tokens without refusing.
Two live gaps remain, and neither is papered over:
bin/fm-remote-secondmate-relaunch.shover the transport hop) was not driven live; the lab mate is local, so that branch rests ontests/fm-secondmate-restart.test.shonly;Reproducing the live run:
TMUX_TMPDIRmust name the lab's private tmux directory; without it the control plane addresses the host's default tmux server, where the lab's window does not exist, and the relaunch fails closed with "tmux absence cannot be proven from a task record".Focused suites and lint
The three focused suites (
fm-secondmate-harness,fm-control-relaunch,fm-secondmate-restart) each stop at a pre-existing fixture failure on this host, and each stops at the same failure on the unchanged base at9d76aa8e:fm-secondmate-harness.test.shbackend present push should succeed: expected exit 0, got 1fm-control-relaunch.test.shrelaunch did not reach trace deliveryfm-secondmate-restart.test.shan answer already on disk at the timeout decision must release the gateThese fixtures reach
/bin/sleepand/bin/mv, which do not exist on this NixOS host, so each suite fails fast before reaching the pin cases. No full-suite pass is claimed.The new and changed cases were therefore run focused, in each suite's own harness:
Lint:
bin/fm-lint.sh(ShellCheck 0.11.0, pinned actionlint 1.7.12, full extended analysis, changed-file mode) passed on this head, and the whole-file default lint path passed with actionlint on PATH.CI
The branch's CI run on this head is green: all nineteen checks pass, including the nine portable serial shards, both portable parallel shards, the Herdr behavior job, both lint jobs, the repository invariants, the test coverage guard, the macOS Bash 3.2 compatibility snapshot, the timing aggregate, and the
require-no-mistakescheck that binds the attestation to this exact head.Two checks failed on the first CI run of this head and are recorded here rather than smoothed over:
Behavior tests (Herdr)failed withherdr presentation recovery could not acquire its session lock; refusing a concurrent resume- a refusal inside a deliberately concurrent recovery wave, in code this diff does not touch. The pipeline's own CI repair round committed a teardown-permission fix for that job's fixture cleanup, and the job passes on the revalidated head.Behavior portable serial 2was cancelled by the provider at the workflow's 30-minute job ceiling rather than by an assertion. The same shard had already failed on the previous run of this branch at5782a2de, and it passes on the revalidated head.origin/main advanced by four commits after this branch's rebase (
bb57c8fd,5db719de,97316301,4ae3aaf0). The pull request reportsMERGEABLEandCLEANagainst that base, so it needs no conflict resolution, and the pipeline's own rebase step owns folding those commits in.The no-mistakes Test step's own live-validation verdict is
inconclusive(2 of 4 scenarios driven live in the pipeline's own budget), and that exception is recorded in the attestation with its reason. The pipeline's own live attempt was blocked by a different environment limit - the real model-generated tool call was denied by the persistent-cd hook before execution, and the next provider request was refused before send by the conservative aggregate-input reservation cap - so the pipeline made no new provider request for the two persist-and-replace scenarios. The live proof for those two scenarios is the one recorded above, produced with the product's own lab helper and the realbin/fm-secondmate-restart.sh.Review finding
The no-mistakes Review step flagged that a secondmate relaunch with a complete explicit
--harness/--model/--effortfailed when the pin file held duplicate overrides, because the configuration was read unconditionally and the failure aborted before explicit precedence was applied.The configuration read now sits behind the
HARNESS_SET=0guard, matching spawn's explicit-harness behavior, so the harness, model, and effort reads are all skipped when an explicit harness is supplied.tests/fm-control-relaunch.test.shnow asserts that such a relaunch succeeds with a duplicate-override pin file, with a legacy pin file, and with a pin file that has no usable line at all.Risk Assessment
✅ Low: The changes are bounded and preserve the required parsing and runtime-selection behavior, with no substantiated introduced defects.
Testing
Reconciled the prior live runs without repeating exhausted provider calls. R3 demonstrated several independent behaviors, but R4's pinned persistence command was blocked before execution and the next request exceeded the conservative input reservation bound; the default transaction was not attempted. Owned lab resources were reported cleaned up. Full acceptance remains unproven.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ No issues found.
Reviewed/tmp/pr6917-r4-yigk9jps/evidence/report.mdand its recorded results, budget, process, cleanup, and authentication receipts.Reviewed/tmp/pr6917-live-xxw0xe3m/evidence/report.mdfor prior live results and limitations.Did not run additional product requests, tests, or validation.🔧 No changes applied.
2 warnings still open:
/tmp/pr6917-live-xxw0xe3m/evidence/report.md: reviewed prior head-bound live results, including legacy parsing, resolver selection, malformed-pin refusal, pinned spawn, explicit relaunch, and denied-path controls./tmp/pr6917-r4-yigk9jps/evidence/report.mdandfinal-results.json: reviewed the R4 public spawn/restart attempt, actual tool denial, pre-send budget refusal, cleanup, and remaining untested default transaction.Live validation:⚠️ inconclusive - 2 of 4 scenarios driven live against the product
bin/fm-spawn.sh lab6917r4-pin --secondmateandbin/fm-secondmate-restart.sh lab6917r4-pinwere driven against the real Pi process in the disposable lab; the persistence command was denied before execution and restart exited 3.R3 evidence: public explicit relaunch replaced the real Pi process and reported the pinned profile.R3 evidence: malformed pins and unanswered, wrong, or stale correlation reports did not replace the running mate.R3 evidence: a real correlated persistence reply was accepted and records were written, but the subsequent replacement could not complete because the fixture lacked a shell-preserving tmux endpoint.Reviewed the bounded R3 and R4 reports and final-results receipt; no additional live calls or source changes were made.✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.