Skip to content

fix: reduce remote-job and supervision polling churn - #6255

Merged
kunchenguid merged 5 commits into
mainfrom
fm/fm-poll-churn-design-s1
Oct 1, 2026
Merged

kunchenguid merged 5 commits into
mainfrom
fm/fm-poll-churn-design-s1

Conversation

@kunchenguid

@kunchenguid kunchenguid commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Intent

For the Mac mini overload, no host-wide concurrency cap: fix the Firstmate poll loops per the accepted design without changing signal handling. "ship the recommended ones", narrowed to "oh actually for the overload fix i only meant 1-4".

"we should do all 4 changes in a single PR then measure the combined effect, not each individually which is hard to observe"

This one PR carries P1-P4, measured together:

  • P1: remote result and active-command waits from 50 ms to 250 ms, separate from dispatcher cadence and preserving legacy overrides, once-per-second safety checks and the existing cancellation/preemption grace.
  • P2: remote delta-reader unchanged-snapshot wait from 0.2 s to 0.5 s, preserving cursor/hash/complete-line framing and the 1 s preemption grace.
  • P3: supervision park inner exit probe from 0.1 s to 0.5 s, with direct Bash SECONDS elapsed assignment; keep the outer cadence, ownership checks, durable epochs and Bash 3.2 compatibility.
  • P4: dispatcher post-activity fast burst from 20 to four passes; keep the existing one-second quiet scan, FIFO order, cross-home concurrency and one-shot lanes.

Keep ordinary external sleeps and existing production signal handlers/dispositions. No new traps, FIFO/timed-read wait abstraction, broad fm-watch cadence change, persistent lanes, P5 or P6. Compare the combined change against main using matched idle measurements, the same heavy workload, total increments as well as rates, and latency/signal evidence; report limitations honestly.

What Changed

  • Sample active remote commands and pending results every 250 ms, preserving explicit legacy overrides; shorten the dispatcher's fast-rescan burst from 20 passes to four before its one-second quiet scan.
  • Sample unchanged remote reply logs and supervision arm exits every 500 ms; compute local park elapsed time directly from Bash SECONDS, retaining ordinary external sleeps and existing signal handlers.
  • Document sampling latency contracts and add executable regression coverage for defaults, overrides, repeated library sourcing, dispatcher bursts, reply delivery, and park sampling.

Risk Assessment

✅ Low: The combined P1–P4 change is narrowly bounded, implements the authorized latency tradeoffs, and preserves existing signal handlers, cleanup, and scheduling invariants.

Testing

Targeted real-product fixtures exercised all four changes, compatibility overrides, continuity, cancellation and boundaries. An initial reply-test setup failure came from overlapping code/home directories; normal isolated temporary paths resolved it. Stock Bash boundary/stop checks and baseline/candidate signal comparisons passed. CLI/state evidence was retained; combined host-wide measurements were not independently reproduced.

  • Live validation: ⚠️ inconclusive - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Run remote commands with default and legacy intervals while retaining bounded completion and cancellation ✅ pass live targeted-product-tests.log: actual result consumer and command lanes, repeated sourcing, deadlines, bounded output, preemption and shutdown
Append remote reply records and receive complete, non-destructive deltas at the new cadence ✅ pass live remote-reply-product.log: default/override cadence, durable captures, mirrored status and committed cursor
Truncate or replay a remote reply log without silently rebasing or duplicating replies ✅ pass live remote-reply-product.log: continuity escalation, replay deduplication and cursor-loss recovery
Park supervision with half-second probes and exit safely at its elapsed-time boundary ✅ pass live targeted-product-tests.log and stock-bash-park-and-stop.log
Dispatch queued work after four fast scans and preserve quiet-scan readiness ✅ pass live targeted-product-tests.log: four dispatcher fast waits, one-second quiet wait, readiness heartbeat and subsequent staged-job completion
Stop waiting processes without changing existing signal dispositions ✅ pass live delta-stop-comparison.json and stock-bash-park-and-stop.log
Independently verify the combined idle and identical 13-subject workload measurements against main ⏸️ untested no The permitted repository contains no archived sampler, paired streams or exact workload driver. Their supplied locations are outside the allowed project/evidence boundary. Targeted disposable fixtures…
Evidence: Initial targeted product validation, including setup failure

Source: Initial targeted product validation, including setup failure

FM_TEST_BEGIN 2026-09-30T23:32:56Z tests/fm-remote-job.test.sh family=secondmate expected_gate_skip=none
ok - default: result and command samples use 0.25 seconds; dispatcher uses four 0.05-second waits then one second
ok - legacy: result and command samples use 0.07 seconds; dispatcher uses four 0.07-second waits then one second
ok - active: result and command samples use 0.12 seconds; dispatcher uses four 0.07-second waits then one second
ok - default queue and execution bounds independently cover long polls
ok - operator PATH excludes a symlinked local bin
ok - operator PATH honors nvm defaults with a deterministic fallback
ok - operator PATH resolves the authorized Nix profile bin link
ok - operator PATH orders discovered tool installs deterministically
ok - the worker preserves bounded argv and stdin in an empty environment
ok - active jobs keep the worker ready for concurrent requests
ok - ensure replaces a live worker after its code changes
ok - worker identity binds the canonical configured code root
ok - stale ownership is reclaimed without signaling a reused pid
ok - the worker enforces the job timeout and publishes its result
ok - the worker expires queued jobs before they can mutate
ok - queued jobs receive a fresh bounded execution window
ok - a queued short command preempts a running long poll instead of waiting its window
ok - a poll re-armed after preemption reads the same cursor with nothing lost
ok - sibling polls never preempt each other into a re-arm churn loop
ok - worker shutdown terminates the active command tree before replacement
ok - Linux supervision recovers crashes and stops orphaned commands
ok - pre-execution validation obeys the job timeout
ok - the worker drains bounded output without changing command results
ok - the worker refuses symlinked job fields before command execution
ok - failed shutdown quarantines ownership against replacement workers
ok - quarantine recovery refuses unverifiable supervisors and ignores reused pids
ok - a repeatedly signalled shutdown still releases ownership for the next worker
ok - TERM after ownership loss stops the serving worker
ok - TERM after ownership loss still stops the active command tree
ok - a lost owner terminates without stopping the replacement owner's work
ok - an ousted worker in shutdown leaves the replacement quarantine untouched
ok - an idle worker sleeps out a second between passes instead of busy-polling
ok - an idle worker keeps its readiness heartbeat fresh between passes
ok - an idle worker claims and publishes a staged job within a few seconds
ok - an idle worker still repairs queue permissions and stops promptly on TERM
ok - barely healthy worker failures remain bounded by the restart guard
ALL TESTS PASSED
FM_TEST_END 2026-09-30T23:35:09Z tests/fm-remote-job.test.sh exit=0 duration_ms=132927 gate_skip=false
FM_TEST_BEGIN 2026-09-30T23:35:09Z tests/fm-remote-reply.test.sh family=secondmate expected_gate_skip=none
ok - default delta reader waits 0.5 seconds then delivers a non-destructive complete-line delta
ok - override delta reader waits 0.07 seconds then delivers a non-destructive complete-line delta
runner output:
no-result: remote-reply-ios (exit 64)
not ok - the remote reply delta was not durably captured
FM_TEST_END 2026-09-30T23:37:40Z tests/fm-remote-reply.test.sh exit=1 duration_ms=151087 gate_skip=false
FM_TEST_BEGIN 2026-09-30T23:37:40Z tests/fm-supervision-host.test.sh family=afk expected_gate_skip=none
ok - host: parked child-exit sampling uses ordinary half-second sleeps
ok - report surface: only the branch actor's current turn may report, and only on the tasks its wake names
ok - report surface: visible late outcomes queue a relay, while silent outcomes remain stored without a wake or note
ok - dispatch entry: the host reads branch eligibility, the offer rule, and the wake prompt from the Pi branch's own owner
ok - drain: BRANCH OUTCOMES runs on a Claude home by default and on another primary with the file, never with off, and never on Pi
ok - drain: captain outcomes come first, and routine overflow collapses into a count one drain clears
ok - drain: repeated captain outcomes collapse per task, and the byte cap presents only the run its acknowledgement covers
ok - drain: a long away window costs one short drain, captain outcomes collapsed per task and routine overflow counted, and nothing from it is shown again
ok - drain: the BRANCH OUTCOMES budgets count bytes, cutting multibyte summaries by whole characters in any locale
ok - drain: branch outcomes stay unread when a projection of the store fails
ok - drain: branch outcomes stay unread and the drain fails when jq is missing
ok - drain: branch outcomes stay unread when the drain cannot print them
ok - drain: a legacy backlog is presented with each outcome's age and a check-first instruction, never adopted
ok - drain: a keyed decision survives acknowledgement through a newer outcome for its task
ok - drain: an outcome carried across a switch off Pi comes back with its age, never adopted
ok - drain: an outcome nothing has shown is presented until acknowledged, and a repeated acknowledgement changes nothing
ok - drain: an outcome the host drain presented but main never acknowledged stays unprocessed across a switch to Pi
ok - drain: an outcome the host drain presented but main never acknowledged survives an outcome index repair
ok - host: an attended wake the branch may take is handled on the engine, and its routine outcome never wakes main
ok - host: an attended captain outcome wakes main once and stays in its drain until main acknowledges it
ok - host: a captain outcome recorded after the captain left waits for the return, then reaches main's drain
ok - host: a quiet record without its daemon is a present captain, so outcomes and decisions reach main
ok - host: an attended decision close stays main's exactly as the plain arm delivers it
ok - host: an off written while the host is parked sends the next attended close to main, naming the opt-out
ok - host: a main-only pass-through leaves the successor watcher running and the close undelivered for main
ok - host: an attended close whose main session cannot be identified reaches main and runs no engine turn
ok - host: a decision close accepted away whose turn starts attended still reaches main unchanged
ok - host: an attended close whose task turns main-only before its turn still reaches main unchanged
ok - host+hook: an attended main-only pass-through rewakes main and keeps its successor watcher
ok - host+hook: a captain outcome beside a quiet record rewakes the present captain with no away note
ok - host+hook: a Claude home without config/supervision-host runs the host at the default engine, and an off file restores the plain arm
ok - host+hook: a close that turns main-only at its turn rewakes main and keeps its successor watcher
ok - host+hook: failed at-turn downtime write notifies main despite a healthy successor
ok - host+hook: a successor close that lands during main's turn is delivered at the next turn end
ok - host: a primary with no verified dialog mirror keeps every attended close on main, and its away posture still runs
ok - host: each wake carries the captain's dialog since the last wake, without operational input
ok - host: the dialog mirror, its feed, and the wake file are owner-only
ok - host: dialog a turn never completed with its report (a park boundary, a stopped turn, no report) reaches the next turn
ok - host: an attended wake whose mirror is missing, cannot be read (at the feed or at the prompt), or holds a malformed entry reaches main before any engine turn, and the cursor stays put
ok - host: an away wake is handled on the engine through the branch contract and never reaches main
ok - host: an engine turn that records no outcome hands its durable wake to main
ok - host: a captain return during an engine turn hands that turn's outcomes to main
ok - host: silent outcomes are excluded from both captain-return handoff paths
ok - host: an early visible outcome survives more than 1,000 same-turn receipts
ok - host: an outcome lookup failure forces a visible main handoff
ok - host: an outcome recorded after the return reaches main even when its host dies at the turn's end
ok - host: a killed predecessor's engine is reaped and the next host removes its turn files
ok - host: a turn that reports but leaves its granted rows queued hands the wake to main
ok - host: a captain return during a failed engine turn still hands that turn's outcomes to main
ok - host: an engine turn whose result is incomplete hands its wake to main
ok - host: two engine errors latch the session, main keeps every away wake in the cooldown, a failed probe doubles it up to its cap, and a report recovers it silently
ok - host: an attended close in a latched session reaches main as the arm printed it and leaves the latch as it was, and a home that opted out with off never reads it
ok - host: attended, two engine errors latch the session, main keeps every close unchanged in the cooldown, a failed probe doubles it up to its cap, and a routine probe's recovery stays in the ledger, off main
ok - host: an engine turn is bounded, and tool processes outside its process group are reaped
ok - host: a restarted host stops, by recorded identity, the cycle a killed predecessor left running
ok - host: the park ends itself with a boundary wake and a stopped watcher
ok - host: waiting closes cannot carry the park past its boundary
ok - host: a close whose margin runs out while the successor starts reaches main at the boundary without a turn
ok - host: the park's test clock is inert without the test marker
ok - host: a park at or beyond the Stop-hook registration falls back to the default boundary
ok - host: an owner's later park limit lets a turn outlive the boundary, and no other limit does
ok - host: the first cycle's status streams once, --restart replaces a stale watcher, and an owner predecessor makes a handling successor
ok - host: an unchanged held outcome reaches the captain once across cadences, and a later decision on the task still does
ok - host: a home naming an unverified engine hands every away wake to main with the reason
ok - host: a host outside the session-lock owner stands down without arming
ok - host: a host under a superseded auto-arm generation stands down without touching the owner
FM_TEST_END 2026-09-30T23:50:20Z tests/fm-supervision-host.test.sh exit=0 duration_ms=759963 gate_skip=false
FM_TEST_SUMMARY total=3 failed=1 skipped_gate=0 duration_ms=1044107
FM_TEST_SUMMARY_FAMILY family=afk count=1 duration_ms=759963 failed=0
FM_TEST_SUMMARY_FAMILY family=secondmate count=2 duration_ms=284014 failed=1
FM_TEST_SLOWEST rank=1 script=tests/fm-supervision-host.test.sh duration_ms=759963
FM_TEST_SLOWEST rank=2 script=tests/fm-remote-reply.test.sh duration_ms=151087
FM_TEST_SLOWEST rank=3 script=tests/fm-remote-job.test.sh duration_ms=132927
Evidence: Successful reply relay with source records, mirrored records and committed cursor

Source: Successful reply relay with source records, mirrored records and committed cursor

FM_TEST_BEGIN 2026-09-30T23:51:14Z tests/fm-remote-reply.test.sh family=secondmate expected_gate_skip=none
ok - default delta reader waits 0.5 seconds then delivers a non-destructive complete-line delta
ok - override delta reader waits 0.07 seconds then delivers a non-destructive complete-line delta
ok - a blocking non-destructive remote delta reaches durable process-event capture
ok - a captured delta is applied, acknowledged, and re-armed without a handler
ok - ingest appends one validated line, fetches its document, and advances the cursor
ok - replayed capture has one deduplicated append and one durable handling identity
ok - later generations cannot invalidate an unacknowledged ingested result
ok - the remote status and decision model mirrors and the cursor advances
ok - a remote mate's new decision folds open exactly as a local mate's does
ok - a replayed mirrored delta is idempotent in both the stream and the cursor
Remote source status records:
done [corr=0123456789abcdef] [at=1700000000]: build verified report=data/reply/report.md
working [corr=1111111111111111]: second generation
done [corr=2222222222222222]: third generation
working [key=version-audit]: family --version audit complete (data/reply/prose-only.md)
needs-decision [key=rough-cut-version]: implement --version or retire the tool
needs-decision [at=1700000000]: which base branch?
needs-decision [at=1700086400]: which base branch?
done [corr=19389615daa3359d]: release chain audited

