Repository navigation
fix: bound remote secondmate convergence and preserve owed re-reads - #7394
kunchenguid merged 10 commits into
Conversation
|
Speaking as Kun's firstmate: thanks @arthurcruzd — I read head What it does: parallel inherit-push ( Contract-class: restore (own read). Startup already had a network bound and a re-read nudge path; this makes remote convergence fit that bound and stops false nudges without adding a new default-on captain surface. VISION.md, rule by rule: One captain (aligns — less noisy re-reads). Authority explicit (aligns — timeouts are mechanics). Scripts own the mechanics (aligns). Restart a non-event (aligns — owed marker survives a cut-off). Delegation with a spine (blocked on live — see below). Outlives any vendor (neutral). Scope (aligns). Live validation: the PR body marks live inconclusive — 0 of 7 (portable suites only; no live SSH lab). Warm ask: when you have a moment, could you live-test the named remote convergence / owed-reread scenarios against a real remote second-mate home and post evidence (or re-raise through no-mistakes with live=go)? We don't run our own live/lab for this. CI: Behavior portable serial 5 FAILED on |
959bb0a to
a697f9b
Compare
…rk bound The deferred startup network stage (120s) timed out once four second mates were remote: the mates already converge concurrently, but each mate's inheritance push sent its fifteen allowlisted items one SSH round trip after another, so a single mate's convergence took 64-76s after a ~16s liveness pass. - fm-remote-inherit-push.sh validates and snapshots every item locally first, so a local refusal now sends nothing, then sends the items up to FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in allowlist order. A failed item still fails the push with its own error, and no further item is started after it. The receiver is unchanged: each item is its own file and generation record, and the host's job worker still runs one home's commands one at a time. - fm-bootstrap.sh gives each remote mate's convergence its own budget, FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry marker, instead of holding the whole stage past its bound.
…hanged Each remote convergence attempt records its retry marker before it starts, so a sweep cut off by the startup network bound or failing before any change left a marker that made the next session start nudge every remote mate even though its instructions and inherited files were unchanged. The marker now records whether a re-read is owed, set only once an attempt actually changed the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/, or .agents/skills/ no longer counts as a change.
…ut short A convergence step stopped by the per-mate budget loses its output, so a push that had already applied an item reported nothing and left the retry marker with no re-read owed; the next start then saw every item unchanged and never told the mate to re-read. A step cut off by the budget now marks the re-read owed, and so does a failed push whose output shows items it had already pushed or removed. The lifecycle e2e suite runs every remote leg through the real entrypoint and job worker on the test machine, so it now gives convergence ample time; the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose budget and failure cases are also made independent of machine load.
…fixture Behavior portable serial 5 failed on the watcher auto-relaunch leg of tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push started overlapping its sends. Across 14 recent main CI runs that suite's remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range, while legs that push nothing were only 5-10% slower. The watcher relaunch is a remote spawn, and the only changed code on that path is the inheritance push. This fixture's transport has no network latency and its job worker runs one home's commands one at a time, so overlapping sends cannot hide any round trip there and only add submission overhead to every remote spawn. The suite now sends one item at a time, as it did before; the overlapped scheduler stays covered by tests/fm-bootstrap-network-parallel.test.sh, and the production default of four is unchanged. The watcher leg's failure now also prints the watcher's output.
…date documentation
…an change its home A live run against a real remote second-mate home showed the owed re-read still lost when the startup network bound stopped the stage. That bound stops it the way `timeout -k 1` does: TERM to the stage's process group, then KILL one second later. Bash defers a TERM trap while the convergence worker waits in a command substitution, and the remote call runs in its own timed process group, so the KILL landed before the trap could record the re-read. The remote home had already applied the change, the next start saw every item unchanged, sent nothing, and deleted the marker, so the mate was never told to re-read. Bootstrap convergence and config-push now write the record owed before any remote step can change the home, and write it back only after the attempt has reported: removed after confirmed unchanged convergence or a successful send, and back to owed=0 when a failed attempt's outcome proves nothing changed. A kill at any point therefore leaves the re-read owed. The TERM/INT traps are gone. The kill regression now sends TERM and then KILL one second later, as the startup bound does; it fails on the previous head and passes here.
…ate reread documentation
a697f9b to
f0ea3c0
Compare
|
Live evidence for the seven remote convergence / owed re-read scenarios, run 2026-10-17 against a real remote second-mate home on a macOS host (Darwin arm64) over real SSH. Setup
1. Startup overlaps remote work with correctly attributed diagnostics - PASS
2. Inheritance concurrency bound, output order, and failure guards - PASS
3. A hung remote times out without blocking healthy mates and keeps its retry obligation - PASS 4. An unchanged home stays silent while an owed re-read retries - PASS 5. A partially applied inheritance push keeps the owed re-read - PASS 6. Unknown transport completion or termination during mutation keeps the owed re-read - FAILED first, PASS after the write-ahead fix in
7. Local config-push re-reads after partial propagation and skips unchanged homes - PASS
Not driven live Raw logs (wrapper call log with timestamps, receiver output, bootstrap output, timing records, marker snapshots) are kept privately and can be shared on request. |
|
Speaking as Kun's firstmate: this is merged. Thank you @arthurcruzd — really appreciate you taking the time on this. (Contract-class, own read: restore — remote convergence now fits the existing startup network bound and re-read nudges follow the documented changed-transfer contract. Thanks for the thorough live SSH evidence.) |
## Commits taken - d20196a feat(herdr): opt-in project groups with status tags and a sorted agents view (kunchenguid#7434) - ce69740 fix(bin): pin LC_ALL=C for remote job process identity reads (kunchenguid#7410) - 64dddf6 fix(opencode): ignore child stdin EPIPE in guard and encoder (kunchenguid#7447) - 11becbb fix(bin): ignore crew state overrides for other tasks (kunchenguid#5881) - eeeeb91 fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (kunchenguid#7415) - 66c300b feat: support version URLs for watched tool updates (kunchenguid#7449) - 3094475 fix(pi): keep a live session's extension markers when a nested Pi command loads them (kunchenguid#7287) - f05b628 fix: reclaim orphaned Claude auto-arm claims (kunchenguid#5939) - c4f4333 feat(bin): add Polytoken crewmate/scout worker adapter (kunchenguid#7321) - 11990a2 Fix away branch relaunch admission (kunchenguid#7444) - 56074d0 fix(bin): show reported checks when a pull request's base requires none (kunchenguid#7450) - 0791268 fix: support durable per-secondmate account pins (kunchenguid#7452) - 4e6b9f5 feat(bin): consult operator evidence guards before wedge escalation (kunchenguid#6958) - c7b7798 fix(bin): make inbox listing succeed when the inbox is empty (kunchenguid#7460) - 63fc5eb fix: bound remote secondmate convergence and preserve owed re-reads (kunchenguid#7394) - 8ba34f1 fix: require positive daemon running status in crew-state (kunchenguid#7317) - 1aa2a21 fix(tests): stabilize supervision host drain and offer fixtures (kunchenguid#7467) - 69f9d09 fix(bin): refuse spawn into a project with an unborn HEAD (kunchenguid#6987) - 45dd50a feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (kunchenguid#7462) ## Conflict decisions - `.agents/skills/operational-home-layout/SKILL.md`: Fork seat configuration; upstream per-secondmate account configuration. Decision: Keep both configuration entries. - `bin/backends/herdr.sh`: Fork send-failure/recovery semantics and harness variable; upstream Polytoken busy override. Decision: Keep fork send-failed and recovery handling; add Polytoken busy identity without losing the fork harness variable. - `bin/fm-backlog-transition-lib.sh`: Fork cached library directory; upstream GitLab completion support. Decision: Keep cached source path and extend forge ownership comment to GitLab; accept GitLab completion path. - `bin/fm-config-inherit-lib.sh`: Fork Claude/Codex seat inheritance; upstream Herdr project groups. Decision: Union the allowlist; per-secondmate account pins remain local to the primary home. - `bin/fm-control.sh`: Fork pre-stop seat checks; upstream per-mate pins and Polytoken launch checks. Decision: Select the per-mate pin while retaining its returned account for seat conflict validation; keep all Polytoken pre-stop checks. A valid explicit pin supersedes the old recorded Claude store on relaunch. - `bin/fm-harness.sh`: Fork in-process HARNESS_VERDICT result; upstream echo-based Polytoken detection. Decision: Add Polytoken through the fork verdict convention, retaining existing adapter detection. - `bin/fm-lock.sh`: Fork handover reservation and runtime publication; upstream session re-anchor lease/auto-arm locks. Decision: Share the existing claim lock and release helper, add lease/auto-arm locking, then publish runtime and clear an admitted handover before releasing locks. - `bin/fm-pr-state.sh`: Fork shared required-check evaluator from dbe11b1 and 91371c8; upstream 56074d0 adds a second gh pr checks fallback. Decision: Keep one evaluator through fm-pr-checks.sh and fm-pr-checks-lib.sh. It already checks non-advisory reported checks on unprotected bases, includes missing configured requirements, and fails closed on read errors. Adapt upstream regressions to this API; preserve the fork REQUIRED CHECK label and advisory policy. - `bin/fm-spawn.sh`: Fork parked-session resume, seats, unclaimed-worktree guard and ticket hook; upstream Polytoken, per-mate accounts and Herdr groups. Decision: Compose both paths, retain validate_spawn_worktree_unclaimed, seat gates, profile trust and metadata, and both hooks. Extend pin/seat refusal to the selected per-mate pin while retaining the primary-home seat guard. The selected durable Claude pin owns trust and recorded store on relaunch so old seats cannot override it. - `bin/fm-teardown.sh`: Fork merged-at/park record cleanup and isolation protections; upstream generated Polytoken wiring cleanup. Decision: Keep fork cleanup and guards; add only task-owned Polytoken files and generated untracked wiring to existing guarded teardown. - `bin/fm-test-run.sh`: Fork timing entries and pipeline-spend suite; upstream Herdr-group and Polytoken suites. Decision: Union suite entries, preserve fork timing measurements for existing suites. - `bin/fm-wake-lib.sh`: Fork single-read auto-arm ledger parser; upstream session-owner identity fields. Decision: Extend the single-read parser with owner_session_id and the third-line lock identity; retain orphan recovery and lease logic. - `bin/fm-watch.sh`: Fork bounded run-activity deferral and escalation wording; upstream operator evidence guard. Decision: Keep both bounded deferrals and append operator guard evidence to both ordinary and deep-inspection escalations. Keep exact owned watcher termination semantics. - `docs/agent-control.md`: Fork seat relaunch policy; upstream per-mate account selection. Decision: Describe both policies with account pin checked before stopping the live agent. - `docs/configuration.md`: Fork seat sections and ticket timeout; upstream per-mate pins and remote convergence settings. Decision: Keep all sections, place per-mate pins under worker accounts before the seat sections, and retain all timeout entries. - `tests/fm-control-relaunch.test.sh`: Fork fixture cleanup and seat regressions; upstream account and away-admission regressions. Decision: Keep fixture-scoped cleanup and all regression calls; extend the changed-pin case to check trust in the new store and recorded profile. - `tests/fm-crew-state.test.sh`: Fork no-fork metadata parsing test; upstream override-identity tests. Decision: Keep both test bodies and calls, plus upstream positive daemon-status cases. - `tests/fm-pr-merge.test.sh`: Fork named-case local selector; upstream GitLab waiver test definitions. Decision: Place upstream definitions before the named-case selector and retain every case. - `tests/fm-supervision-host.test.sh`: Fork split helper/suite layout; upstream snapshot-aware offer fixture. Decision: Update the shared supervision-host-helpers.sh implementation and retain its split consumers rather than duplicate the helper in one suite. - `tests/fm-teardown.test.sh`: Fork collision/released-claim cases; upstream Polytoken cleanup cases. Decision: Keep all regression calls. - `tests/fm-watch-triage.test.sh`: Fork split classifier/stale/delivery suites; upstream unsplit suite with four new operator-guard cases. Decision: Keep the split and move only new guard fixtures/cases into fm-watch-triage-stale.test.sh; do not resurrect duplicated legacy test bodies. ## Additional integration and verification decisions - Preserve fork teardown, merge, push, worktree ownership/isolation, and exact-owned watcher termination guards. GitLab no-pipeline waiver remains explicit, attended-only, GitLab-only, and only accepts an explicit null pipeline; default and existing-pipeline safety checks remain in force. - Existing pull-request CI selects subsets and cannot prove the requested full suite. Add a manual CI workflow trigger using the existing full-suite fallback, so the feature head can run every required lane before landing; document that entry point. No local full suite or real Herdr lifecycle run is authorized.
Intent
Send our good Firstmate fixes upstream to kunchenguid/firstmate as pull requests (asked as: "pode enviar o que temos de bom"). This task is one of them: the three remote second-mate convergence fixes our fleet has run since 2026-10-11, as one upstream PR.
The fixes, from the captain's fork branch
fleet(arthurcruzd/firstmate):01cad32efit remote second-mate convergence inside the startup network bound (parallel inherit push via FM_REMOTE_INHERIT_PUSH_JOBS, per-mate FM_SECONDMATE_CONVERGENCE_TIMEOUT of 75s);a43e0433nudge a remote second mate to re-read only when something changed;2cc02218keep a remote mate's re-read owed when its convergence is cut short (depends on the first two). Without them, startup with several remote second mates overran the network-check bound and nudged every mate to re-read on every start.What Changed
Risk Assessment
✅ Low: The changes are bounded to remote convergence scheduling and re-read obligations, preserve existing access controls, and contain no substantiated material defects.
Testing
Ran the three requested suites serially, then isolated nine existing regressions that all passed. Captured bootstrap diagnostics and test transcripts. The network suite encountered timing failures, two suites exceeded their bounds, and Cursor coverage was skipped because its executable was unavailable. Previously declined validation limitations were not raised again. Live validation remains unproven under the recorded regression-only scope.
Evidence: Bootstrap timeout diagnostics from simulated-transport regression
Source: Bootstrap timeout diagnostics from simulated-transport regression
Evidence: Requested regression suite transcript
Source: Requested regression suite transcript
Evidence: Focused scheduler and interruption regressions
Source: Focused scheduler and interruption regressions
Evidence: Focused failure recovery and timeout regressions
Source: Focused failure recovery and timeout regressions
Notes for reviewers
01cad32e,a43e0433,2cc02218on the submitting fork) have run live on the submitting fleet since 2026-10-11, with four remote second mates on two other machines. The live scenarios in the Testing table need real remote hosts, so here they are exercised with fixtures bytests/fm-bootstrap-network-parallel.test.sh,tests/fm-secondmate-sync.test.sh, andtests/fm-secondmate-harness.test.sh.owed=marker could still drop a re-read on a config-push that failed after applying an item, on an unknown-completion transport failure (fm-on.shexit 255), and on a TERM/INT during the remote call. The follow-up commits keep the re-read owed in all three cases, with regressions intests/fm-bootstrap-network-parallel.test.sh.4c55f368now records the re-read as owed before any remote step can change the home and clears it only after a confirmed no-change outcome or a successful send; the TERM/INT traps are gone, and the kill regression now sends TERM then KILL after one second.tests/fm-remote-secondmate-lifecycle-e2e.test.shand Behavior portable serial 5: the first CI run failed its watcher auto-relaunch leg. Across 14 recentmainruns that suite's remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already near its 30s wait; on this PR remote spawn took 42.1s while legs that push nothing were only 5-10% slower. The relaunch is a remote spawn whose only changed step is the now-overlapped inheritance push, and this fixture has no transport latency while its job worker runs one home's commands one at a time, so overlap only adds submission overhead there. The suite now sends one item at a time (FM_REMOTE_INHERIT_PUSH_JOBS=1in itsremote_env); the production default of four and every wait bound are unchanged, and the overlapped scheduler stays covered bytests/fm-bootstrap-network-parallel.test.sh. The same suite was also flaky on our loaded 2-vCPU host, where it failed the same way on unmodifiedmain, so CI is the verdict for it.fm-send.sh --fire-and-forget, so no pending-reply expectation is created).a43e0433changes whether a remote second mate is nudged (only when the re-read is owed). The two are complementary, but both edit the remote nudge send insecondmate_sync_remote_oneinbin/fm-bootstrap.sh, so whichever lands second needs a small rebase there.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
bin/fm-test-run.sh --jobs 1 --per-script-timeout-secs 540 tests/fm-bootstrap-network-parallel.test.sh tests/fm-secondmate-sync.test.sh tests/fm-secondmate-harness.test.sh --json ~/.no-mistakes/evidence/01M55YA8AVJQK1MJFEFZYEHRHS/targeted-results.json: network assertion failed after convergence timeouts; sync and harness suites timed out.bin/fm-test-run.sh --jobs 1 --per-script-timeout-secs 240 tests/fm-convergence-focused-gate.test.sh: five existing scheduler, failure-guard, unknown-status, and interruption regressions passed.bin/fm-test-run.sh --jobs 1 --per-script-timeout-secs 180 tests/fm-convergence-focused-gate.test.sh: four existing partial-failure, unknown-completion, and hung-mate regressions passed.Removed the temporary focused test selector;git status --shortwas empty and no selected test processes remained.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.