Skip to content

test: separate subject startup from asserted intervals in two load-sensitive tests - #7632

Merged
kunchenguid merged 1 commit into
kunchenguid:mainfrom
nmmanas:fm/fm-6678-startup-deadlines
Oct 24, 2026
Merged

kunchenguid merged 1 commit into
kunchenguid:mainfrom
nmmanas:fm/fm-6678-startup-deadlines

Conversation

@nmmanas

@nmmanas nmmanas commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Open ONE PR fixing #6678 ("Investigate load-sensitive startup deadlines in queue and Claude Stop-hook tests"): in tests/fm-wake-queue.test.sh test_signal_catchup_without_running_watcher and tests/fm-claude-stop-autoarm.test.sh test_owner_mutex_contention_preserves_failure_episode_reset, separate subject startup from the asserted interval with deterministic fixture synchronization, keep every behavioral assertion and a finite failure bound, test-only, per the issue acceptance list and the latest triage comment. Validate by looping both tests under load (before/after pass rates).

Context from the issue: the queue test's first wait_for_exit "$!" 40 allows 40 x 0.1s polls from watcher launch and fails under host contention, including on unchanged baseline; the second signal wait is near line 84. The Stop-hook test waits 50 x 0.05s for arm-waiting and fails with "healthy owner never reached the reset boundary" (near line 742) under heavy load. Acceptance list: reproduce each failing startup boundary with portable, isolated fixtures under controlled contention; distinguish subject startup from the behavioral interval without hiding a genuinely stalled watcher or failed owner reset; preserve finite failure bounds and all queue acknowledgement, singleton, generation, and failure-episode assertions; verify on a quiet host and under contention, including the portable macOS lane. Latest triage (Kun's firstmate, 2026-10-20, main 9d76aa8): still open and not fixed, no PR addresses it, #6500 touches neither file, contract-class restore (test-only), the runtime does not change.

What Changed

  • tests/wake-helpers.sh: adds wait_for_watcher_lock <pid> <state> [limit]. It waits until .watch.lock/pid names the launched watcher, or until the watcher has already exited. The default bound is 300 × 0.1s polls. If the watcher never takes the lock, the helper stops it through wait_for_exit and returns 1.
  • tests/fm-wake-queue.test.sh (test_signal_catchup_without_running_watcher): for both the first and the second signal run, the test now waits for the watcher to hold its singleton lock before the exit deadline starts. The exit bound goes from 40 to 150 polls (a fixed number of 0.1s polls, so it can still fail). All the signal output, drain, and queue assertions stay the same.
  • tests/fm-claude-stop-autoarm.test.sh (test_owner_mutex_contention_preserves_failure_episode_reset): the wait for arm-waiting now fails at once, with the hook's exit status and output, if the hook exits or becomes a zombie before it reaches the boundary. The poll bound goes from 50 to 600 × 0.05s. The failure-episode assertions are unchanged.

Fixes #6678. Test-only: no runtime code changes.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change only touches tests. It starts each timed wait after a real startup event: the watcher's lock pid matches $! (bin/fm-watch.sh:3273 writes ${BASHPID:-$$}), or the hook writes arm-waiting or exits. Every wait still has a finite limit. A hook that dies or a watcher that never takes the lock still fails, and every assertion on the queue, singleton, generation and failure episode is unchanged.

Testing

I deleted the previous turn's 12 scratch probes, so only commit dbc2457 is under test. On this host, both changed suites passed in full, including the two re-synchronized tests (the wake-queue signal catch-up test and the Stop-hook owner-mutex reset test). ShellCheck passed on the three changed files. Plain fm-lint stopped on its workflow check because actionlint is not installed. This change touches only tests and has no UI, so there is no visual evidence. Per operator guidance, I did not re-run the before/after load-contention loops in this turn and cite the numbers recorded earlier instead.

  • Live validation: ✅ go - 3 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Quiet host: the queue test's watcher catches a signal written while no watcher runs, and the full wake-queue suite passes ✅ pass live bash tests/fm-wake-queue.test.sh rc=0; log line 'ok - signal written while no watcher runs is caught on next run' (fm-wake-queue.log)
