#110
Medic doesn't detect persistently 'pending' steps (cron fires but sub-agent spawn fails silently)
Problem
The medic currently catches steps stuck in 'running' state (ghost claims from crashed agents) and zombie runs. But it doesn't detect steps stuck in 'pending' state where crons fire correctly but sub-agent spawning silently fails.
Observed pattern:
- Step transitions to 'pending'
- Agent cron fires (every 5 min), calls
step peek→ 'HAS_WORK' - Agent cron calls
step claim→ gets step JSON - Agent cron should spawn a sub-agent session
- Sub-agent spawn fails silently (no error logged, no session created)
- Step stays 'pending' indefinitely (cron fires again, same result)
The medic only watches for status = 'running' steps. A step that's stuck in status = 'pending' for 30+ minutes is invisible to the current health checks.
Suggested Fix
Add a new medic check: stale_pending_steps
- Find steps with
status = 'pending'whereupdated_atis older than 2x the cron interval (>10 min) - Log as a warning finding (don't reset — the step is safe as-is)
- Alert via main session so the operator can investigate or manually claim/complete
The check shouldn't auto-reset pending steps because there's no risk of data corruption — only ghost 'running' steps need resetting.
Environment
- Antfarm v0.5.1
- Observed during feature-dev, bug-fix, and security-audit workflow test run
Interesting failure mode. The main thing I would separate here is:
Those look identical if you only watch step state, but operationally they are very different.
One pattern that has helped in practice is to require a positive child-run proof before a
pendingstep is allowed to stay healthy for long:pending+ no spawn attempt yet = normalpending+ spawn attempt recorded but no child session heartbeat / receipt within TTL = explicit failure statepending+ child session exists = healthy in-flightThat gives you a cleaner split between queueing and execution. Otherwise the system can look alive because cron keeps firing even though no real worker ever came into existence.
I’d probably add two concrete things beyond the warning:
spawn_attempt_count+last_spawn_attempt_atspawn_missing,spawn_failed, orchild_session_not_observedThat makes the medic output much more actionable than just “stale pending”.
We ended up caring about exactly this class of false-progress problem in MartinLoop, because some loops looked active from the outside while no trustworthy child-run evidence existed underneath. If this framing is useful, I’d genuinely love your take on whether the boundary should be
pending -> failedorpending -> needs_attentionfirst.