Repository navigation
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. by source inspection: current main combines nonzero Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the transport-level zero-cost fix after the contributor attaches real patched-OpenClaw proof showing Do we have a high-confidence way to reproduce the issue? Yes, by source inspection: current main combines nonzero Is this the best way to solve the issue? Yes for the functional direction: zeroing the normalized transport usage cost is the narrowest current-field fix and preserves token accounting; it is not merge-ready until real patched-OpenClaw proof is attached. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 129b9dad9e65. |
…w#78760) openai-codex models have nonzero cost rates in the model registry (e.g. $1.25/M input, $10/M output) because those rates apply to API-key-billed usage. However the openai-codex provider is OAuth/subscription-only — there is no per-token billing. calculateCost was recording nonzero cost fields in session logs for every openai-codex turn. Zero out usage.cost after calculateCost when model.provider is openai-codex in both the Responses-API path (processResponsesStream) and the shared parseTransportChunkUsage helper. Token counts (input/output/cacheRead) are preserved for rate-limit tracking; only the dollar-cost fields are cleared.
…8760) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Summary
openai-codexmodels (gpt-5.3-codex-spark, etc.) are OAuth/subscription-only — no per-token billing. Butmodels.generated.jsstill defines nonzero cost rates (input: 1.25, output: 10USD/1M tokens), andcalculateCostis called unconditionally at both transport sites. Result: session logs record fabricated dollar costs for every Codex OAuth turn.calculateCostcall inprocessResponsesStream(line 602) andparseTransportChunkUsage(line 1976), a guard zeros the cost fields whenmodel.provider === "openai-codex". Token counts (input,output,cacheRead,cacheWrite) are preserved for rate/quota tracking.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof
Behavior addressed:
Session logs record fabricated per-token dollar costs for
openai-codexOAuth turns becausecalculateCostapplies model cost rates unconditionally. Docs confirm OAuth tokens never show dollar cost.Exact command verifying both transport paths:
Evidence:
What this shows:
openai-codexprovider.calculateCostproduces nonzero values before the guard (proving the guard is load-bearing).openai/gpt-4o) are unaffected.Root Cause
models.generated.jsdefinesopenai-codexmodels with nonzero cost rates.calculateCostapplies these rates unconditionally at two sites inopenai-transport-stream.ts.openai-codexis OAuth-only (extensions/openai/openai-codex-provider.ts:356). No per-token billing occurs.Regression Test Plan
openai-transport-stream.test.ts:parseTransportChunkUsagewithopenai-codexprovider returns zero cost while preserving token counts.pnpm test src/agents/openai-transport-stream.test.tspnpm check:changedSecurity Impact
None — changes only local usage-cost accounting.
Compatibility / Migration
Backward compatible. No config changes.