Quiet host: the Stop-hook owner-mutex contention test reaches the reset boundary, keeps successor episode state, and the full Stop-hook suite passes ✅ pass live bash tests/fm-claude-stop-autoarm.test.sh rc=0; log line 'ok - auto-arm: owner-mutex contention preserves successor episode state' (fm-claude-stop-autoarm.log)
Under CPU/fork contention, both tests pass after the fix where they failed before (queue 0/40 -> 40/40, stop 173/192 -> 192/192) ⏸️ untested no The operator told this turn not to re-run the long load loops and to cite the recorded numbers instead. To re-check, run the contention loops from a mktemp directory outside the repo.
Adversarial: a watcher that misses the catch-up, stalls at startup, or a hook that exits or stalls before the boundary still fails within a finite bound ⏸️ untested no These mutation probes ran in the previous turn and their scripts are deleted per operator guidance. They were not re-run in this turn.
Changed shell files pass the repo's ShellCheck lint ✅ pass live bin/fm-lint.sh tests/fm-wake-queue.test.sh tests/fm-claude-stop-autoarm.test.sh tests/wake-helpers.sh rc=0 (fm-lint-changed-files.log)
Evidence: fm-wake-queue suite transcript

Source: fm-wake-queue suite transcript

ok - an abandoned same-process lock hold is reclaimed; a parent's live hold is not
ok - without BASHPID a subshell cannot release or reclaim its parent lock and owns its own hold
ok - bounded acquire hands ownership to the waiting caller after contention
ok - presentation lock waits are bounded and retriable without weakening acknowledgement atomicity
ok - malformed presentation locks report acquire failure instead of contention
tests/wake-helpers.sh: line 329: 78954 Killed: 9               PATH="$dir/fakebin:$PATH" FM_FAKE_NOW_FILE="$dir/now" FM_HOME="$dir" FM_ROOT_OVERRIDE="$ROOT" FM_STATE_OVERRIDE="$dir/state" FM_FAKE_TMUX_WINDOW='firstmate:fm-mate' FM_SECONDMATE_WAKE_STALL_SECS=1 FM_SECONDMATE_LIVENESS_SECS=99999999 FM_POLL=1 FM_SIGNAL_GRACE=0 FM_CHECK_INTERVAL=999999 FM_HEARTBEAT=999999 "$WATCH" > "$dir/watch-$leg.out" 2> "$dir/watch-$leg.err"
tests/wake-helpers.sh: line 329: 79901 Killed: 9               PATH="$dir/fakebin:$PATH" FM_FAKE_NOW_FILE="$dir/now" FM_HOME="$dir" FM_ROOT_OVERRIDE="$ROOT" FM_STATE_OVERRIDE="$dir/state" FM_FAKE_TMUX_WINDOW='firstmate:fm-mate' FM_SECONDMATE_WAKE_STALL_SECS=1 FM_SECONDMATE_LIVENESS_SECS=99999999 FM_POLL=1 FM_SIGNAL_GRACE=0 FM_CHECK_INTERVAL=999999 FM_HEARTBEAT=999999 "$WATCH" > "$dir/watch-$leg.out" 2> "$dir/watch-$leg.err"
tests/wake-helpers.sh: line 329: 84527 Killed: 9               PATH="$dir/fakebin:$PATH" FM_FAKE_NOW_FILE="$dir/now" FM_HOME="$dir" FM_ROOT_OVERRIDE="$ROOT" FM_STATE_OVERRIDE="$dir/state" FM_FAKE_TMUX_WINDOW='firstmate:fm-mate' FM_SECONDMATE_WAKE_STALL_SECS=1 FM_SECONDMATE_LIVENESS_SECS=99999999 FM_POLL=1 FM_SIGNAL_GRACE=0 FM_CHECK_INTERVAL=999999 FM_HEARTBEAT=999999 "$WATCH" > "$dir/watch-$leg.out" 2> "$dir/watch-$leg.err"
ok - foreign secondmate queue alerts once per no-progress episode without age-only or cascade noise
ok - declared external-wait pause rows do not feed secondmate wake-loop escalation
ok - a reprovisioned queue generation starts a fresh no-progress interval
ok - an active turn defers the secondmate stall escalation without cancelling it
ok - a long-lived mate mid-turn is not a stall, but a queue frozen past the busy bound still alarms
ok - a proven-idle leftover row is rung so the child home can drain without a parent alarm
ok - TERM stops a watcher blocked in the drain-ring idle capture and runs its cleanup
ok - busy panes defer without a ring and unknown panes keep the parent alarm
ok - a leftover row that survives a proven-idle ring still surfaces as a genuine stall
ok - secondmate stall markers reject symlinks without touching their targets
ok - stall publication acknowledgement closes the pre-marker crash window
ok - empty prefix mate cleanup preserves another mate's stall receipt
ok - self-announced appends suppress only their own bytes and fail toward waking
ok - separate self-announced answers after a fold stay owned; worker decisions and later lines still wake
ok - an unreadable status still reads as unreported, with or without owned growth
ok - a worker resolved in fold lag still wakes after this home's close
ok - owned growth suppresses the wake without hiding the turn-ended annotation
ok - historical annotations replay nothing already announced and keep everything new
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 9 --recovery-generation 48672.1792645407.pPeNxF
ok - concurrent append plus drain preserves durable records through acknowledgement
ok - signal written while no watcher runs is caught on next run
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 92591.1792645426.K1CUZd
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.
ok - stale wake is queued before suppressor state is advanced
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 95664.1792645429.85m0vO
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.
ok - a not-provably-working stale wake is queued before its suppressor is advanced
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 99772.1792645431.DuF8ER
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.
ok - registered custom check output is queued before cadence suppression
ok - concurrent drains replay until one post-handling acknowledgement consumes records
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 4 --recovery-generation 7657.1792645433.BEFO34
ok - drain collapses obvious duplicate heartbeat and signal records
ok - drain asserts watcher liveness: warns on a lapse, stays silent for a live watcher with a fresh beacon
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 8 --recovery-generation 10372.1792645435.pDkdNg
ok - structural signal enrichment is separate, deduped, home-local, and tier-zero for other wakes
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 13 --recovery-generation 12407.1792645436.nhGkqX
ok - every readable unread status line is annotated in full while invalid status files preserve their raw wakes
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 15680.1792645439.iAiPi1
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 15680.1792645439.iAiPi1
ok - slow annotation releases the append lock and a deleted status file fails open
ok - a branch-actor scoped ack never swallows an unacked main-owned row, and main's later drain sees exactly what remains
ok - main drain and acknowledgement exclude an active branch grant
ok - a branch-actor acknowledgement commits secondmate stall receipts for exactly its granted rows
ok - a branch-held row raises no queued-wake warning for main, and the same row is presented and acknowledged once the grant clears
ok - a queue that cannot be counted keeps the queued-wake alarm up
ok - structurally unusable rows are retired by main alone, leaving every remaining row presentable and acknowledgeable
ok - branch grant cannot take a row already claimed by main
ok - main's acknowledgement leaves a row that arrived after its drain for whichever actor takes it next
ok - actor ownership filtering precedes same-key deduplication
ok - main reclaims rows granted to an exited branch owner
ok - a branch-actor drain with no eligible-row snapshot refuses loudly instead of draining nothing
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation existing
ok - wake append publishes atomic recovery evidence before durable rows
ok - recovery mint and delivery log avoid sibling $()
ok - wake drain: generation-less legacy wakes are adopted and acknowledged
ok - a handover undoes only the downtime its own stop published over an acknowledged episode
ok - wake drain: a stale acknowledgement cannot retire or consume a newer recovery episode
ok - wake drain: an acknowledgement that consumes nothing says so and names the exact command for the current wake
ok - wake drain: a branch acknowledgement that consumes nothing names the exact command for its granted wake
ok - wake drain: recovery acknowledgement failures are explicit and retryable
ok - interruptions preserve durable rows until post-handling acknowledgement
ok - fm_wake_queue_prune_task: prunes wakes for target task without touching other tasks
ok - drain rotates scratch files an interrupted drain left under the queue lock
ok - watch liveness: a dead secondmate is relaunched once, ledgered, and quiet afterwards
ok - watch liveness: a missing secondmate endpoint is relaunched without a pre-kill
ok - watch liveness: one tick relaunches every dead mate, queues a row each, and wakes once
ok - watch liveness: alive and ambiguous endpoints are probed, logged, and never touched
ok - watch liveness: the cadence marker gates probing and survives across legs
ok - watch liveness: the attempt bound parks a flapping mate once and a live probe rearms a full budget
ok - watch liveness: a failed auto-relaunch wakes once with its cause and is ledgered
ok - watch liveness: an unwritable or unreadable relaunch ledger refuses to kill or spawn
ok - watch liveness: a per-mate error keeps scanning, recovers later mates, and still wakes
ok - watch liveness: an outcome that could not be queued surfaces as an error, not a wake
ok - watch liveness: a mate mid-episode under the shared liveness lock is skipped entirely
ok - watch liveness: an unreachable remote secondmate is probed, preserved, and never failed over
bash tests/fm-wake-queue.test.sh  55.05s user 96.34s system 78% cpu 3:13.24 total
Evidence: fm-claude-stop-autoarm suite transcript

