mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
resolve_wait deleted the waiting record (in-memory + durable) BEFORE calling spawn_agent. A re-park in the window between the probe-success clear and the spawn — the provider's rate limit lifts then immediately re-limits, or a second provider limit lands — bails spawn with an OFFLINE instance (the parked-provider short-circuit). Deleting the record first orphaned the agent: with no record the probe-resume loop can never revive it and the spawn gate bails every tick, so the agent is lost until the operator intervenes. Fix: spawn first, then tear down the record only once a container actually launched (instance.state == ACTIVE). On an OFFLINE bail the record stays so the next probe-success re-attempts the resume. On a spawn EXCEPTION the record is torn down + re-raised so the probe loop doesn't keep re-resuming a task that moved to a different state (e.g. readiness refused -> task auto-blocked) — matching the pre-fix behavior where the record was deleted before the spawn.