Parent status after handling and replaying generation 4:
done [corr=0123456789abcdef] [at=1700000000]: build verified report=data/remote-secondmates/ios/data/reply/report.md
working [corr=1111111111111111]: second generation
done [corr=2222222222222222]: third generation
working [key=version-audit]: family --version audit complete (data/reply/prose-only.md)
needs-decision [key=rough-cut-version]: implement --version or retire the tool
needs-decision [at=1700000000]: which base branch?
needs-decision [at=1700086400]: which base branch?
done [corr=19389615daa3359d]: release chain audited

Committed remote cursor:
schema=fm-remote-reply-cursor.v1
offset=508
prefix_sha256=4471deaeddf4c49897b7fd362615b59f7615029b219f52825a2bbd501fed304e
ok - transported control bytes are normalized in place and never stop the stream
ok - payload protocol-field names cannot collide with transport metadata
ok - NUL bytes are normalized in place before shell line processing
ok - local document storage failures remain retryable until delivery succeeds
ok - a structured pointer must end at its token boundary
ok - adjacent pointers are fetched while malformed tokens remain unchanged
ok - a rejected candidate never gives the following text a false leading boundary
ok - nested remote reports relay while an undeliverable foreign pointer fails open
ok - the reported incident raises no standing decision and still delivers the report
ok - an undeliverable structured offer fails open with one note and never a decision
ok - a remote refusal surfaces its own reason without opening a decision
ok - a failed pointer extraction never commits a partial delta
ok - a failed mirror write never drops status content or advances the cursor
ok - source-line identity survives commit failure and cursor-loss recapture
ok - a mirrored reserved-key line cannot squat or clear the parent's own decision
ok - a reply that arrives after escalation resolves it and clears the open decision
Continuous listener: owner=live pid=41986 polls=3; mirrored status: working [corr=abcdefabcdefabcd]: held across an empty wait
ok - a remote reply listener stays owned across empty waits and a delta
ok - a failed remote read exits instead of relistening
ok - persistent ingestion failure leaves exactly one durable capture
ok - a preempted reply poll reports a closed window without publishing channel freshness
ok - a preempted reply poll keeps its listener and reconcile launches nothing
ok - a quiet reply window publishes the caught-up watermark the reply guard reads
ok - a cursor-loss whole-log recapture is acknowledged quietly with no duplicate wake

