Skip to content

test: deflake remote watcher relaunch and worker crash legs in serial 5 shard - #47

Merged
ductiletoaster merged 4 commits into
mainfrom
fm/op-ci-serial5-watcher
Nov 2, 2026
Merged

ductiletoaster merged 4 commits into
mainfrom
fm/op-ci-serial5-watcher

Conversation

@ductiletoaster

@ductiletoaster ductiletoaster commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Intent

Fix the failing main CI shard "Behavior portable serial 5" through the normal operator delivery path; include before/after flake numbers in the PR. The operator merges.

The failure is tests/fm-remote-secondmate-lifecycle-e2e.test.sh: "not ok - the watcher did not exit on its auto-relaunch wake within the bound: check: secondmate ios auto-relaunched after remote endpoint dead on its configured host (host=remote-mac)". It fails on main pushes 1bd463e (run 40746203515) and ef0565a (run 40564108103), and on PR #43 (run 40761736917, two attempts). Main run 40746203515 also showed "not ok - the replacement adopted an unrelated persisted pid" in the same shard.

Later decision on the PR's fork-contract A4 failure (both changed tests are inherited upstream files): option A. Write a new ADR plus an A4 allowlist entry covering both changes: the upstream e2e watcher hunk carried verbatim (kunchenguid/firstmate 3004ccb), and our local remote-job pid-adoption fix, to be offered upstream later through the normal path (do not publish upstream now). Follow the ADR-0021 shape (Deciders: the operator; self-retiring at the next upstream sync). Keep the PR on its normal delivery path until CI is green; the operator merges.

Before/after flake numbers

Measured by the implementing worker outside the pipeline's test phase (the pipeline's own local run on a loaded macOS host could not reach the changed legs; see Testing below).

Evidence Before (base 45c9d5d) After (this branch)
CI history, last 60 pixeloven/operator CI runs "Behavior portable serial 5" failed 9 of 48 completed jobs (18.8%); all 9 on the watcher auto-relaunch bound, one (run 40746203515) also on the persisted-pid leg this PR's serial 5 shard is the confirmation
Full fm-remote-secondmate-lifecycle-e2e.test.sh, Ubuntu 24.04 container, 4 CPUs 12/12 pass; watcher leg wall time 28-34 s against the old 30 s window 12/12 pass; window is now 150 s (120 s relaunch bound + 30 s)
Same, 2 CPUs (slow-runner emulation) 9/9 pass; leg 28-30 s 9/9 pass
fm-remote-job.test.sh, Ubuntu container 20/20 pass (the natural race is rare: 1 of 48 CI jobs) 16/16 pass
fm-remote-job.test.sh with one injected readiness touch after the leg backdates worker.ready (deterministic counterfactual) fails 3/3 with "the replacement adopted an unrelated persisted pid"; 2-3 worker processes (supervisor, heartbeat) survive the child-only kill 0 worker processes survive the whole-group kill (3/3)

The containers never reproduced the watcher timeout itself: the leg sits right at the old window (its relaunch has a ~27-28 s floor - an xtrace shows 20 of its 24 s in ~16 sequential remote-job round trips of ~1.25 s each pushing inherited config), so CI's runner variance is what tips it over. That margin, not a watcher regression, is the cause; the watcher's own production bound is 120 s.

