Files
codex/codex-rs/otel/tests
jif c0c230e673 Add bounded diagnostics for agent spawn failures (#51355)
## Why

Spawn failures can share an error kind and message despite different causes, such as execution and residency capacity limits. Telemetry needs enough detail to distinguish these failures without using error messages or correlation IDs as metric labels.

## What changed

- Add `AgentErrorContext` annotations for capacity limits, registry rejections, runtime availability, and spawn stages. Preserve the first annotation so outer stages retain the more precise failure origin.
- Add bounded `detail` and `error_kind` labels to spawn failure metrics, using `unknown` when no context is available.
- Emit spawn failure trace events with these classifications and the call and turn IDs for both multi-agent versions.

## Testing

Add tests for distinct capacity and registry failure contexts, preservation of manager, fork, and shutdown errors, and metric aggregation across different error messages and correlation IDs. Verify that annotations preserve existing error kinds and user-visible messages.

GitOrigin-RevId: 5bbe3d32f6ce408622f38e559fddeab05b8ccb65
2026-10-06 12:32:27 +00:00
..