Skip to content

doctor: a presence file that was never written is not fresh - #10

Closed
schickling-assistant wants to merge 1 commit into
compoundingtech:mainfrom
schickling-assistant:fix/doctor-missing-presence
Closed

doctor: a presence file that was never written is not fresh#10
schickling-assistant wants to merge 1 commit into
compoundingtech:mainfrom
schickling-assistant:fix/doctor-missing-presence

Conversation

@schickling-assistant

Copy link
Copy Markdown
Contributor

Fixes #5.

read_state is deliberately permissive and maps a missing status file to Offline (src/status.rs:74-77), which is indistinguishable from an agent that deliberately set itself offline. Doctor's gate only rejected Unknown (src/main.rs:952), so an agent whose presence nothing has ever written passed a check literally named presence fresh — and printed ✓ <id> presence fresh (is offline) while no status file existed at all, followed by ✓ all checks passed.

The change. Doctor checks for the file first and reports its absence as its own problem, naming the actual condition (no status file — nothing is maintaining this agent's presence). read_state's documented permissive read semantics are untouched, and a deliberately-offline agent still passes — offline is a settable state and being offline on purpose is healthy; only absent is not.

Tests (tests/doctor.rs, a new file so it will not conflict with in-flight edits elsewhere). Both cases run against an identical catalog and differ only in whether the presence file exists:

  • missing → not reported as fresh, reported as a problem. Fails on 4e25f56.
  • written offline → still ✓ … presence fresh (is offline). Passes on 4e25f56 and after, so the permissive case is pinned against regression.

One thing I deliberately did not decide. An agent that declares no ding will now show this problem. That may be exactly right (doctor cannot observe it, and says so), or you may want such agents exempted — it is a one-line refinement on top and it felt like your call rather than mine.

You may have this in unpushed work already; happy for it to be closed in favour of your version.

Note: codex_hooks, materialize, native_only and transport_isolation already fail on a pristine 4e25f56 in my environment (missing shims / sandbox — native_only's doctor case shells out to /bin/sleep, which does not exist here). The failure set is identical before and after this change.

read_state is deliberately permissive and maps a missing status file to
offline, which is indistinguishable from an agent that deliberately set itself
offline. doctor only rejected unknown, so an agent whose presence nothing has
ever written passed a check literally named "presence fresh" — and printed
"presence fresh (is offline)" while no status file existed.

Check for the file first and report its absence as its own problem, naming the
actual condition. read_state's documented read semantics are untouched, and a
deliberately-offline agent still passes.

Whether an agent that declares no ding should be exempted from this is a
separate question I did not presume to answer.

myobie commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Thank you, @schickling-assistant. Closing this without merge because the same missing-presence distinction is already on main in dae4929, which carries your co-author credit.

Doctor now reports an absent status file as presence missing and a problem, while preserving an explicitly written offline state as fresh. The missing-versus-written-offline regression is in tests/native_only.rs. Current review SHA 46ff6ee is green in Actions run 30213516652.

The PR branch is based on the older 49fd943 tree, so merging it now would duplicate/conflict with the accepted implementation.

@myobie myobie closed this Jul 26, 2026
@schickling schickling added area:doctor doctor, validate, and task inventory diagnostics · Set: manual area:presence Presence, status records, and heartbeats · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:bug Something broken or a regression · Set: manual labels Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:doctor doctor, validate, and task inventory diagnostics · Set: manual area:presence Presence, status records, and heartbeats · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:bug Something broken or a regression · Set: manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

st2 doctor reports "presence fresh" for an agent with no status file

3 participants