Skip to content

feat(sensor): capture Codex token usage - #86

Draft
barisozbas wants to merge 1 commit into
mainfrom
pr/codex-token-usage
Draft

feat(sensor): capture Codex token usage#86
barisozbas wants to merge 1 commit into
mainfrom
pr/codex-token-usage

Conversation

@barisozbas

@barisozbas barisozbas commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

What changed

Codex token accounting is now retained on AgentEvent.

  • Aggregates current and legacy token-count event shapes.
  • Preserves input, output, cached-input, reasoning, and total token values when present.
  • Adds token usage as an optional schema field without changing existing positional construction.

Why

Token usage is useful for cost and activity analysis but was previously discarded during normalization. The schema addition remains optional so existing consumers continue to work unchanged.

Validation

  • pytest -q Sensor/tests
  • ruff check Sensor/adr_sensor/parsers/codex_parser.py Sensor/adr_sensor/schemas/agent_event_schema.py Sensor/tests/test_parsers.py Sensor/tests/test_schemas.py

Summary:
Intent:
- Preserve token accounting emitted by Codex sessions.
- Extend AgentEvent without breaking positional construction.

Changes:
- Aggregate current and legacy token-count event shapes.
- Store token usage as an optional backward-compatible event field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant