Skip to content

I3290 — Codex usage is read from app-server increments, and a cumulative total is never summed

Map Codex app-server thread/tokenUsage/updated notifications into the same record, adding last-increment values only, cross-checking against total_token_usage, and recording a session as incomplete when turn completion arrives without a final total.

BLOCKED wave 3 · p2 · implementation profile · parallel safe

Part of every-sessions-usage-is-observed — What every AI session consumed is observed from the provider, attributed to the work it served, and never estimated into a fact.

Blocked. This issue cannot start until I0301, I3287, I3289 are done. The status is derived from that, not declared.

Objective

Map Codex app-server thread/tokenUsage/updated notifications into the same record, adding last-increment values only, cross-checking against total_token_usage, and recording a session as incomplete when turn completion arrives without a final total.

Why

Summing cumulative snapshots reports spend nobody incurred (lesson recorded 2026-10-13); the first Codex vertical must carry the regression case. App-server notifications reach only Majordomus-started sessions; the statement's 'every Codex session' must be proved through an evidenced seam or narrowed by evidence, not assumed. It extends milestone execution-telemetry. Proposed in ADR 0213 (Usage is observed through each provider's official telemetry into one provider-neutral record, and reported, estimated and billed amounts are never merged) (proposed; it carries no authority until the owner accepts it). Sources: chatgpt-majordomus:c253#2.

Current state

Codex is `unadapted` for lifecycle in share/providers.yaml; nothing reads its usage.

Desired state

Codex sessions Majordomus starts produce usage records indistinguishable in shape from Claude Code's; a Codex session the person started is received through the seam I3287 evidences, or reported not observed with the reason.

Scope

  • apps/majordomus-cli/src/economics/usage.rs
  • apps/majordomus-cli/src/capability/builtin/economics.rs

Dependencies

Acceptance criteria

  • A fixture of increments and cumulative snapshots yields one total equal to the last cumulative value
  • A fixture missing the final total is recorded incomplete, not completed
  • Codex usage of a session the person started is either received through the official seam evidenced in share/providers.yaml (I3287) and configured by I3289, or reported on every surface as not observed with the reason, never as zero and never only as unattributed (case)
  • No Codex session file or transcript is read (ADR 0213)

Validation

  • cargo test --manifest-path apps/majordomus-cli/Cargo.toml --lib economics::usage
  • majordomus plan validate

Evidence required

  • test_codex_cumulative_is_never_summed
  • case_unseen_codex_usage_is_not_observed

Evidence

None recorded. Every token above needs a command or an artifact behind it before this issue can be completed; narrative is refused.

Timeline

started
—
verified
—
completed
—

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I3290.yaml. Read it back with majordomus plan show I3290.

Searches the titles and descriptions of every page this site publishes.