Source: fm-claude-stop-autoarm suite transcript

ok - auto-arm: inert in a linked child worktree even when in-flight
ok - auto-arm: inert with no session lock
ok - auto-arm: a demonstrably dead recorded session owner is reclaimed through fm-lock.sh before arming
ok - auto-arm: inert without arm, rewake, or lock replacement when another live harness owns the home
ok - auto-arm: inert while AFK owns supervision
ok - auto-arm: stale-owner recovery leaves the AFK and supervision-need gates unchanged
ok - auto-arm: resolves the outermost pid of a nested contiguous claude ancestry (bg-spare chain)
ok - auto-arm: inert with nothing in flight and no X-mode need
ok - auto-arm: actionable close translates to exactly one exit-2 rewake with reason
ok - auto-arm: actionable close survives a healthy successor without duplicate delivery
ok - auto-arm: an attached cycle's end starts a handling successor named after the closed arm before the rewake
ok - auto-arm: an unconfirmed handling successor is reported in the rewake instead of blocking it
ok - auto-arm: bounded failure verification emits one automatic-mechanism alarm
ok - auto-arm: consecutive failures keep Stop-owned retry without repeating notice
ok - auto-arm: marker-write refusal defers delivery until one successor commits the notice
ok - auto-arm: unverified clean close exhausts retries and fails closed
ok - auto-arm: post-alarm actionable outcomes cannot continue or reset failure state
ok - auto-arm: benign cycle end with a live watcher and fresh beacon stays silent across the next cycle
ok - auto-arm: budget contention preserves the episode and forces a reset retry
ok - auto-arm: owner-mutex contention preserves successor episode state
ok - auto-arm: X-mode poll need arms the cycle even with no tasks in flight
ok - auto-arm: a registered custom check arms the cycle even with no tasks in flight
ok - auto-arm: concurrent firings admit one owner and one rewake translation
ok - auto-arm: TERM mid-arm commits a durable failure and exits 2 for rewake
ok - auto-arm: an abandoned owner claim is reclaimed so a lapsed cycle re-arms
ok - auto-arm: an abandoned-claim reclaim reaps a dead steal mutex without nesting
ok - auto-arm: a legacy owner still arming is never reclaimed while its watcher keeps beating
ok - auto-arm: a fresh legacy arming claim is never reclaimed while its startup window is still open
ok - auto-arm: a live claim the ledger does not name is never reclaimed
ok - auto-arm: a claim whose pid was reused is reclaimed even while its ledger entry still reads arming
ok - auto-arm: a reused-pid claim is reclaimed even with no ledger entry to prove it
ok - auto-arm: an identity-matched owner still arming is never reclaimed
ok - auto-arm: the guard's terminal-check claim is never reclaimed
ok - auto-arm: a stuck live legacy owner is retired via TERM and its lock reclaimed
ok - auto-arm: a SIGSTOPped legacy owner is reclaimed with TERM pending and dies on continue
ok - auto-arm: a live open generation claim defers concurrent firings with no lock held
ok - auto-arm: a hung generation owner with no watcher beat is superseded so re-arming self-heals
ok - auto-arm: a dead session's orphaned open claim is superseded so the replacement session delivers the wake
ok - auto-arm: a resumed session with the dead session's id still supersedes its orphaned claim
ok - auto-arm: a claim is open only under a numeric session lock its owner descends from
ok - auto-arm: a recycled-bridge claim stays open on its recorded session id and lock-holder identity, and nothing else does
ok - auto-arm: an identityless arming ledger never defers the gate (reused-pid loophole closed)
ok - auto-arm: a superseded owner never re-invokes the arm and leaves its successor's claim untouched
ok - auto-arm: a superseded owner goes silent - one supersession episode, one translation, no held mutex
ok - auto-arm: need vanishing mid-cycle closes without a rewake
ok - auto-arm: mid-cycle AFK hands triage to the daemon with no rewake
ok - auto-arm: active in a marked secondmate home
ok - auto-arm: a long FM_POLL with FM_GUARD_GRACE unset reaches fm-watch-arm.sh with the derived grace
ok - auto-arm: config/supervision-host-off keeps the hook on the arm exactly as before
ok - auto-arm: a Claude home without config/supervision-host runs the host by default
ok - auto-arm: an opted-in home runs the host bound to its generation, and a host line rewakes like a wake
ok - auto-arm: a wake the host hands back under the away record says it is automatic supervision, not a return
ok - auto-arm: a wake the host hands back beside a quiet record carries no away note
ok - auto-arm: without the host the rewake banner is unchanged, eight wake lines at most
ok - auto-arm: a host handback delivers every host line, while its wake lines keep their cap
ok - auto-arm: a host that stood down closes silently without a retry
ok - auto-arm: a host rewake refused on an acknowledged marker opens no failure episode
ok - auto-arm: a lost host hand-back notifies once per failure episode
ok - auto-arm: a lost host hand-back on an announced marker notifies once per failure episode
ok - auto-arm: a host that died without a close is retried, then reported as a failure
ok - auto-arm: --help, -h, and an unknown argument arm nothing; the Stop path still arms
ok - fm-lock: shared session-lock lib preserves the status path
ok - auto-arm: stands down only on a pi-code-delivered transcript_path (/.pi/)
bash tests/fm-claude-stop-autoarm.test.sh  8.63s user 16.03s system 38% cpu 1:03.99 total
Evidence: fm-lint on changed files

