Repository navigation
impl(fleet): machine watchdog — per-machine health reporting for amd-6 (#2179 §1.5) - #12758
Merged
Merged
Conversation
#2179 §1.5) scripts/fleet-machine-watchdog.py is the writer §3 names for the registry health cache: it probes each machine (fleet-shell transport from the sandbox seat, or local on-host), computes the §1.5 minimum record — reachable (SSH + OpenCode server), load headroom vs declared cores, disk headroom on the worktree volume, server session count via the on-host OpenChamber attach API, last successful queue job from the queue store — and rewrites ONLY the health block, preserving every other byte. Health is earned: each check is ok/failed/unknown with a reason, healthy requires every gating check ok, and last_seen (the last actual sighting) never advances on a run that could not reach the machine, so staleness accrues and readers demote per §1.5/§4. The validator now enforces the earning rules: a non-unknown status or a non-null last_seen without the full checks record is a fabricated pass and fails (fail-before: pristine validator accepted a bare hand-written status: healthy). First real record, written by the watchdog itself: amd-6 is degraded — disk headroom failed (197 GiB free of 3,371 GiB, 5.8%); reachable, load (0.46/core), sessions, and last queue job (task 20095, done 2026-11-23T01:20:25Z) all ok. Declared state untouched: amd-6 was already active via §2; no machine is activated by this change. Tests: 13 watchdog (status derivation, staleness/placement view, surgical-write isolation) + 8 new validator earning tests; 31/31 pass. No new dependencies (PyYAML, already the validator's). Cadence is 15 minutes (the fleet watchdog's); the recurring seat run is not wired by this PR — see #2179 note. No schedule is created, so doc/fleet-schedule-registry.md is unchanged.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 25 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 23, 2026
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.
Watchdog per-machine reporting for #2179 (§1.5) — remainder 1 from the S1 record (PR #12717). Unmerged for review.
What lands
scripts/fleet-machine-watchdog.py— the writer §3 names for the registry health cache. Per run it probes the machine and rewrites only thehealthblock of its registry record (surgical text replacement; every other byte preserved; the result must pass the validator before it is kept, else the original bytes stand). Transports:fleet-shell(default — the sandbox seat probes amd-6 viafleet shell) andlocal(on-host). Strict #3352 argument contract (undeclared flag / missing registry → exit 2).The §1.5 minimum record, each check
ok/failed/unknownwith a reason when it could not run:reachable— SSH (probe transport answering on-host) + OpenCode server responding at the record's declared endpoint (any HTTP answer; the API's auth wall is not a health failure);load_headroom— load15 vs declaredcpu_cores(fail above 1.0/core);disk_headroom— free space on the worktree (home) volume (fail below 10% free);sessions— server session count via the on-host OpenChamber attach API. The API pages over history, so listed/active-within-cadence are recorded as facts beside the declared cap; the cap is a placement limit (§1.3), not gated on, because activity-within-a-cadence is not concurrency;last_queue_job— newestdonetask in the queue store (queue + worker recorded; informational, never a gate — a queue may be idle). amd-6 is the only execution node, so the queue-wide newest completion is its last successful job.Status derivation (in the script docstring): transport failure →
unknown(a broken probe path is not a dead machine); reachable ran and failed →unreachable; a gating check failed →degraded; a gating check unknown →unknown; all gating checks ok →healthy.last_seenis the last actual sighting — a run that cannot reach the machine does not advance it, so staleness accrues and the reader rule (placement_view: stale > 2 cadences →left) demotes without touching declared state.Validator earning rules (
validate-fleet-machine-registry.py): a status other thanunknown, or any non-nulllast_seen, now requires the full checks record (reported_at+ all five checks, each with a valid state). Fail-before: the pristine validator accepted a bare hand-writtenstatus: healthywith no checks and nolast_seen— a fabricated pass. Pass-after: it rejects that, partial records, and unparseable timestamps, and accepts watchdog-written records including an earnedunreachable.First real record (written by the watchdog, in this PR)
amd-6 is degraded: disk headroom failed — 197 GiB free of 3,371 GiB (5.8%) on the worktree volume. Reachable ok (SSH + server HTTP 200), load ok (0.46/core), sessions ok (50 listed on the recent page, 17 active within cadence, cap 12 recorded), last queue job ok (task 20095,
repo-health-code-pilot, repo-worker-code, completed 2026-11-23T01:20:25Z). Declared fields untouched — amd-6 was alreadyactivevia §2; no machine is activated by this change.Evidence
scripts/test_fleet_machine_watchdog.py: 13/13 (status derivation incl. unreachable-keeps-last_seen and transport-failure-is-unknown, staleness/placement view, surgical-write isolation: prefix bytes identical, declared fields unchanged, result validates).scripts/test_validate_fleet_machine_registry.py: 18/18 (10 prior + 8 earning-rule tests).validate-fleet-machine-registry.py doc/fleet-machine-registry.yaml→ok: amd-6 (active). The real run also caught and fixed a bug en route: a dropped Turso connection crashed the queue probe instead of reportingunknown— network errors now yield the reason, per the earning rule.Not in this PR
doc/fleet-schedule-registry.mdis unchanged rather than carrying a row for a job that does not exist yet.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.