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.
BLOKOVÁNO vlna 3 · p2 · profil implementation · bezpečné paralelně
Blocked. This issue cannot start until I0301, I3287, I3289 are done. The status is derived from that, not declared.
Cíl
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.
Proč
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.
Aktuální stav
Codex is `unadapted` for lifecycle in share/providers.yaml; nothing reads its usage.
Cílový stav
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.
Rozsah
- apps/majordomus-cli/src/economics/usage.rs
- apps/majordomus-cli/src/capability/builtin/economics.rs
Závislosti
- I0301BLOKOVÁNO Definovat záznam provedení, včetně toho, jak vypadá nepřítomnost
- I3287READY A provider declares how it reports usage, with the evidence, beside its lifecycle
- I3289BLOCKED Turning usage collection on is a dry-run plan the person consents to, never a committed repository setting
Kritéria přijetí
- 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)
Validace
- cargo test --manifest-path apps/majordomus-cli/Cargo.toml --lib economics::usage
- majordomus plan validate
Požadované důkazy
- test_codex_cumulative_is_never_summed
- case_unseen_codex_usage_is_not_observed
Důkazy
Nic nezaznamenáno. Za každým tokenem výše musí stát příkaz nebo artefakt, než lze tento úkol dokončit; vyprávění se odmítá.
Časová osa
- zahájeno
- —
- ověřeno
- —
- dokončeno
- —
Tato tři pole, důkazy výše a stav závislostí jsou vše, z čeho se stav skládá. Neexistuje žádné pole stavu, které by s nimi mohlo být v rozporu.
Canonical record: .ai/repo/project/issues/I3290.yaml. Read it back with majordomus plan show I3290.