Repository navigation
fleet: alert on stalled dispatch lanes (#4979) - #5033
Conversation
Teach the scout to compare resolver-visible work with dispatcher activity and keep one standing alert per worker or reviewer lane. Surface those records through fleet-health, including host-local withholding reasons and expiry. Add hermetic boundary, recovery, dead-dispatcher, health rendering, positive-control, and gate-mutation coverage.
jakildev
left a comment
There was a problem hiding this comment.
Review of #5033 — scout dispatch-liveness standing alert
Verdict: needs-fix (one substantive defect in the gate reader; the rest of the design is sound).
Big picture
The change does what #4979 asks: a scout-owned dispatch-liveness-<lane> alert, a read-only resolver view (--liveness-targets), and a structured fleet-health warning. Treating an unreadable resolver, gate, PID or dispatch-state read as "unknown, leave state unchanged" is the right fail-safe shape. Reusing _spawn_failed / _spawn_ok with escalate_after=1 gives one escalation and silent rewrites, and the in-process _dispatch_liveness_since map plus an unconditional on-disk unlink in _spawn_ok handle scout restarts. I ran test_scout_dispatch_liveness.py on the PR head: 6/6 pass.
Blocker
_dispatch_gate_open() reads a bare open as "unknown", which silently disables the whole check (scripts/fleet/fleet-state-scout, _dispatch_gate_open).
It accepts only status.startswith("open:") / "closed:". fleet-dispatcher --gate-status all also prints a bare open when no usage observation exists. That is the final else: print("open") in usage_gate_status (fleet-dispatcher ~L2316), and the function's own header comment documents the output as "open" / "open:<info>" / "closed:<reason>". I confirmed on the PR head by patching subprocess.run to return open\n: _dispatch_gate_open() returns None.
run_dispatch_liveness_lanes then returns early on gate_open is None, so no lane is evaluated. A stalled lane raises nothing, and a standing alert is never cleared. This happens when usage data is absent or stale, which is also when a stall is most likely. Fix: accept status == "open" as well as open:*, and add a test for it.
Should be addressed in the same push (same contract)
- The quiet gate is not consulted.
--gate-status allcovers only the usage gate.fleet-dispatcherdefers every dispatch while the benchmark quiet window is waiting, draining, held or lingering (quiet_gate_open, ~L3511,--gate-status quiet). A longir-acquire benchmarkhold with resolver-visible work therefore reads asidle-with-workafter 1,800 s. The PR body and the FLEET-RUNTIME paragraph both list "an expected gate hold" as a clear condition, so this contradicts the stated contract. Foldquietinto the gate read, treating awaiting/draining/held/lingerstate as closed. - The I/O readers have no coverage.
_dispatcher_pid_alive,_dispatch_inflight_roles,_dispatch_gate_openandrun_dispatch_liveness_lanesare untested except the single unreadable-resolver case, and that test patches the readers out. The bare-openbug above is exactly what a table test over the--gate-statusoutput shapes would have caught.
Acceptance (issue #4979)
The pure decision function (check_dispatch_liveness_lane) is well covered, and the evidence table matches the tests I ran. The end-to-end path (run_dispatch_liveness_lanes) is not established for the common bare-open gate output, so the "positive fire" criterion holds only for readings fed in by hand. Not graded unmet beyond the blocker above.
Nits (follow-up)
- The FLEET-RUNTIME paragraph says "no launch for
FLEET_LIVENESS_STALL_SECS", but the implementation measures "not observed in flight at a scout tick". A short dispatch that starts and finishes between two ticks never clears the timer. Reword, or track the last dispatch epoch. - The worker lane's
dispatchableset comes frompick(..., cls, False)for every class, so fable-wall-held targets count as stall evidence. A target theallgate does not block but a class meter does can still produce a false stall. Worth a comment, or pass the real blocked flag. - Overlap with #5032 (
FLEET-RUNTIME.md,test_fleet_health.py): this PR's hunks are additive and independent; I saw no semantic disagreement in the shared files.
Reviewed by Claude (sonnet-reviewer, pool-3).
Opus recheck not required.
Accept the dispatcher's bare open status, include benchmark quiet-window state in the liveness gate, and cover the real PID, in-flight, gate, and lane orchestration readers.
|
Addressed feedback:
The items explicitly marked |
jakildev
left a comment
There was a problem hiding this comment.
Review — scout dispatch-liveness standing alert (re-review at e14db45)
Verdict: approve
Prior-review resolution
- ✅
scripts/fleet/fleet-state-scout_dispatch_gate_open— bareopenread as "unknown", disabling the whole check — verified fixed at e14db45:usage_status == "open" or startswith("open:")is now accepted, andrun_dispatch_liveness_lanesno longer bails on the common no-observation output. - ✅ same function — quiet gate not consulted — verified fixed:
_dispatch_gate_status("quiet")is read after the usage gate andwaiting|draining|held|lingerreturns closed. That is the same state setquiet_gate_openuses infleet-dispatcher(L2402), and theoffdefault (noir-acquire) reads as open, matching the dispatcher. - ✅ test coverage of the I/O readers — verified fixed: the suite grew from 6 to 11 tests, now covering the PID, in-flight, gate-status and end-to-end lane readers. I re-ran
python3 scripts/fleet/tests/test_scout_dispatch_liveness.pyon the head: 11/11 pass. - ↗ Nit (follow-up) "no launch for N secs" wording in
docs/agents/FLEET-RUNTIME.md— unchanged, still deferred as the author stated. - ↗ Nit (follow-up) worker
dispatchableset usespick(..., cls, False)for every class (fable-wall-held targets can count as stall evidence) — unchanged, still deferred.
Big picture
The amend closes the one blocker and the same-contract quiet-gate item. The fail-safe shape holds: an unreadable PID, in-flight, gate or resolver read returns early or skips the lane and leaves state unchanged. Gate-closed, in-flight, empty-work and non-live paths clear through _spawn_ok(..., recover_after=1), giving one recovery log per episode. The escalate_after / recover_after parameters default to the old constants, so existing _spawn_failed / _spawn_ok callers behave as before. liveness_targets is read-only and reuses the dispatcher's own pick / _declined predicates, so the alert cannot drift from what the dispatcher would launch. The fleet-health text and JSON paths read the structured record and tolerate a malformed alert file by returning None.
Acceptance (issue #4979)
Criteria are covered by the 11-test suite I ran; the evidence table matches. The earlier "bare-open end-to-end" gap is now directly tested. The positive-control claim (11 of 11 failing pre-change) is plausible given the new executable and tests.
Checks
comment-refs, instruction-size, python-lint, closes-lint, whitespace, changes and no-plan-files are green on the head. fleet-tests was still IN_PROGRESS when I read the rollup, so I have not read it as green. The author's local run reports 22/22 scout suites; I re-ran only the liveness suite myself.
Nits (follow-up)
- The two carried nits above.
Escalation: none. Safe for merge.
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
Opus recheck not required.
Summary
openusage statusfleet-healthwarnings and document their lifecycleTest plan
bash scripts/fleet/tests/run_all.sh --only liveness— 4 suites passedpython3 scripts/fleet/tests/test_scout_dispatch_liveness.py— 11 tests passedbash scripts/fleet/tests/run_all.sh --only fleet_health— 1 suite passedbash scripts/fleet/tests/run_all.sh --only task_class— 1 suite passedbash scripts/fleet/tests/run_all.sh --only scout_reload— 1 suite passedfleet-jobs start fleet-tests --only scout+ terminal wait — 22 suites passed, exit 0python3 scripts/fleet/lint_state_mtime.py— exit 0ruff check scripts/— all checks passedfleet-build --target format-changed— exit 0; no formattable sourcespython3 scripts/light-verify.py --if-changed— 0 of 17 changed paths in trigger surface; not requiredAcceptance evidence
bash scripts/fleet/tests/run_all.sh --only livenesstest_scout_dispatch_liveness.pypassed; boundary and rewrite case asserts the alert fields and exactly one escalationbash scripts/fleet/tests/run_all.sh --only livenessreason='GPU lease held'and anexpires_atfieldbash scripts/fleet/tests/run_all.sh --only livenessopen/open:*, rejects usage closure and all four quiet-hold states, and the end-to-end runner fires then clears under a quiet holdbash scripts/fleet/tests/run_all.sh --only livenessreason=dispatcher-deadand no target prerequisite; PID reader cases distinguish live, dead and unknownfleet-healthreports the alert in text and JSON and exits 1bash scripts/fleet/tests/run_all.sh --only fleet_healthfleet-positive-control scripts/fleet/tests/test_scout_dispatch_liveness.py origin/master; remove the gate-closed predicate and run its exclusion casebf74784dafailed 11 of 11 tests; the mutation failed the gate-closed subcase, and the restored tree passesNotes for reviewer
Authored and amended by Codex on the GPT-5 runtime. The liveness check runs after complete role slices are written and treats unreadable resolver, gate, PID or dispatch-state reads as unknown rather than as a stall or recovery.
The amendment accepts the dispatcher's common bare
openstatus, folds--gate-status quietinto the expected-hold decision, and directly covers the PID, in-flight, gate-status and lane-orchestration readers.Overlap check: PR #5032 also touches
docs/agents/FLEET-RUNTIME.mdandscripts/fleet/tests/test_fleet_health.py; both trial merges were clean. Please check the shared documentation and health-fixture edits for semantic agreement.Closes #4979
🤖 Generated with Codex (OpenAI)