Prompt: Tool Execution Metrics (2025-10-17)
View Source
Required Reading
docs/20251017/tool-metrics.mddocs/design/tools-mcp.mdlib/codex/tools.ex, lib/codex/tools/registry.extest/codex/tools_test.exs, test/codex/thread_auto_run_test.exs
TDD Checklist
- Red – author tests for metrics and telemetry:
- Unit tests verifying
Codex.Tools.metrics/0 counters update on success/failure. - Test for
reset_metrics/0 clearing state. - Integration test covering retry path in auto-run updating failure then success counts.
- Telemetry assertion capturing
[:codex, :tool, ...] events.
- Green – implement ETS-backed metrics, wrap invocations with timing, emit telemetry.
- Refactor – ensure concurrency safety, document API, run
mix format, mix test, mix codex.verify.