New continuity escalation after ingest retry:
blocked [key=remote-reply-continuity-ios] [at=1790812487]: remote reply continuity broke for ios (truncated)
ok - truncation is detected, escalated once, and not silently rebased
ok - remote reply retirement quiesces and refuses unhandled captured results
ALL TESTS PASSED
FM_TEST_END 2026-09-30T23:54:49Z tests/fm-remote-reply.test.sh exit=0 duration_ms=214384 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=214449
FM_TEST_SUMMARY_FAMILY family=secondmate count=1 duration_ms=214384 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-remote-reply.test.sh duration_ms=214384
Evidence: Stock Bash uninjected park boundary and stop cleanup

Source: Stock Bash uninjected park boundary and stop cleanup

Stock Bash: GNU bash, version 3.2.57(1)-release (arm64-apple-darwin25)
Uninjected park elapsed wall seconds=14 rc=0 watcher_lock_exists=no
watcher: started pid=38998 (beacon fresh)
supervision-host: cycle boundary - the host ended its park at its bound; drain, acknowledge, and end the turn, and the next park starts on its own
1790812572	start	gen=host-38818-1790812572	primary=claude
1790812585	boundary	after 13s
PID TERM host exit=143 elapsed_seconds=1 watcher_lock_exists=no
1790812585	start	gen=host-44334-1790812585	primary=claude
PID HUP host exit=129 elapsed_seconds=0 watcher_lock_exists=no
1790812586	start	gen=host-46693-1790812586	primary=claude
Evidence: Baseline/candidate native macOS delta-reader signal outcomes

Source: Baseline/candidate native macOS delta-reader signal outcomes

