Repository navigation
Sync upstream firstmate (10 commits since fork PR 5) - #6
Merged
Merged
Conversation
…kunchenguid#7619) * fix(pi): rearm the watcher independently of a held wake delivery docs/watcher-continuity.md promises that each adapter starts the next watcher arm before delivering the wake prompt. On a Pi primary with a busy supervision branch that was not what happened: watcher closes were handled one at a time behind a single 'restoring' flag, so a freshly restarted watcher that closed again waited in pendingActionables until the earlier branch delivery settled. For that whole time no watcher was armed. One day's arm ledger showed successor arms starting 297 to 1244 seconds after the previous arm closed, and the 'turn would end blind' guard firing 26 times in that day with the last beat 43 to 1214 seconds old. Arming and delivery are now separate concerns. Each close restores continuity in a generation-owned pump that does not wait on the serialized wake delivery, and the wake queue is still delivered one at a time. A successor's failure during restoration keeps its bounded retry once the continuity operation finishes, so a failure that lands during a held delivery is still retried instead of being skipped. The regression test holds a branch delivery open, closes the new watcher, and asserts that the successor arm starts before the delivery resolves. * docs(watcher): record the Pi successor-start and delivery split * fix(pi): confirm the handling handoff inside the continuity operation * test(pi): make the repeated-close fixture generation-aware * fix(pi): settle a deferred close with the operation that held the guard * no-mistakes(document): docs(watcher): record Pi held-delivery restore and handoff coverage * no-mistakes(document): docs(watcher): fix Pi deferred-retry wording
* fix(watch): surface overdue pauses as decisions * no-mistakes(review): Classify overdue pauses as blocked stale decisions * no-mistakes(review): Enforce strict pause ceilings; durable blocked decisions remain unresolved * fix(watch): make overdue pauses actionable * no-mistakes(document): Document overdue pause behavior and configuration * no-mistakes(ci): Invariant: every overdue pause—dated or undated, including a worker classified as working—must open an actionable keyed decision, and leaving that pause must resolve it. The affected paths are the stale `paused` and `working` classifications, plus status transitions that resume or replace a pause. Added the overdue check to the working classification and attempted automatic resolution on resume, with undated coverage. Verification is incomplete: `bash tests/fm-watch-triage-pause.test.sh` fails because the resumed worker still leaves the decision open. This phase is not complete; the fix needs further work * no-mistakes(ci): Updated the undated pause test to use portable `set_mtime`, refresh `.seen-until_status`, and allow the expected ordinary recheck exit while asserting no overdue decision opens before the ceiling. The focused test script timed out after 120 seconds, before reaching the changed test. The `working` route still reaches `wedge_timer_check` without the overdue check; that selected finding remains unresolved, so this CI phase is incomplete * no-mistakes(ci): Updated the working-classification route to check both overdue ceilings before the wedge path, and added automatic resolution when a pause is replaced by a fresh, non-overdue pause. `bash -n` passed. Focused dated-resume and undated-overdue tests still fail (decision remains open / is not created); the full test script timed out before reaching them. This CI phase is incomplete * fix: resolve overdue pause decisions on status changes * fix: close overdue pauses only on resume * no-mistakes(document): Document overdue pause behavior * no-mistakes(ci): Fixed the overdue marker to bind its offset to the status file’s device/inode and clear on replacement or shrink. An open marker now suppresses the ordinary terminal-stale path despite pane changes. `bash -n` and `git diff --check` passed; the focused test script timed out after four of 31 cases, so the new behavior is not fully verified. Behavior tests for pane churn and task-ID reuse remain to be added * fix(watch): preserve overdue pause markers * no-mistakes(document): Document overdue pause behavior and configuration * fix(watch): retire overdue markers on teardown * no-mistakes(ci): Implemented a shared dated/undated overdue-pause predicate and routed both watcher and daemon pause rechecks through it. The daemon now appends the keyed blocked decision, records the status-file identity/offset marker, and queues one stale escalation. `bash -n` and `git diff --check` pass. The requested daemon behavior test was not added or run; this change is not fully verified * no-mistakes(ci): Fixed the daemon overdue-pause append path to accept both successful return codes and persist the blocked line’s exact end offset before queuing the wake. `bash -n` and `git diff --check` pass. The focused pause suite timed out after five cases; the requested daemon-path behavior test was not added or run, so verification is incomplete * fix(watch): test overdue pauses in away mode * no-mistakes(review): Keep malformed dated pauses on bounded rechecks * no-mistakes(review): Reconcile daemon overdue decisions on worker resume * no-mistakes(document): Document overdue worker pause behavior * no-mistakes(document): Document overdue pause decisions * fix(supervision): dedupe overdue pause alerts * no-mistakes(review): Gate overdue pause decisions on away posture * no-mistakes(review): Preserve unread status events during overdue escalation * no-mistakes(review): Use shared overdue predicate for watcher classification * no-mistakes(ci): Fixed daemon-backed quiet mode to apply the overdue pause ceiling while keeping captain-held waits away-only. Added a quiet-mode regression test; the existing away-mode deduplication and unread-event regression passed. The real away-mode daemon lab passed, and `git diff --check` passed. The full daemon test script passed, including all three overdue-pause cases. Linux validation could not be run in this macOS worktree; per instruction, stopping without claiming both OS lanes passed. Final SHA: 79996166d5ce89be222935da046e1bbf2a1a2bf8 * no-mistakes(review): Resolve overdue decisions on any worker status event * no-mistakes(review): Exercise overdue marker offsets through real status append * no-mistakes(document): Document overdue pause handling * no-mistakes(ci): Invariant: an overdue pause is reported only after its stale escalation is queued. The daemon’s overdue housekeeping is the sole affected path; the watcher does not own this daemon escalation. Moved the marker write after successful queueing. Added the requested retry regression, but `bash tests/fm-daemon.test.sh` fails because the test’s recovery attempt does not create the marker. macOS/Linux Lint and behavior lanes were not run; stopping without claiming validation. HEAD remains `2dd9718e2186de6e0292a593f3fcb84e96c5f201`; changes are uncommitted * no-mistakes(ci): BLOCKED. The retry test now has a real newline and its saved-function rename matches Bash’s `declare -f` output, but `bash tests/fm-daemon.test.sh` still fails: the retry does not create `.paused-overdue-overdue-retry`. I did not proceed to other requested validation. This environment is macOS (`Darwin`); Linux validation cannot be run here, so I cannot satisfy the required two-OS validation. No commit or push was made. The daemon implementation already writes the overdue marker only after `escalate_add` succeeds; the test needs further diagnosis before this phase can pass * no-mistakes(ci): Implemented retryable overdue alerts: failed enqueues retain pending state, housekeeping retries without duplicating the blocked decision, and reconciliation/teardown clean up pending state. `bash tests/fm-daemon.test.sh`, shell syntax checks, and `git diff --check` passed. The stated synchronized commit 49023a95 was not present in this worktree; these changes are uncommitted * fix(daemon): keep pending overdue alerts out of the overdue-marker globs The pending overdue alert record was named .paused-overdue-pending-<task>, which the watcher's and daemon's .paused-overdue-* loops also matched. The watcher read the task as pending-<task>, found no status file, and deleted the record, so a failed alert was lost on the next watcher poll. Rename it to .overdue-pending-<task> and cover a watcher poll between the failed enqueue and the retry. * no-mistakes(review): Discard resumed overdue alerts before retry * fix(daemon): fold overdue alert retries into the overdue marker Drop the separate pending record. The overdue marker's second line now holds the daemon's delivery state, so keyed resolution, resume and retry all run through one reconcile path. The marker is published atomically before the blocker is appended, and only a daemon-owned marker hides the blocker from wake classification, so a watcher-written marker keeps ordinary blocked escalation. * fix(daemon): drop the overdue alert retry A failed enqueue now leaves the overdue decision open and the next housekeeping scan raises it, so the alert has no separate delivery path to race or lose. The marker's second line only records a queued alert. The blocker is appended before the marker, and an already-open decision is not opened again. Measure the undated pause bound from the pause line's own [at=] stamp, falling back to the file's age for unstamped lines. * no-mistakes(review): Preserve overdue decisions across unrelated status events * no-mistakes(review): Treat zero pause ceiling as invalid configuration * no-mistakes(document): Document overdue pause behavior * no-mistakes(lint): Fix ShellCheck subshell export warnings * no-mistakes(lint): Fix ShellCheck subshell environment warnings * no-mistakes(ci): Updated both overdue reconcilers to ignore unrecognized prose and honor FM_CLASSIFY_PAUSED_VERB; added prose/custom-verb regressions. Watcher tests and shell syntax checks passed. Daemon test suite still fails at the existing “failed queue lost the overdue marker” scenario before reaching the new regression * no-mistakes(ci): Fixed both overdue reconcilers to use the shared status-event predicate, preserving prose as non-events while recognizing supported legacy completion lines. Added done:/merged coverage. Shell syntax and diff checks pass; watcher test passes. Daemon suite remains blocked by its known earlier failure, “failed queue lost the overdue marker,” before reaching the new regression * feat(supervision): make the pause ceiling opt-in via config/pause-ceiling Overdue pauses open a keyed decision only in a home with the config/pause-ceiling presence flag; without it paused waits keep main's recheck behavior. The classifier, watcher and away daemon each check the flag. Adds flag-absent and flag-present tests, fixes a daemon test that never applied its fixture environment (which aborted the rest of the file), and restores main's T3 discovery test. * no-mistakes(ci): Fixed both overdue reconcilers to use the configured resolve verb when matching and writing resume resolutions. Added watcher and daemon regressions; focused tests and `bin/fm-lint.sh` pass
…id#8308) * feat(bin): ask a Claude primary to /stow before compaction Add an opt-in Stop hook that tells a primary session to run the existing /stow skill when context nears compaction or the last /stow is a day old. * fix(bin): keep the stow ask off secondmate homes and unread clocks A Stop block in a secondmate home left the parent recording idle, and a missing python3 still asked by age after a /stow it could not see. * no-mistakes(review): Let continuation stops trigger stow-guard asks
…kunchenguid#8279) The "successor never delivered its recovery wake and exited" flake came from a sampling race in the test helper, not the watcher. SIGSTOP freezes the old watcher's shell but not its already-forked children: when the stop lands inside fm_lock_try_create after its ln -s child was forked, the helper's glob of the linked *.lock names samples clean, then the child publishes a lock recorded to a pid that can never release it. The successor claims .watch.lock, then blocks the full startup bound in fm_recovery_marker_reopen_announced on .wake-queue.lock, alive and silent, until the 20s poll gives up. fm_lock_try_create stages <lock>.owner.*/pid before the link exists, so counting staged owner directories as held makes the stop verdict airtight: any publication that can still land already has its pid on disk. The watch lock's own owner dir is skipped along with the lock itself. The failure message also gains the successor's pid, claim state, and the recorded holder of each lock, since an empty new_out previously left the diagnostic colon blank. Reproduced 6/120 iterations under nproc/2 CPU load before the fix, each failing run stalling ~55-73s at the 60s startup bound; 0/80 under the same load after.
* fix(opencode): apply busy-state events in emission order At every turn end OpenCode emits session.status busy then session.status idle/session.idle ~1ms apart without awaiting the plugin hook. Each event used to spawn its own fm-busy-event.sh apply, and the applies serialized only on the record lock, so the earlier busy could win the last write and leave an idle worker recorded busy until its next turn (5 of 13 turns in the live finding; 4 of 4 in reproduction on opencode 1.18.32). Both generated plugin variants now run every event's applies through one promise queue, so emission order is apply order. The OpenCode 2 plugin's server hook and setup() event.subscribe stream share that one queue and one session latch per plugin instance instead of holding a handler each. Regression tests fire a busy/idle pair through the real generated plugin without awaiting, then run the real applies in reverse spawn order via an execFile interposer, so the record ends busy deterministically whenever serialization is lost. Verified live: on a persistent `opencode serve` the patched plugin ends 5 of 5 real turns idle while the unpatched one left the record busy. * no-mistakes(document): Correct busy-state ordering contract comments
…nchenguid#8276) * fix(remote): guard shared Herdr service ownership * no-mistakes(review): Share Herdr identity and harden repair safety * no-mistakes(review): Never repair a running Herdr server; serialize repairs * no-mistakes(review): Split automatic and operator Herdr repairs * no-mistakes(review): Document explicit operator repair's pane race risk * no-mistakes(document): Clarify remote readiness repair documentation * no-mistakes(document): Clarify remote Herdr session reservation * no-mistakes(ci): Added the new identity regression’s measured duration hint, fixing coverage guard and parallel runner-test failures; documented timing provenance. Coverage guard, full runner regressions, identity regression, watcher-lock suite, and diff checks passed locally. Serial CI failure was an unrelated unchanged watcher timeout; Full suite was a downstream failure. Nothing pushed * no-mistakes(ci): Fixed legacy guard-path decoding for apostrophes and bound takeover authorization to PID plus process-start identity, with cleanup on handled exits. Updated the pinned doctor digest. Both regressions fail before and pass after the fixes. Identity, guard, doctor, and entrypoint suites, targeted ShellCheck, and diff checks passed. Changes remain local; nothing pushed * docs(remote): clarify Herdr root session ownership
* fix(bin): let relaunch use the recorded project's common-dir boundary The relaunch isolation check compared the task copy's own --git-dir to its own --git-common-dir, which are equal for every standalone clone, so a worker launched into a clone could never be relaunched: fm-control stopped the old agent first, then the launch owner refused it as a "primary checkout" and left no replacement. Compare the copy's git dir against the recorded project's common git dir instead - the same boundary fresh spawn's spawn_worktree_isolated draws - while keeping the home, code-root, and true primary-checkout refusals and the secondmate exemption. * no-mistakes(document): Clarify relaunch isolation documentation
* feat(pr-poll): wake on a ready PR/MR degrading after its ready report
A ready PR/MR watched only for its merge sat idle when it degraded after
the ready report: a GitLab merge train dropping the merge request (its
readable trace is the failed head pipeline) or GitHub checks turning red
fired no wake, so the worker and its supervisor waited until a human
noticed. The existing merge poll now also emits one degraded line for
that transition, naming the failed jobs with the forge's failure reasons
and the pipeline or check URL so the wake says which test broke without
a job-log dig.
- bin/fm-pr-poll.sh reads the GitHub rollup through gh's own --jq and the
GitLab record through glab -F json, the same read the merge path makes,
so both forges share the merged contract and gain the degraded line.
- The watcher dedupes one wake per head/pipeline identity through a
validated per-task marker (bin/fm-pr-lib.sh); a repeat is silent and a
changed identity wakes again. The merged wake is unchanged.
- GitLab arming requires jq like the Gerrit and Forgejo watches, because
the rendered view carries no head pipeline state.
- Re-arming clears the marker; teardown removes it with the other
per-task PR-poll artifacts.
- Regression tests cover both forge paths, the silent paths, and the
once-per-transition dedupe at the watcher level.
* no-mistakes(review): Wake on GitLab merge-train drops; jq-less merged fallback
* no-mistakes(review): Match only HTTP 404 for merge-train drop detection
* no-mistakes(review): Name failed jobs on train drops; baseline degraded-at-ready
* no-mistakes(review): Re-read MR after train 404 before reporting a drop
* no-mistakes(document): Document degraded-after-ready merge poll wakes
* no-mistakes(ci): Lint 1 failed on shellcheck SC2034: the shape loop in test_github_degraded_poll (tests/fm-pr-check-security.test.sh) assigned `field` (and an intermediate `rest`) that were never used. The invariant is that every assigned variable in the test is used. That loop is the only site. The working tree already removes both assignments (shapes are now 'Type|VERDICT', with `verdict=${shape#*|}`). `shellcheck tests/fm-pr-check-security.test.sh` now reports nothing. I started the full test file, but it was stopped at its background time limit, so its pass/fail result is unconfirmed. The change only drops dead variables, so behavior is unchanged. I did not touch the Behavior portable checks (ci-1 to ci-3), per the task owner's ruling that they are unrelated flakes
* no-mistakes(ci): The ci-1..ci-4 fixes were already in the worktree, so I made no code edits. I did not commit or push: this phase must not push, and the outer executor owns that. The four targeted regression tests did not finish, so the fixes are not confirmed by a passing test run. - **Shellcheck:** `shellcheck -x -S warning` on bin/fm-watch.sh, bin/fm-pr-check.sh, bin/fm-pr-poll.sh and tests/fm-pr-check-security.test.sh is clean. Plain `shellcheck` reports only info-level SC1091 (sourced files not followed). - **Regression tests:** I ran the four targeted functions from a temporary runner: test_gitlab_merge_watch, test_arming_baselines_an_already_degraded_change, test_degraded_poll_wakes_once_per_transition and test_degraded_wake_survives_an_unsaved_marker. It printed no output and was stopped at its 10-minute background limit on this loaded host. Per your instruction I did not restart it or run the full test file. - **Cleanup:** I deleted the `tests/zz-*` scratch runners, including my own temporary one. `git status` now shows only the five intended modified files: the operational-home-layout skill, the three bin scripts and the security test
* no-mistakes(ci): ci-2 fixed in code, but the new test is unverified. In bin/fm-pr-check.sh the arming baseline read of fm-pr-poll.sh now runs through fm_run_timed (fm-timeout-lib.sh is now sourced) with the bound ${FM_CHECK_TIMEOUT:-30}. A timeout (status 124) or any other nonzero exit prints "error: baseline read of the PR poll timed out/failed" and exits 1. The EXIT cleanup releases the control lock, and nothing is published because the poll is published after the baseline. The success path is unchanged. Before this edit a failed baseline read was ignored and arming went on without a baseline, so any nonzero exit from the poll now fails registration. I extended test_arming_baselines_an_already_degraded_change with a stalled-read case: FM_CHECK_TIMEOUT=1 and FM_TEST_GLAB_SLEEP=3. It asserts arming exits non-zero, the error names the timed-out baseline read, .control-task-a.lock is gone and no task-a.check.sh exists. `shellcheck -x -S warning` on bin/fm-pr-check.sh and tests/fm-pr-check-security.test.sh is clean. I tried two temporary runners, one for the whole target function and one for just the new case plus a plain arming success. Both hit this loaded host's time limit with no output, so the new test has not been run. I stopped them and deleted the runner. I did not commit or push, because this phase must not push. Only bin/fm-pr-check.sh and tests/fm-pr-check-security.test.sh are modified
* no-mistakes(ci): ci-2 fixed in bin/fm-pr-check.sh. Invariant: a failed or timed-out re-arm must leave the task metadata and the previously published poll unchanged. The control-lock acquisition (still skipped when FM_PR_CHECK_MERGE=1) and the bounded baseline read (fm_run_timed ${FM_CHECK_TIMEOUT:-30}, exit 1 on timeout or failure) now run before the metadata rewrite under the meta lock. Lock order is control -> meta -> publish, and the ordering comment is updated. The marker write or removal stays just before poll publication, after the metadata rewrite, under the control lock. The control lock is released after publication as before. Regression test: test_arming_baselines_an_already_degraded_change in tests/fm-pr-check-security.test.sh now arms task-a on PR 1, then re-arms to PR 7 with FM_CHECK_TIMEOUT=1 and FM_TEST_GLAB_SLEEP=3. It asserts the re-arm exits non-zero, task-a.meta still holds the PR 1 url, fm_pr_poll_artifacts_valid passes for the PR 1 poll, and .control-task-a.lock is gone. Verification: `shellcheck -x -S warning` on both touched files is clean. The new test has not been run, because this loaded host hit its time limit on earlier runner attempts and the full test file was not to be run. I did not commit or push, because this phase must not push. No temporary runner is left, and only bin/fm-pr-check.sh and tests/fm-pr-check-security.test.sh are modified. bin/fm-pr-poll.sh is untouched
* no-mistakes(ci): Removed the tracked temporary runner tests/zz-run.sh with git rm. The deletion is staged but not committed or pushed, since this phase must not push. Invariant: no scratch runner ships in the tree. No other tests/zz-* files exist, and no other files changed. No tests or lint were run because the change only deletes an unused scratch file
* fix(pr-poll): hard per-read limit on GitLab failure-detail reads
Each GitLab failure-detail read (failed-pipeline and train-drop paths) now
runs under its own five-second limit, so a hung glab read is cut and the
known failure is still emitted with the detail read so far instead of the
poll being killed by the watcher's check timeout before it prints.
The static poll sources nothing, so it uses the same perl fork-and-kill
bound the watcher falls back to for its own checks; a bare alarm is not
enough because glab's Go runtime ignores SIGALRM. The regression test uses
a fake glab whose detail reads hang while ignoring SIGALRM.
* no-mistakes(test): Add FM_TEST_WATCH_BOUND override and robust wake-queue count
* no-mistakes(test): Separate glab stdout/stderr in train poll; harden watcher test
* no-mistakes(ci): Fixed ci-2 and ci-3; ci-1 stays declined. The new arming and cross-project checks now pass, and shellcheck -x -S warning is clean on bin/fm-pr-poll.sh, bin/fm-pr-check.sh and tests/fm-pr-check-security.test.sh. ci-2: bin/fm-pr-poll.sh takes a `--baseline` flag, passed only by bin/fm-pr-check.sh. With it, a failed or unreadable forge read exits 3 and prints nothing, across GitHub, GitLab (including the merge-train car read and the post-404 re-read), Gerrit and Forgejo. The watcher's `--validated` call still stays silent on every error. bin/fm-pr-check.sh turns status 3 into "baseline read of the PR poll could not read the forge" and exits 1 before the metadata rewrite and publish. The old metadata and published poll are untouched and the control lock is released. A clean, readable not-degraded record still arms with no baseline. ci-3: `gitlab_failure_detail` carries `downstream_pipeline.project_id` with each downstream pipeline id and reads its jobs and bridges through `projects/<project_id>/...`. It falls back to the MR's project when no project_id is present. The 4-pipeline, 10s, 5s-per-read and depth-below-3 limits are unchanged. Tests: I added a cross-project poll regression to `test_gitlab_merge_watch`, where the fake glab serves the child jobs only under that other project's path. I also added unreadable-forge arming cases to `test_arming_baselines_an_already_degraded_change`: glab and glab-API failures, a failed re-arm that keeps the old metadata and poll, and a GitHub failure. I ran these only through a temporary runner outside the repo; the cross-project case printed ok and the arming block ended with "ok - an unreadable baseline read fails arming and keeps the previous watch". I did not run the existing poll-stderr-check.sh script or any watcher-driven scenario. My first version of the baseline mode treated a successful car read with a non-car body as unknown, which broke ordinary arming. That is fixed: only an unparseable body is unknown. The temporary runner is deleted and the worktree holds only the three modified files
* fix(pr-poll): make no GitLab detail read without perl
The per-read limit on GitLab failure-detail reads is a perl fork-and-kill
bound. Without perl the reads fell back to a bare glab api call, so one
hung read could hold the poll until the watcher's check timeout killed it
before the known failure printed. Without perl the poll now makes no
detail read at all and emits the degraded line with no job names on both
the failed-pipeline and train-drop paths.
The regression hides perl from PATH, makes every detail read hang, and
asserts both paths still emit at once with no pipelines/ read.
* no-mistakes(ci): Fixed ci-1 in tests/fm-pr-check-security.test.sh only (nothing changed in bin/). Invariant: every GitHub arming or merge call must give the fake gh a jq, because arming now reads through `fm-pr-poll.sh --baseline` and fails when the read is unreadable. I added FM_TEST_JQ="$REAL_JQ" to run_check_entry and run_merge_entry. I also added it to the other direct healthy-GitHub registration calls: the rebind.sh heredoc (around line 3868), the replace-authority.sh heredoc, and the background re-arm (around line 4275). I left the GitLab and no-tool cases alone (the no-glab and no-jq runs at ~2921/2962, and the no-tool run at ~2245). Validation: `shellcheck -x -S warning` on the file is clean. A temporary runner outside the repo (since deleted) sourced the file's helpers and ran make_case, then run_check_entry on https://github.com/o/r/pull/1. It exited 0 with "armed: state/task-a.check.sh" and the published check.sh was present. run_merge_entry on the same case printed no "could not read the forge" error. No test function from tests/ and no watcher scenario was run. The tree has only the one modified file and no scratch files
* fix(pr-check): skip the degraded baseline read on the merge-time re-record
bin/fm-pr-merge.sh records through bin/fm-pr-check.sh before any merge forge
call. The strict arming baseline read ran there too, so an unreadable forge
stopped the merge with the arming error before its own refusals, and every
merge made one extra forge read. The merge-time re-record now neither reads
nor rewrites the baseline; the watch's marker is keyed to the PR identity and
stays as the watcher left it.
* no-mistakes(review): fix(pr-poll): lenient train car read, link-only train drop
* no-mistakes(document): Note train-drop poll names pipeline link only
* no-mistakes(ci): ci-1 (Greptile "Test hooks hang") is fixed. The only file changed is tests/fm-pr-check-security.test.sh; nothing under bin/ changed and production lock behavior is untouched. Invariant: a test hook that runs inside a process already holding STATE/.control-<id>.lock must not call the lock-taking arming path, because fm_lock_acquire_wait would then wait forever on its own parent. Only two hooks re-arm from inside a control-lock holder: rebind.sh in test_authority_persistence_refuses_rebound_metadata, which runs during `gh pr merge` while fm-pr-merge.sh holds the lock, and replace-authority.sh in test_authority_retirement_preserves_replacement, which runs inside the watcher's mv. The background replacement merge that replace-authority.sh starts already waits for the lock correctly and is unchanged. Fix: both hooks now call `FM_PR_CHECK_MERGE=1 "$PR_CHECK" task-a "$url_b"`. That is the arming path bin/fm-pr-check.sh provides for a caller that already holds the control lock. It still rewrites pr= in task metadata and republishes the poll, but skips taking the lock and the baseline read. That matches how these hooks behaved before this PR, when arming took no control lock. I didn't move the registration into the background or after the parent releases the lock (the user's examples). In the rebind test the metadata change has to land before the merge persists its authority. A deferred re-arm would let the merge persist authority for url_a, which defeats the test. The re-arm stays synchronous, so every existing assertion is kept: the rebind test still gets a non-zero merge exit, pr=$url_b in the metadata and no merge-authority file. The retirement test still keeps the replacement authority, arms url_b and lands the attended merge for url_b. Verification: each test was run alone with FM_TEST_WATCH_BOUND=600. Both exited 0 within seconds and printed their pass lines: "ok - accepted merge authority refuses rebound task metadata" and "ok - poll retirement preserves a replacement authority record". I used a temporary runner that sourced the test file's helpers and called the one test; it has been deleted. The hang was not re-run before the fix; the user had already reproduced it on f0a22753. `shellcheck -x -S warning tests/fm-pr-check-security.test.sh` is clean. The full suite was not run
* no-mistakes(test): Fixed enterprise-host diagnostic assertion; watcher validation still fails
* no-mistakes(ci): Fixed the expected-failure watcher call so errexit cannot abort the test before its result is checked. `bash -n` and `git diff --check` passed; the full security test script timed out after 120 seconds, before reaching this test
* no-mistakes(review): Suppressed ambiguous GitLab car-endpoint 404 train drops; focused test still fails because an existing detail-budget case expects a wake
* no-mistakes(review): Confirmed train-drop listing path added; focused suite still fails on unknown-baseline arming
* no-mistakes(review): Allow unknown baseline reads without blocking arming
* no-mistakes(review): Preserve dedupe markers until poll publication succeeds
* no-mistakes(review): Reuse parsed MR state when confirming train drops
* no-mistakes(document): Update PR degradation watch documentation
* fix(pr-poll): recheck merge state before train drop
* no-mistakes(review): Preserved train state separately; focused test failed
* no-mistakes(test): Train-drop regression still fails; baseline train marker preserved
* no-mistakes(test): Fix on-train baseline marker registration
* no-mistakes(test): Confirmed train drops despite unreadable state rechecks; recovery regression remains
* fix(watch): re-arm the merge-train drop wake on re-queue
A drop wake now clears the on-train record, and a drop wakes only when
the watcher saw the merge request back on its train since the last drop,
so a second drop after a re-queue wakes again instead of being absorbed
as a duplicate. A failed or closed MR re-read keeps the confirmed drop,
marked mr_state=unconfirmed when the state is unreadable.
Silent watcher steps in the security suite now stop one second after
their check pass completes instead of spending the full 60s bound.
* no-mistakes(document): Clarify GitLab degraded-watch documentation
* no-mistakes(review): Suppress train-drop wake for closed MR rechecks
* no-mistakes(document): Document GitLab train-drop recheck outcomes
* fix(pr-poll): stop a hung GitLab detail read when the poll is stopped
The bounded glab read runs in its own process group, which only its alarm
used to stop. A TERM, INT, or HUP that stops the poll mid-read, such as the
watcher's check timeout, killed the perl parent and left glab running.
Forward those signals to the read's group and reap it before exiting.
* no-mistakes(document): Correct GitLab merge-watch documentation
* no-mistakes(review): Fail registration when PR baselines cannot persist
* no-mistakes(review): Persist both GitLab degradation baselines
* no-mistakes(document): Clarify PR poll documentation
* no-mistakes(review): Preserve registration when baseline persistence fails
* no-mistakes(review): Validate degraded and train markers before teardown
* no-mistakes(review): Rollback failed PR baseline re-registration
* no-mistakes(review): Preserve prior watch through poll publication
* no-mistakes(review): Re-registration rollback remains unsafe
* no-mistakes(review): Re-registration rollback remains unresolved
* no-mistakes(review): Preserve registration baselines on rollback
* no-mistakes(review): Restore registration through safe temporary files
* no-mistakes(review): Preserve train baseline after inconclusive reads
* no-mistakes(review): Reject inconclusive merge-train baselines
* no-mistakes(test): GitLab baseline-order regression remains unresolved; focused test fails
* no-mistakes(document): Document PR degradation and GitLab merge-train watches
* no-mistakes(lint): Fix ShellCheck conditional warnings
* no-mistakes(ci): Fixed rollback restoration to preserve existing artifact inodes, keeping the prior watcher registration valid. GitLab failed-pipeline baselines now confirm missing train cars against the train list instead of always reporting unknown. Verified with bash -n and git diff --check; full behavioral tests were not run
* no-mistakes(ci): Updated rollback backups to hard links so restoring a replaced poll artifact preserves its inode. Verification exposed a regression: `bash tests/fm-pr-check-security.test.sh` fails at “re-arming a GitLab watch on a green change failed”; hard-linked backups conflict with the poll artifact link-count validation. The fix needs adjustment before this phase can pass
* no-mistakes(ci): Fixed the portable serial failures: re-arm backups use copies so poll publication’s single-link invariant holds; rollback restores in place to preserve the registered inode. `bash tests/fm-pr-check-security.test.sh` passed (all 69 cases); `bash -n bin/fm-pr-check.sh` and `git diff --check` passed. Full suite failure was downstream of failed lanes
* no-mistakes(review): Opt-in polling fix remains incomplete
* Make degraded PR watches opt-in
* no-mistakes(document): Clarify optional jq requirement for GitLab watches
* Restore PR registrations when rearming is interrupted
* Seed train state for interrupted registration test
* no-mistakes(ci): Fixed both rollback invariants in bin/fm-pr-check.sh: rollback state is cleared before obsolete-backup deletion, and a failed restore retains the backup directory and reports its path. Verified with bash -n and git diff --check. Behavioral tests requested by the driver were not added or run
* docs: document opt-in degraded PR wake
* no-mistakes(document): Clarify degraded PR watch opt-in
* no-mistakes(ci): Fixed `bin/fm-pr-poll.sh` to resolve its opt-in marker home using `FM_HOME`, then `FM_ROOT_OVERRIDE`, then the script root, matching registration. `bash -n` and `git diff --check` passed. `tests/fm-pr-check-security.test.sh` passed its printed cases but exceeded the 300-second limit before completing
* test: cover the degraded-watch flag in a home reached through FM_ROOT_OVERRIDE
…d#8317) * feat(supervision): reach herdr panes in the acknowledged hand-back retry The detached retry could only deliver a queued wake to a Claude primary behind tmux, because it only knew the inherited TMUX_PANE. A primary running in herdr - including a remote home whose scripts inherit the fm-remote session's pane identity - kept its watcher and queued check but needed another turn or a human message to resume main. Resolve the delivery transport from the identity the pane runtime itself injected, mirroring fm-supervisor-target-lib.sh's discovery order: TMUX_PANE, else HERDR_ENV + HERDR_SESSION + HERDR_PANE_ID. An explicit target variable is never honored. On herdr the pane's own process-info must prove the pinned session owner is its foreground occupant (ancestor-or-self to the pane shell plus matching process group), the registered agent identity must be claude including its session binding, and idle must hold in both the native agent state and the rendered footer, because a live Claude turn can leave the native status reading idle. The tmux ancestor/tpgid proof is unchanged, and deferred retries still never touch the queued check. Portable coverage pins the new path alongside the tmux sibling, a unit contract covers fm_backend_herdr_pane_owns_session, and an opt-in live e2e proves a real Claude primary in an isolated fm-lab session: its hand-back continuation is lost, the detached retry submits the doorbell to the inherited pane, the primary drains and acknowledges, and the pending check clears only after that acknowledgement. * no-mistakes(document): Clarify herdr retry documentation ownership * no-mistakes(ci): Added independent foreign-session-binding and native-idle/rendered-busy deferral tests; both pass and fail when their respective guards are removed. Strengthened live takeover assertions to capture watcher identity, verify retirement/replacement, and match the recorded retry arm’s take-over row. Focused behavior tests, syntax checks, warning-level ShellCheck, and diff checks pass. Credentialed live E2E was not rerun because it modifies external Herdr state outside the workspace boundary
…unchenguid#8318) * fix: clear per-task away-session markers at return and fresh entry The five .subsuper per-task families (stale, reported-stale, dialog, paused, pause-until-due) were episode state with no session scope: a first-seen-idle clock left behind when a session ended inside the 240s recheck window was read by the next away session's first housekeeping pass as its own, reporting a "stale persisted Ns (possible wedge)" whose duration never happened. fm_afk_clear_stale_artifacts now drops all five families with the delivery artifacts on a fresh entry, and fm_afk_launch_stop drops them at the return. The launch backup/rollback lists cover the same set so a failed entry still restores prior state. Accepted cost, recorded on the cleanup's header: a declared wait spanning two away sessions restarts its recheck window at re-entry. * no-mistakes(document): Correct away-session lifecycle documentation * no-mistakes(ci): Initialized pendingBashComponents in the shared Pi test host, fixing the CI renderer crash. Full suite failure was downstream of that lane. Focused behavioral checks, shell syntax, and diff checks pass locally; the newer CI Pi version was not available locally
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.
Sync upstream firstmate (10 commits since fork PR #5)
Merges
upstream/main(github.com/kunchenguid/firstmate) into the fork, the same shape as fork PRs #1-#5: a normal merge commit, no rebase, no squash. 10 upstream commits, 61 files changed (+6202/-418).Incoming changes by theme
fm-pr-check.sh/fm-pr-poll.shnow wake when a ready PR or merge request degrades after its ready report - failing GitHub checks, failed GitLab head pipelines, merge-train drops (fix: alert when ready merge requests degrade kunchenguid/firstmate#7858), gated byconfig/pr-degraded-watch, with a newdocs/gitlab-merge-watch.md.stop_outside_state_locks(test: improve watcher-lock successor timeout diagnostics kunchenguid/firstmate#8279).Conflicts and resolutions (4 files)
bin/fm-busy-lib.sh- theopencode-pluginsource-comment line. Fork had "session.execution.* and legacy session.status"; upstream (fix: preserve OpenCode busy-state event ordering kunchenguid/firstmate#8295) rewrote it to "2.x session.execution.*; 1.x session.status/session.idle, also accepted by 2.x". Took upstream's wording as the current description; the fork's agy comment changes elsewhere in the file auto-merged unchanged.bin/fm-pr-check.sh, hunk 1 (header comment) - fork's Bitbucket-aware phrasing ("for a GitHub pull request, the forge's exact pr_head=") kept, plus upstream's new degradation-wake paragraph appended, so both the Bitbucket precision and fix: alert when ready merge requests degrade kunchenguid/firstmate#7858's description survive.bin/fm-pr-check.sh, hunk 2 (arming-time CLI requirements) - both sides were additive: kept the fork's Bitbucket requirements block (curl, jq, credentials viafm-bitbucket.sh, given its ownfi) and upstream's GitLab jq requirement for degraded watches (DEGRADED_WATCH_ENABLED, defined earlier by the auto-merged fix: alert when ready merge requests degrade kunchenguid/firstmate#7858 code).bin/fm-pr-poll.sh(header comment) - upstream rewrote the Gerrit/Forgejo jq sentence to add the GitLab degraded read and "ontrain"/"train=dropped" behavior; the fork had appended Bitbucket Cloud sentences. Merged into one paragraph: upstream's jq/GitLab-degraded text plus the fork's Gerrit/Forgejo jq cross-reference and the fork's Bitbucket sentences, all of which describe code that exists in the merged tree.docs/scripts.md- provider-table rows. Kept upstream's expandedfm-pr-poll.shrow (degradation reports + GitLab merge watch link) and upstream's expandedfm-pr-check.shrow (degraded-wake,config/pr-degraded-watch), with the fork'sfm-bitbucket.shrow restored and the fork's "GitHub and Bitbucket drafts" refusal wording kept infm-pr-check.sh's row.No other changes beyond conflict resolution.
Validation
All commands run under
bashin the merged tree; ShellCheck 0.11.0 pinned.Fork-survival proof (fork's own changes survive the merge):
bash tests/fm-composer-lib.test.sh- 56 ok, including the "agy idle separator pair" matrix case (agy separator-pair composer is empty only with idle agy identity; drafts stay pending).bash tests/fm-control.test.sh- 52 ok, 0 not-ok.bash tests/fm-pr-merge.test.sh- 136 ok, 0 not-ok, including the--expected-headBitbucket tests ("sends a matching --expected-head to each forge", "refuses before any merge write when the live head differs from --expected-head").bash tests/fm-bitbucket.test.sh- 16 ok, 0 not-ok.bin/fm-lint.sh- pass (ShellCheck 0.11.0 pinned, actionlint 1.7.12, 3 workflow files valid).Session-start, watcher, wake-drain, send, and spawn suites - all 42 portable-lane test files in those families, each exit 0 with 0 not-ok, including
fm-session-start(62 ok),fm-wake-queue(81 ok),fm-watch-triage(130 ok),fm-watch-triage-pause(39 ok),fm-watcher-lock(63 ok),fm-spawn-dispatch-profile(109 ok),fm-pi-watch-extension(76 ok), and the fullfm-send-*family.fm-watch-wedge-cap-liveskips as designed ("live: opt-in; set FM_WATCH_WEDGE_CAP_LIVE=1 to run").No pre-existing upstream failures observed: every named suite passed on the merged tree.