ADR 0007: Typed Error Data
Status: accepted, 2026-11-17 (P3; the owner asked for every proposal up to P50 to be finished).
Status: accepted, 2026-11-17 (P3; the owner asked for every proposal up to P50 to be finished).
Context
plugin.Error carries a code, retryability, not_sent and a message. A caller that needs a number from the failure has to parse the message, which section 12 of AGENTS.md forbids. The case that exists today: a rate-limited model answers 429 with Retry-After: 120. The openai plugin honors waits up to 60 s and ignored longer ones, so it retried on its own short backoff into the same limit, spending its attempts before the Agent could fall back to the next model. The LLM layer (section 10) already specifies the fix: a wait over 60 s fails at once with retry_after_ms in the error data.
Decision
- Contract.
plugin.ErrorgainsData map[string]any(JSONdata, omitted when empty). It holds facts about the failure, never instructions; consumers read the keys they know and ignore the rest. Keys are snake_case and stable like codes. The first key isretry_after_ms(integer): the provider's wait before the same request may succeed. - Process plugins.
rpc.ToWirealready encodes the wholeplugin.Errorin the JSON-RPC error data, sodatacrosses the process boundary in both directions with no protocol change. - openai. Wait hints are read from
retry-after-ms, thenRetry-Afteras seconds or an HTTP date. A wait up to 60 s is honored before the next attempt as today; a longer one ends the call at once with the retryablellm.rate_limited(orllm.server_errorfor 503) andretry_after_msindata. - Agent. Unchanged: a retryable error already moves to the next fallback model, so a long wait now switches models at once.
Consequences
- ◆JSON stays compatible: old plugins send no
data, old consumers ignore it. - ◆Later keys (context numbers of an overflow, usage of a failed call) are added with the consumer that needs them, listed in the LLM layer design; no generic schema registry.
- ◆No Host branch reads
datatoday; the Host logs errors by code as before.