01Different failures need different responses
Transient transport errors may retry; invalid structured output may use constrained repair; a missing document needs retrieval fallback; unsafe or low-confidence high-impact output may require abstention or review.
Separate transport failure, invalid structure, unsupported content, denied action, and ambiguous external effect. Retrying a rate-limited read after bounded backoff can help; retrying a denied action should not bypass policy; retrying a timed-out booking can create a duplicate. Recovery starts by identifying which boundary failed and whether state may already have changed.
Use a stable operation record with states such as proposed, authorized, executing, succeeded, failed, and unresolved. A timeout after an external commit belongs in unresolved until reconciliation establishes the result. A generated message is not the source of truth for that state. Return a run ID and truthful status so a client does not accidentally submit a new operation while waiting.
- Do not retry deterministic bad inputs
- Preserve one operation ID across retries
- Bound total attempts inside deadline/cost