Source: fm-lint on changed files

fm-lint.sh: ShellCheck 0.11.0 (pinned 0.11.0)
fm-lint.sh: full ShellCheck extended analysis enabled
Evidence: fm-lint default run (actionlint missing)

Source: fm-lint default run (actionlint missing)

fm-lint.sh: ShellCheck 0.11.0 (pinned 0.11.0)
fm-lint.sh: local changed-file mode; ShellCheck source following disabled
fm-lint-workflows.sh: actionlint not found; install actionlint 1.7.12 with bin/fm-install-actionlint.sh <destination-directory> and put that directory on PATH.
Evidence: Previously recorded load evidence (operator-supplied, not re-run)
Before -> after pass counts. Setup: macOS arm64, 10 CPUs, bash 3.2, isolated copies of the exact functions. queue quiet 10/10 -> 10/10; queue 30 burners x4 40/40 -> 40/40; queue 20 burners + 10 forkers x8 0/40 -> 40/40; stop quiet 20/20 -> 20/20; stop 40 burners x6 60/60 -> 60/60; stop 20 burners + 60 forkers x48 173/192 -> 192/192; full files quiet after the fix 68/68 and 63/63. Negative controls (missed catch-up, watcher startup stall, hook exits before boundary, hook stalls before boundary) each fail with the intended message within 1-35s.
- Outcome: ⚠️ 1 info across 2 runs (35m38s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 info
  • ⚠️ The Test agent did not finish within its invocation budget. Reported: agent run tests timed out after 30m0s: agent last produced output 3s ago (126 observed); agent reported: claude parse events: context deadline exceeded. This is a budget or provider-slowness cut, not a code failure. Re-running the same request costs another full budget, so no further attempt is made automatically. If this repository's targeted tests or evidence gathering routinely approach the default 30m0s, raise test_agent_timeout in global config. Respond with fix to spend another budget: a repair turn runs only for selected findings other than this budget cut, then validation re-runs. Or abort and retry after raising the budget.
  • 🚨 Approval is refused: the run worktree at ~/.no-mistakes/worktrees/71dfae40363e/01M5GXWWJCNN6TN4R9BD6WB7JK holds work no Test turn validated, and the steps after Test would commit and publish it. It holds uncommitted changes to tests/.delay-base-stop.sh, tests/.delay-fix-stop.sh, tests/.loop-base-queue.sh, tests/.loop-base-stop.sh, tests/.loop-fix-queue.sh, tests/.loop-fix-stop.sh, tests/.mut-h-helper.sh, tests/.mut-q1-stalled-watcher.sh, tests/.mut-s1-never-boundary.sh, tests/.mut-s2-early-exit.sh and 2 more (inspect with git -C ~/.no-mistakes/worktrees/71dfae40363e/01M5GXWWJCNN6TN4R9BD6WB7JK status and git -C ~/.no-mistakes/worktrees/71dfae40363e/01M5GXWWJCNN6TN4R9BD6WB7JK diff). Respond with fix to validate it, or abort.

🔧 No changes applied.
1 info still open:

  • ℹ️ Default bin/fm-lint.sh exits 1 because actionlint is not on PATH. The cause is the local environment, not this change, which touches no workflow files. ShellCheck on the changed files passes. CI runs the workflow lint.
  • Live validation: ✅ go - 3 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Quiet host: the queue test's watcher catches a signal written while no watcher runs, and the full wake-queue suite passes ✅ pass live bash tests/fm-wake-queue.test.sh rc=0; log line 'ok - signal written while no watcher runs is caught on next run' (fm-wake-queue.log)
Quiet host: the Stop-hook owner-mutex contention test reaches the reset boundary, keeps successor episode state, and the full Stop-hook suite passes ✅ pass live bash tests/fm-claude-stop-autoarm.test.sh rc=0; log line 'ok - auto-arm: owner-mutex contention preserves successor episode state' (fm-claude-stop-autoarm.log)
Under CPU/fork contention, both tests pass after the fix where they failed before (queue 0/40 -> 40/40, stop 173/192 -> 192/192) ⏸️ untested no The operator told this turn not to re-run the long load loops and to cite the recorded numbers instead. To re-check, run the contention loops from a mktemp directory outside the repo.
Adversarial: a watcher that misses the catch-up, stalls at startup, or a hook that exits or stalls before the boundary still fails within a finite bound ⏸️ untested no These mutation probes ran in the previous turn and their scripts are deleted per operator guidance. They were not re-run in this turn.
Changed shell files pass the repo's ShellCheck lint ✅ pass live bin/fm-lint.sh tests/fm-wake-queue.test.sh tests/fm-claude-stop-autoarm.test.sh tests/wake-helpers.sh rc=0 (fm-lint-changed-files.log)
  • rm -f tests/.delay-*.sh tests/.loop-*.sh tests/.mut-*.sh tests/.trace-stop.sh (12 previous-turn scratch probes; git status --short is empty afterwards)
  • bash tests/fm-wake-queue.test.sh (rc=0, 68 ok, 3m13s)
  • bash tests/fm-claude-stop-autoarm.test.sh (rc=0, 63 ok, 1m04s)
  • bin/fm-lint.sh (rc=1: actionlint is not on PATH, so the workflow check stopped the run)
  • bin/fm-lint.sh tests/fm-wake-queue.test.sh tests/fm-claude-stop-autoarm.test.sh tests/wake-helpers.sh (rc=0, full ShellCheck 0.11.0 analysis)
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 1)
✅ **Push** - passed

