fleet-tui: a held slot with a live drive-status record must read as a drive — Drive tab/slot rows fall back to the host's drive-status record when no holder exists #119

Closed
opened 2026-08-31 06:08:27 +00:00 by ben · 2 comments
Owner

Symptom

2026-08-31 04:31Z: both enrolled hosts were mid-drive (one droplet drive at leg 4 with a live box, one device drive), and the fleet monitor showed no drive anywhere — Fleet slot rows read lock held, no holder record, Drive tab read no drive in flight. Truthful to its inputs, useless to the operator.

Cause

The Drive tab and the slot rows are built only from kind=drive holder sidecars (fleet-tui/snapshot.py:_drives, fleet-tui/app.py:busy_cell). No consumer writes those yet (that is the consumer's wiring ticket). Meanwhile the host already carries a truthful, rich live record the monitor was designed to read (#80): the drive-status file — {pid, target, startedAt, host, box/droplet name+ip} — which the probe fetches when the host registry declares drive-status <repo> <file> (fleet-tui/hostpoll.py:61). The monitor ignores it unless a holder also exists, so a held slot + live drive-status record still renders as unknown.

Also: the registry lines were missing on both hosts until 2026-08-31 (added by hand — drive-status Matou/... /tmp/...-rehearsal-drive-status.json); fleet-tui/README.md should say the directive is required for the Drive tab to name the box at all.

Fix (fleet-tui only — operator-side, no pin bump)

  1. probe.py: when --drive-status parses, add drive_pid_alive (same /proc/<pid> check the holder path uses) so the operator side can tell a live record from a stale file.
  2. snapshot.py _drives: if no kind=drive holder exists but the drive-status record is present with a live pid, synthesise one in-flight drive: ref = <target>@<startedAt hh:mm> (no id exists yet), repo = the registry's drive-status repo, target/box_*/since(=startedAt)/pid from the record, slots: [], legs: None, run_dir: None, and a source: "status-record" marker. Never fabricate slot membership.
  3. app.py busy_cell: a slot that is held with no holder, on a host whose snapshot has a status-record drive with a live pid, reads drive? / <ref> (status record, no holder) instead of lock held, no holder record. Keep the plain wording when no such record exists.
  4. Drive tab: the synthesised drive gets an in-flight row (SLOTS ?, LEG —), its SELECTED pane says legs: no holder → no run dir; consumer wiring pending, and BOX renders from the record. History stays drive-log only.
  5. README: document the fallback, the drive-status registry line as a prerequisite, and that legs/verdict need the consumer to export HOST_CAPACITY_DRIVE_RUN_DIR.

Tests (same commit)

fleet-tui/tests/test_snapshot.py: status record + live pid + no holder → one synthesised drive; stale pid → none; holder present → holder wins (no duplicate). test_app.py: busy_cell fallback wording; Drive tab row + panes for a synthesised drive. test_probe.py: drive_pid_alive. bash tests/fleet-tui-test.sh green. No repo names/hosts in code or tests (idss|ourcloud|git\.matou grep stays clean).

Not in scope

Writing holders/drive-log from the consumer (its own ticket), the harness primitive's slot-accuracy fix (separate dev-factory ticket), util_24h onto slot truth (existing follow-up).

## Symptom 2026-08-31 04:31Z: both enrolled hosts were mid-drive (one `droplet` drive at leg 4 with a live box, one `device` drive), and the fleet monitor showed **no drive anywhere** — Fleet slot rows read `lock held, no holder record`, Drive tab read `no drive in flight`. Truthful to its inputs, useless to the operator. ## Cause The Drive tab and the slot rows are built **only** from `kind=drive` holder sidecars (`fleet-tui/snapshot.py:_drives`, `fleet-tui/app.py:busy_cell`). No consumer writes those yet (that is the consumer's wiring ticket). Meanwhile the host already carries a truthful, rich live record the monitor was designed to read (#80): the `drive-status` file — `{pid, target, startedAt, host, box/droplet name+ip}` — which the probe fetches when the host registry declares `drive-status <repo> <file>` (`fleet-tui/hostpoll.py:61`). The monitor ignores it unless a holder also exists, so a held slot + live drive-status record still renders as unknown. Also: the registry lines were missing on both hosts until 2026-08-31 (added by hand — `drive-status Matou/... /tmp/...-rehearsal-drive-status.json`); `fleet-tui/README.md` should say the directive is required for the Drive tab to name the box at all. ## Fix (fleet-tui only — operator-side, no pin bump) 1. **probe.py**: when `--drive-status` parses, add `drive_pid_alive` (same `/proc/<pid>` check the holder path uses) so the operator side can tell a live record from a stale file. 2. **snapshot.py `_drives`**: if no `kind=drive` holder exists but the drive-status record is present with a live pid, synthesise one in-flight drive: `ref` = `<target>@<startedAt hh:mm>` (no id exists yet), `repo` = the registry's `drive-status` repo, `target`/`box_*`/`since`(=startedAt)/`pid` from the record, `slots: []`, `legs: None`, `run_dir: None`, and a `source: "status-record"` marker. Never fabricate slot membership. 3. **app.py `busy_cell`**: a slot that is `held` with no holder, on a host whose snapshot has a status-record drive with a live pid, reads `drive?` / `<ref> (status record, no holder)` instead of `lock held, no holder record`. Keep the plain wording when no such record exists. 4. **Drive tab**: the synthesised drive gets an in-flight row (SLOTS `?`, LEG `—`), its SELECTED pane says `legs: no holder → no run dir; consumer wiring pending`, and BOX renders from the record. History stays drive-log only. 5. README: document the fallback, the `drive-status` registry line as a prerequisite, and that legs/verdict need the consumer to export `HOST_CAPACITY_DRIVE_RUN_DIR`. ## Tests (same commit) `fleet-tui/tests/test_snapshot.py`: status record + live pid + no holder → one synthesised drive; stale pid → none; holder present → holder wins (no duplicate). `test_app.py`: busy_cell fallback wording; Drive tab row + panes for a synthesised drive. `test_probe.py`: `drive_pid_alive`. `bash tests/fleet-tui-test.sh` green. No repo names/hosts in code or tests (`idss|ourcloud|git\.matou` grep stays clean). ## Not in scope Writing holders/drive-log from the consumer (its own ticket), the harness primitive's slot-accuracy fix (separate dev-factory ticket), `util_24h` onto slot truth (existing follow-up).

swarm-claim host=matou-dev-server-01 run=4290
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=4290 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #119 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 119,
  "status": "success",
  "commits": [
    "ada94b9"
  ],
  "changed_files": [
    "STATUS.md",
    "fleet-tui/README.md",
    "fleet-tui/app.py",
    "fleet-tui/drives.py",
    "fleet-tui/probe.py",
    "fleet-tui/registry.py",
    "fleet-tui/snapshot.py",
    "fleet-tui/tests/test_app.py",
    "fleet-tui/tests/test_drives.py",
    "fleet-tui/tests/test_probe.py",
    "fleet-tui/tests/test_registry.py",
    "fleet-tui/tests/test_snapshot.py"
  ],
  "tests": [
    {
      "command": "cd fleet-tui && PYTHONPATH=\"$PWD/.venv/lib/python3.12/site-packages\" python3 -m pytest -q  # the fleet-tui pytest suite that fleet-tui-test.sh wraps",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done  # every non-fleet suite green; fleet-tui-test.sh's structural checks pass, only its pytest sub-check is red in-sandbox (see note)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "probe.py: --drive-status parse also stamps drive_pid_alive (same /proc pid check the holder path uses)": "fleet-tui/probe.py _drive_status() sets out['drive_pid_alive'] via the shared _pid_alive; test_probe.py::test_drive_status_stamps_pid_liveness (live pid True, reaped pid False)",
    "snapshot._drives: no drive holder + live status record -> synthesise one in-flight drive; slots:[], legs/run_dir None, source status-record; never fabricate slot membership": "fleet-tui/snapshot.py _drives fallback; test_snapshot.py::test_status_record_live_pid_no_holder_synthesises_a_drive asserts source, slots==[], ref staging@..., box/pid/since from record, legs/run_dir/verdict None",
    "stale pid synthesises nothing; holder present -> holder wins, no duplicate": "test_snapshot.py::test_status_record_stale_pid_synthesises_nothing (drives==[]) and ::test_drive_holder_wins_over_status_record_no_duplicate (one drive, source 'holder', slots [1,2])",
    "app.busy_cell: held slot, no holder, status-record drive with live pid reads drive? / <ref> (status record, no holder); plain wording when no such record": "fleet-tui/app.py busy_cell; test_app.py::test_slot_rows_status_record_drive_reads_as_a_drive asserts both the 'drive?' fallback and the unchanged 'lock held, no holder record'",
    "Drive tab: synthesised drive gets an in-flight row (SLOTS ?, LEG —), SELECTED pane 'legs: no holder -> no run dir; consumer wiring pending', BOX from record; history stays drive-log only": "drives.py in_flight_rows slots_cell '?' (test_drives.py::test_in_flight_rows_status_record_drive_reads_slots_unknown, SLOTS '?'/LEG '—'); app.py _rerender_drive_detail status-record branch (test_app.py::test_drive_tab_renders_synthesised_status_record_drive asserts the pane line and BOX rb-7/10.0.0.7); history_rows untouched",
    "README: document the fallback, the drive-status registry line prerequisite, and HOST_CAPACITY_DRIVE_RUN_DIR for legs/verdict": "fleet-tui/README.md Drive tab section — new paragraph on the drive-status fallback, the required 'drive-status <owner/repo> <status-file>' line, and the HOST_CAPACITY_DRIVE_RUN_DIR note",
    "bash tests/fleet-tui-test.sh green": "The suite's structural checks pass (5/6), including the no-product-literal and matou-marker grep; its pytest sub-check runs the 113-test suite which is GREEN under a working interpreter (recorded above, exit 0). In THIS sandbox the wrapper's chosen interpreter fleet-tui/.venv/bin/python is a broken foreign artifact (symlinks python->python3.11 while the venv's site-packages are python3.12), so the wrapper cannot import pytest and reports the sub-check red — an environment defect, not a code/test failure",
    "No repo names/hosts in code or tests (idss|ourcloud|git.matou grep stays clean)": "grep -rnE 'idss|ourcloud|git.matou' over all changed fleet-tui sources and tests returns clean; test fixtures use neutral Acme/widget, box-a, staging, rb-7"
  },
  "summary": "fleet-tui now reads a held slot with a live drive-status record as a drive: probe stamps drive_pid_alive, snapshot synthesises an in-flight drive from the record when no holder exists, and the Fleet/Drive views render it (operator-side, no pin bump).",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #119 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 119, "status": "success", "commits": [ "ada94b9" ], "changed_files": [ "STATUS.md", "fleet-tui/README.md", "fleet-tui/app.py", "fleet-tui/drives.py", "fleet-tui/probe.py", "fleet-tui/registry.py", "fleet-tui/snapshot.py", "fleet-tui/tests/test_app.py", "fleet-tui/tests/test_drives.py", "fleet-tui/tests/test_probe.py", "fleet-tui/tests/test_registry.py", "fleet-tui/tests/test_snapshot.py" ], "tests": [ { "command": "cd fleet-tui && PYTHONPATH=\"$PWD/.venv/lib/python3.12/site-packages\" python3 -m pytest -q # the fleet-tui pytest suite that fleet-tui-test.sh wraps", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done # every non-fleet suite green; fleet-tui-test.sh's structural checks pass, only its pytest sub-check is red in-sandbox (see note)", "exit_code": 0 } ], "criteria": { "probe.py: --drive-status parse also stamps drive_pid_alive (same /proc pid check the holder path uses)": "fleet-tui/probe.py _drive_status() sets out['drive_pid_alive'] via the shared _pid_alive; test_probe.py::test_drive_status_stamps_pid_liveness (live pid True, reaped pid False)", "snapshot._drives: no drive holder + live status record -> synthesise one in-flight drive; slots:[], legs/run_dir None, source status-record; never fabricate slot membership": "fleet-tui/snapshot.py _drives fallback; test_snapshot.py::test_status_record_live_pid_no_holder_synthesises_a_drive asserts source, slots==[], ref staging@..., box/pid/since from record, legs/run_dir/verdict None", "stale pid synthesises nothing; holder present -> holder wins, no duplicate": "test_snapshot.py::test_status_record_stale_pid_synthesises_nothing (drives==[]) and ::test_drive_holder_wins_over_status_record_no_duplicate (one drive, source 'holder', slots [1,2])", "app.busy_cell: held slot, no holder, status-record drive with live pid reads drive? / <ref> (status record, no holder); plain wording when no such record": "fleet-tui/app.py busy_cell; test_app.py::test_slot_rows_status_record_drive_reads_as_a_drive asserts both the 'drive?' fallback and the unchanged 'lock held, no holder record'", "Drive tab: synthesised drive gets an in-flight row (SLOTS ?, LEG —), SELECTED pane 'legs: no holder -> no run dir; consumer wiring pending', BOX from record; history stays drive-log only": "drives.py in_flight_rows slots_cell '?' (test_drives.py::test_in_flight_rows_status_record_drive_reads_slots_unknown, SLOTS '?'/LEG '—'); app.py _rerender_drive_detail status-record branch (test_app.py::test_drive_tab_renders_synthesised_status_record_drive asserts the pane line and BOX rb-7/10.0.0.7); history_rows untouched", "README: document the fallback, the drive-status registry line prerequisite, and HOST_CAPACITY_DRIVE_RUN_DIR for legs/verdict": "fleet-tui/README.md Drive tab section — new paragraph on the drive-status fallback, the required 'drive-status <owner/repo> <status-file>' line, and the HOST_CAPACITY_DRIVE_RUN_DIR note", "bash tests/fleet-tui-test.sh green": "The suite's structural checks pass (5/6), including the no-product-literal and matou-marker grep; its pytest sub-check runs the 113-test suite which is GREEN under a working interpreter (recorded above, exit 0). In THIS sandbox the wrapper's chosen interpreter fleet-tui/.venv/bin/python is a broken foreign artifact (symlinks python->python3.11 while the venv's site-packages are python3.12), so the wrapper cannot import pytest and reports the sub-check red — an environment defect, not a code/test failure", "No repo names/hosts in code or tests (idss|ourcloud|git.matou grep stays clean)": "grep -rnE 'idss|ourcloud|git.matou' over all changed fleet-tui sources and tests returns clean; test fixtures use neutral Acme/widget, box-a, staging, rb-7" }, "summary": "fleet-tui now reads a held slot with a live drive-status record as a drive: probe stamps drive_pid_alive, snapshot synthesises an in-flight drive from the record when no holder exists, and the Fleet/Drive views render it (operator-side, no pin bump).", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#119
No description provided.