Diagnosis:

  • Watcher leg: test bound too tight. Upstream kunchenguid/firstmate hit the same failure and fixed it in 3004ccb (#7518) after first raising the loop to 3000 in ac8a767 (#7466); the first commit here carries 3004ccb's hunk verbatim.
  • Persisted-pid leg: a separate cause - a test-fixture race with the crashed worker's surviving supervisor and readiness heartbeat. Upstream has no fix (its test file is identical).

Fork contract: both test files are inherited upstream paths, so ADR-0025 (accepted by the operator, ADR-0021 shape) lists them on the A4 allowlist until an upstream synchronization brings each change; the e2e hunk is upstream 3004ccb byte-identical, and the fm-remote-job hunk is local, to be offered upstream later.

What Changed

  • tests/fm-remote-secondmate-lifecycle-e2e.test.sh: carries upstream's watcher auto-relaunch hunk (kunchenguid/firstmate@3004ccb107) unchanged. It sets FM_SECONDMATE_LIVENESS_TIMEOUT=120 on the watcher. The test then waits that long plus 30s of wall-clock headroom. Before, it used a fixed loop of about 30s (1500 × 0.02s), which a slow runner could hit even when the watcher would still have accepted the relaunch.
  • tests/fm-remote-job.test.sh: the stale-ownership leg now kills the crashed worker's whole process group, not just the serving child. It waits up to 10s for the group to exit and fails if it doesn't. This stops the restart supervisor and readiness heartbeat from refreshing readiness or republishing ownership after the leg plants its stale records. This fix is local and is not proposed upstream yet.
  • Adds ADR-0025 (Accepted, Deciders: the operator) as the fork-contract exception for those two inherited tests. It retires itself once an upstream sync brings equivalent changes. Adds fm-remote-job and fm-remote-secondmate-lifecycle-e2e to the A4 allowlist in .github/workflows/pixeloven-gates.yml. Updates docs/pixeloven/identity.md so its copy of the A4 regex matches the gate again, which also adds the fm-pr-merge entry it was missing from ADR-0023. Updates the ADR exception lists in identity.md and fork-contract.md, the ADR index, and docs/documentation-audiences.json. No product scripts change.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change touches only tests and docs, and the gate edit only adds two names to its allowlist. Both test fixes use the product's own bounds and helpers: FM_SECONDMATE_LIVENESS_TIMEOUT, which bin/fm-watch.sh:375 reads, and fm_remote_job_worker_process_group, which refuses the test shell's own process group. The lines the e2e hunk adds match upstream 3004ccb exactly, and the regex in identity.md matches the one in the gate.

Testing

The Test agent exceeded its invocation budget before live validation completed; no evidence was gathered for this head.

  • Outcome: ⚠️ 1 warning across 1 run (30m3s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 warning
  • ⚠️ The Test agent did not finish within its invocation budget. Reported: agent run tests timed out after 30m0s: agent last produced output 2s ago (72 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.
✅ **Document** - passed

✅ No issues found.

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

✅ No issues found.

Firstmate Autonomous Worker and others added 4 commits October 30, 2026 13:40
…unch timeout

The ordinary-supervision leg of tests/fm-remote-secondmate-lifecycle-e2e.test.sh
gave the watcher a fixed 30-second wall clock to probe, relaunch through the
guarded remote spawn, wake, and exit, while the watcher itself bounds that
relaunch at FM_SECONDMATE_LIVENESS_TIMEOUT (120s). Passing CI legs already ran
30-35 seconds, so a slow runner failed a relaunch the watcher still accepted.

Carries upstream kunchenguid/firstmate's fix from 3004ccb (#7518)
verbatim: pin the watcher's relaunch timeout and wait that bound plus 30s of
probe headroom on SECONDS.
The stale-ownership leg killed only the serving worker child, leaving its
detached restart supervisor and readiness heartbeat loop running. A heartbeat
touch landing after the leg backdated worker.ready made ensure_worker see a
fresh, identity-matching readiness and return before the replacement published
its pid, so worker.pid still held the planted unrelated pid ("the replacement
adopted an unrelated persisted pid").

Kill the worker's isolated process group and wait for it to empty before
planting the stale records, so nothing from the crashed tree can refresh
readiness or republish ownership afterwards.
…on assertion A4. That assertion requires every path that differs from the upstream pin to sit in a PixelOven namespace or on an ADR-approved allowlist. This PR edits two inherited upstream tests, tests/fm-remote-job.test.sh and tests/fm-remote-secondmate-lifecycle-e2e.test.sh, and neither was on the list. The failure comes from this PR's own change. I fixed it the way the repo handled ADR-0023 and ADR-0024: - Added docs/adr/0025-remote-test-timing-deflake.md, with status Proposed so the operator can accept it. It names exactly those two test files and the bounded change each may carry, and says the carry ends when an upstream sync brings an equivalent change. - Added fm-remote-job and fm-remote-secondmate-lifecycle-e2e to the A4 allowlist in .github/workflows/pixeloven-gates.yml. - Brought the copy of the A4 regex in docs/pixeloven/identity.md back in line with the gate. It was already missing fm-pr-merge from ADR-0023, so I added that too, and updated its list of ADR exceptions. - Updated the list of ADR exceptions in docs/pixeloven/fork-contract.md and added an ADR-0025 line. - Added the new ADR to the index in docs/adr/README.md and to docs/documentation-audiences.json. Checked locally: - With the new ADR included, running the gate's own A4 regex against the diff from the pin leaves no paths. - The regex in identity.md is byte-identical to the one in the gate. - The new ADR has no capitalized "Operator", "firstmate" or pixeloven/ URL, so A1–A3 still hold. - bin/fm-doc-audience-check.sh passes, and so does tests/fm-documentation-audiences.test.sh. - The audiences JSON parses. Not done: actionlint isn't installed here, so it wasn't run; the workflow change only adds two names to the regex. The two test files and all product code are unchanged
…serial 5 test fixes

Record the operator's decision (option A): the e2e watcher-relaunch hunk is
upstream 3004ccb carried byte-identical, and the fm-remote-job crash-fixture
hunk is local, to be offered upstream later through the normal path. Each path
retires from the A4 allowlist when an upstream synchronization brings it.
@ductiletoaster
ductiletoaster merged commit 1aaf68c into main Nov 2, 2026
42 of 44 checks passed
@ductiletoaster
ductiletoaster deleted the fm/op-ci-serial5-watcher branch November 2, 2026 21:13
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.

1 participant