✅ No issues found.

…nsitive tests

test_signal_catchup_without_running_watcher now starts each run's deadline
only after the launched watcher holds its singleton lock, through a bounded
wait_for_watcher_lock helper that still fails and stops a watcher that never
takes its lock. The remaining run (one poll cycle plus the fixed signal grace)
gets a finite bound sized from contention measurements; with heartbeat and
checks disabled, a watcher that misses the catch-up never exits, so it still
fails.

test_owner_mutex_contention_preserves_failure_episode_reset now ends its
reset-boundary wait on the arm handshake or the hook's own exit, failing at
once with the hook's status and output when it dies before the boundary, and
keeps a generous finite bound for a hook that stalls.

All behavioral assertions are unchanged; no production file changes.

Fixes kunchenguid#6678
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @nmmanas for picking up #6678. It's a careful, test-only fix.

Checked head dbc24571 against main df9eb03a: three test files, no runtime change. wait_for_watcher_lock starts the queue test's exit deadline only once the watcher's .watch.lock/pid names the launched pid, or the watcher has already exited. It has a finite 300×0.1s bound and stops the watcher through wait_for_exit if the lock never appears. The exit bound goes 40→150 polls, still finite. The Stop-hook wait now fails at once, with the hook's status and output, if the hook exits or zombies before arm-waiting, and the poll bound goes 50→600×0.05s. Every queue, singleton, generation and failure-episode assertion is unchanged, so a stalled watcher or failed reset still fails. That matches the acceptance list on #6678, and the body's Fixes #6678 holds.

