CLI Internals
Claims, Heartbeats, Retries, and Failures
Understand the reliability model behind CLI thread execution.
Claims
Thread claiming is lease-based.
The active session records claim metadata on the thread so other sessions do not process the same work at the same time.
Heartbeats
There are two health signals to keep in mind:
- session heartbeats for the connected CLI process
- claim heartbeats for the active thread lease
Both matter during streaming.
Failures
Assistant batches can fail for runtime, connectivity, or cancellation reasons.
Failure handling must:
- preserve deterministic thread state
- avoid stale active assistant references
- keep retry semantics coherent
Retries
A retry should requeue the right user messages and remove the failed assistant batch rather than layering a confusing extra assistant state on top of it.