{
  "platform": "macOS native Bash 3.2",
  "signal_outcomes_match": true,
  "results": [
    {
      "variant": "main",
      "scope": "pid",
      "signal": "SIGTERM",
      "cadence": "0.2",
      "survived_initial_signal": false,
      "exit": 75,
      "stop_ms": 304,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": ""
    },
    {
      "variant": "main",
      "scope": "pid",
      "signal": "SIGHUP",
      "cadence": "0.2",
      "survived_initial_signal": false,
      "exit": -1,
      "stop_ms": 236,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": ""
    },
    {
      "variant": "main",
      "scope": "pid",
      "signal": "SIGINT",
      "cadence": "0.2",
      "survived_initial_signal": true,
      "exit": 75,
      "stop_ms": 2015,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": "Terminated: 15\n"
    },
    {
      "variant": "main",
      "scope": "pid",
      "signal": "SIGQUIT",
      "cadence": "0.2",
      "survived_initial_signal": false,
      "exit": -3,
      "stop_ms": 228,
      "remaining_delta_dirs": 1,
      "stdout": "",
      "stderr": ""
    },
    {
      "variant": "main",
      "scope": "group",
      "signal": "SIGTERM",
      "cadence": "0.2",
      "survived_initial_signal": false,
      "exit": 75,
      "stop_ms": 13,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": "Terminated: 15\n"
    },
    {
      "variant": "main",
      "scope": "group",
      "signal": "SIGHUP",
      "cadence": "0.2",
      "survived_initial_signal": false,
      "exit": -1,
      "stop_ms": 12,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": "~/.no-mistakes/worktrees/52b07e9083e7/01M3TAGA8KQHR2S3R9BCFNPX0G/.test-tmp/delta-proof/baseline.sh: line 189: 75218 Hangup: 1               sleep \"$POLL_SECONDS\"\n"
    },
    {
      "variant": "main",
      "scope": "group",
      "signal": "SIGINT",
      "cadence": "0.2",
      "survived_initial_signal": false,
      "exit": -2,
      "stop_ms": 11,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": ""
    },
    {
      "variant": "main",
      "scope": "group",
      "signal": "SIGQUIT",
      "cadence": "0.2",
      "survived_initial_signal": false,
      "exit": -3,
      "stop_ms": 2,
      "remaining_delta_dirs": 1,
      "stdout": "",
      "stderr": ""
    },
    {
      "variant": "candidate",
      "scope": "pid",
      "signal": "SIGTERM",
      "cadence": "0.5",
      "survived_initial_signal": false,
      "exit": 75,
      "stop_ms": 597,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": ""
    },
    {
      "variant": "candidate",
      "scope": "pid",
      "signal": "SIGHUP",
      "cadence": "0.5",
      "survived_initial_signal": false,
      "exit": -1,
      "stop_ms": 647,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": ""
    },
    {
      "variant": "candidate",
      "scope": "pid",
      "signal": "SIGINT",
      "cadence": "0.5",
      "survived_initial_signal": true,
      "exit": 75,
      "stop_ms": 2008,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": "Terminated: 15\n"
    },
    {
      "variant": "candidate",
      "scope": "pid",
      "signal": "SIGQUIT",
      "cadence": "0.5",
      "survived_initial_signal": false,
      "exit": -3,
      "stop_ms": 621,
      "remaining_delta_dirs": 1,
      "stdout": "",
      "stderr": ""
    },
    {
      "variant": "candidate",
      "scope": "group",
      "signal": "SIGTERM",
      "cadence": "0.5",
      "survived_initial_signal": false,
      "exit": 75,
      "stop_ms": 14,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": "Terminated: 15\n"
    },
    {
      "variant": "candidate",
      "scope": "group",
      "signal": "SIGHUP",
      "cadence": "0.5",
      "survived_initial_signal": false,
      "exit": -1,
      "stop_ms": 9,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": "~/.no-mistakes/worktrees/52b07e9083e7/01M3TAGA8KQHR2S3R9BCFNPX0G/bin/fm-remote-delta-read.sh: line 194: 76515 Hangup: 1               sleep \"$POLL_SECONDS\"\n"
    },
    {
      "variant": "candidate",
      "scope": "group",
      "signal": "SIGINT",
      "cadence": "0.5",
      "survived_initial_signal": false,
      "exit": -2,
      "stop_ms": 13,
      "remaining_delta_dirs": 0,
      "stdout": "",
      "stderr": ""
    },
    {
      "variant": "candidate",
      "scope": "group",
      "signal": "SIGQUIT",
      "cadence": "0.5",
      "survived_initial_signal": false,
      "exit": -3,
      "stop_ms": 1,
      "remaining_delta_dirs": 1,
      "stdout": "",
      "stderr": ""
    }
  ]
}
- Outcome: ⚠️ 2 warnings across 1 run (27m14s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 2 warnings
  • ⚠️ Functional validation passed, but the required combined churn comparison remains supported only by the attached narrative. Its raw measurements, sampler, and workload driver are outside the permitted workspace. Supply those artifacts within this run's evidence directory to independently verify the idle reduction and the heavy-run duration/total-increments caveat.
  • ⚠️ live validation verdict: inconclusive (6 of 7 scenarios were driven live against the product); untested: Independently verify the combined idle and identical 13-subject workload measurements against main
  • Live validation: ⚠️ inconclusive - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Run remote commands with default and legacy intervals while retaining bounded completion and cancellation ✅ pass live targeted-product-tests.log: actual result consumer and command lanes, repeated sourcing, deadlines, bounded output, preemption and shutdown
Append remote reply records and receive complete, non-destructive deltas at the new cadence ✅ pass live remote-reply-product.log: default/override cadence, durable captures, mirrored status and committed cursor
Truncate or replay a remote reply log without silently rebasing or duplicating replies ✅ pass live remote-reply-product.log: continuity escalation, replay deduplication and cursor-loss recovery
Park supervision with half-second probes and exit safely at its elapsed-time boundary ✅ pass live targeted-product-tests.log and stock-bash-park-and-stop.log
Dispatch queued work after four fast scans and preserve quiet-scan readiness ✅ pass live targeted-product-tests.log: four dispatcher fast waits, one-second quiet wait, readiness heartbeat and subsequent staged-job completion
Stop waiting processes without changing existing signal dispositions ✅ pass live delta-stop-comparison.json and stock-bash-park-and-stop.log
Independently verify the combined idle and identical 13-subject workload measurements against main ⏸️ untested no The permitted repository contains no archived sampler, paired streams or exact workload driver. Their supplied locations are outside the allowed project/evidence boundary. Targeted disposable fixtures…
  • git diff fd325b1 a2578fe -- bin tests and repository testing-rule inspection
  • TMPDIR="$PWD/.test-tmp" bin/fm-test-run.sh --jobs 1 tests/fm-remote-job.test.sh tests/fm-remote-reply.test.sh tests/fm-supervision-host.test.sh
  • FM_TEST_EVIDENCE=1 bin/fm-test-run.sh --jobs 1 tests/fm-remote-reply.test.sh
  • TMPDIR="$PWD/.test-tmp" /bin/bash tests/.poll-live-validation.sh: uninjected 12-second park boundary and PID-directed TERM/HUP cleanup
  • python3 .test-tmp/delta-proof/drive.py: baseline/candidate delta-reader PID/group TERM, HUP, INT and QUIT comparison under stock macOS Bash 3.2
  • Reviewed attached measurement claims without treating them as independently verified results; removed disposable drivers and fixture directories
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Combined measurement provenance and validation boundary

The implementing worker collected the idle-pair and 13-test heavy-run measurements outside the validation pipeline, against main 23e5584714e6765cc223a1740d385d0e85f8ad8e. The pipeline later rebased the four existing implementation/fix commits unchanged onto main fd325b1ba16b0caa2c19fa0992b130bacba0dca8, then added its documentation update; these measurements are not relabeled as captures against the later main head.

Across three matched pairs using identical isolated idle-fleet fixtures, every candidate window mean was lower: median pidversion rate fell 9.2% (2,740.54 -> 2,489.23 increments/s) and median forks fell 8.1% (1,670.76 -> 1,535.71/s). These are host-wide counters under the matched fixture workload, not a production rollout or a deployment-wide performance guarantee. Both 13-test heavy runs passed, but their mean pidversion rate fell only 1.5% (3,813.85 -> 3,754.89/s) while total increments rose 2.5% (5,827,560 -> 5,974,037). The heavy-run data do not establish an aggregate work reduction.

Evidence is retained in the private task report /Users/kunchen/fm-homes/fmdev-f1/data/fm-poll-churn-design-s1/report.md and the implementing copy's /Users/kunchen/.treehouse/fmdev-f1-8bf1b0/9/fmdev-f1/data/fm-poll-churn-design-s1/combined/ directory, including idle-results.json, heavy-results.json, raw counter streams, exact procedures, latency distributions and signal outcomes. Raw process-argument captures are not published here.

The pipeline's live validation covered 6 of 7 scenarios and did not independently verify these historical measurement artifacts. Reuse of the implementing worker's evidence without reloading the scarce host was explicitly approved as a Test exception; it is not a claim that all seven scenarios were independently validated. Linux signal cases were not run because no Linux host exists here. macOS Bash 3.2 and PATH Bash signal evidence, and Linux-platform overrides exercised on macOS, are not native Linux signal proof.

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adjusts polling intervals in remote job and supervision systems.

The PR appears safe to merge based on the reviewed changes.

Reviews (4) · Last reviewed commit: "no-mistakes(document): Clarify poll late..."

…ns documenting intentional subshell-local legacy and active cadence overrides in tests/fm-remote-job.test.sh. Runtime behavior is unchanged. Reproduced the lint failure before the fix; afterward ShellCheck 0.11.0 with source following, Bash syntax validation, the complete remote-job behavior suite, and git diff --check all passed
@kunchenguid
kunchenguid force-pushed the fm/fm-poll-churn-design-s1 branch from 764f01f to b461423 Compare October 1, 2026 00:04
@kunchenguid kunchenguid changed the title fix: reduce remote-job active and result polling churn fix: reduce remote-job and supervision polling churn Oct 1, 2026
FM_REMOTE_JOB_SUPERVISOR_MAX_BACKOFF_SECONDS=$(worker_bounded_setting "${FM_REMOTE_JOB_SUPERVISOR_MAX_BACKOFF_SECONDS:-}" 5)
FM_REMOTE_JOB_SUPERVISOR_HEALTHY_SECONDS=$(worker_bounded_setting "${FM_REMOTE_JOB_SUPERVISOR_HEALTHY_SECONDS:-}" 10)
WORKER_FAST_PASSES=20
WORKER_FAST_PASSES=4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Separate cadence changes bundled The accepted Intent makes this the independent P1 change and reserves P2–P4 for separate PRs. Reducing the dispatcher burst from 20 passes to four implements P4 here; this changeset also slows remote-reply sampling from 0.2 to 0.5 seconds and changes supervision-park sampling and its elapsed clock. These changes alter dispatch, reply, and close-observation latency outside P1, preventing the requested independent review and measurement of each part. Please move P2–P4 into their own PRs.

Context Used: If there is a VISION.md file at the root of the repo, the PR must not conflict / diverge / drift from it. If the PR description has an "Intent" section, respect that as the accepted user intent. - Do make comments if anything in the implementation ... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@kunchenguid

Copy link
Copy Markdown
Owner Author

@greptileai please re-review - the Intent section was corrected: the captain directed P1-P4 as one combined PR measured together, so bundling P2-P4 here is intended.

@Jack-EdRSR

Copy link
Copy Markdown

@kunchenguid Would you say using greptileai is a game changer for code quality purposes?