Contract-class: restore (test-only; product behavior unchanged). VISION.md: one captain aligns (fewer false-red CI runs to triage) · authority n/a · scripts aligns (deterministic sync on a real startup event instead of a wall-clock guess) · restart n/a · delegation aligns (keeps validation trustworthy) · vendor aligns (portable fixtures) · scope aligns ("field incidents become regression coverage").

The attestation binds this head and live validation is go (3 of 5). The two load-loop and mutation-probe scenarios are cited from an earlier turn rather than re-run, which I'm fine with for a test-only change. The diff touches no workflow, network or credential surface, so I approved the first-time fork runs on this head (CI 39726363179; no-mistakes 39726363216, 39726635199).

CI: everything is green except two known flakes. Behavior portable serial 6 failed in the remote-secondmate lifecycle e2e ("watcher did not exit on its auto-relaunch wake"), which is #7629 and also red on main. Behavior portable serial 2 was cancelled at the 30-minute ceiling (#7255). Neither shard runs the two tests you changed, and those passed in serials 1, 4 and 5. I've re-run the failed jobs once.

Nothing needed from you right now. This is waiting on CI. If it comes back green and stays mergeable, it's eligible to land.

@kunchenguid
kunchenguid merged commit d46a643 into kunchenguid:main Oct 24, 2026
53 of 56 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @nmmanas — really appreciate you taking the time on this.

(Before merging I also ran both changed test files on current main d96bff00 with this change applied, since main had moved in the wake and stop-autoarm code since CI's merge ref. Both passed.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate load-sensitive startup deadlines in queue and Claude Stop-hook tests

2 participants