Repository navigation
Description
Show token/provider breakdown for missingCostEntries, especially openai-codex/*
Summary
After #85882, Codex / gpt-5.5 usage appears to be correctly treated as missing / unknown cost instead of authoritative $0 spend.
However, Codex token usage no longer appears clearly in openclaw gateway usage-cost or the usage dashboard provider breakdown. It looks like Codex entries may now be counted only as missingCostEntries, while their token usage is not surfaced as a visible openai-codex / codex runtime or provider bucket.
I agree with the fix in #85858 / #85882: unknown or all-zero Codex pricing should not be reported as confident $0 cost. But missing cost should not mean missing usage visibility.
Steps to reproduce
-
Start or use an OpenAI Codex-backed session.
-
Confirm that session/status/log data contains Codex token fields, for example:
{ "model": "gpt-5.5", "modelProvider": "openai", "agentRuntime": { "id": "codex" }, "inputTokens": <number>, "outputTokens": <number>, "totalTokens": <number>, "contextTokens": <number> } -
Run:
openclaw gateway usage-cost
or, for structured output:
openclaw gateway usage-cost --json
-
Open the usage dashboard / provider breakdown.
-
Observe that priced API-style providers appear in the usage-cost/dashboard breakdown, and missing-cost entries may be counted, but Codex does not appear as a clear
openai-codex/codexprovider or runtime bucket.
Expected behavior
Codex usage should remain visible in usage reporting even when its cost is unknown, all-zero, OAuth-backed, or non-authoritative.
For entries where agentRuntime.id === "codex" / openai-codex / gpt-5.5:
usage-costand the usage dashboard should show a separateopenai-codexorcodexprovider/runtime bucket- token usage should still be aggregated and displayed
- cost should be shown as
unknown,missing,non-authoritative, or omitted from priced totals - Codex OAuth / ChatGPT-backed usage should not be mixed into authoritative OpenAI API spend
- missing-cost Codex entries should still contribute to visible usage statistics
Ideally, the Codex bucket would include:
- input token total
- output token total
- total token usage, if available
- session count
- message count
- missing-cost entry count
Example:
openai-codex / gpt-5.5
cost: unknown
input tokens: <number>
output tokens: <number>
total tokens: <number>
sessions: <number>
messages: <number>
missing cost entries: <number>
In short:
missing cost != missing token usage
Actual behavior
Codex session/status/log data contains token fields such as inputTokens, outputTokens, totalTokens, and contextTokens, but cumulative Codex token usage is not clearly visible in openclaw gateway usage-cost or the usage dashboard provider breakdown.
Instead, Codex usage appears to be omitted from the visible provider/runtime breakdown or counted only as missing-cost entries.
Example redacted usage-cost summary:
30 days: <priced cost> · <priced token total> · Missing entries: <count>
Example redacted Codex session/status/log data:
{
"model": "gpt-5.5",
"modelProvider": "openai",
"agentRuntime": { "id": "codex" },
"inputTokens": <number>,
"outputTokens": <number>,
"totalTokens": <number>,
"contextTokens": <number>
}OpenClaw version
2026.6.10
Operating system
NOT_ENOUGH_INFO
Install method
NOT_ENOUGH_INFO
Model
gpt-5.5 via OpenAI Codex runtime
Provider / routing chain
OpenAI Codex runtime / OpenAI provider
Additional provider/model setup details
The affected session appears to use the OpenAI Codex runtime:
{
"model": "gpt-5.5",
"modelProvider": "openai",
"agentRuntime": { "id": "codex" }
}Cost may be unknown, all-zero, OAuth-backed, or otherwise non-authoritative, which is fine. The issue is that token usage should still remain visible even when cost is missing.
Logs
Redacted openclaw gateway usage-cost output:
30 days: <priced cost> · <priced token total> · Missing entries: <count>
Redacted Codex session/status/log entry:
{
"model": "gpt-5.5",
"modelProvider": "openai",
"agentRuntime": { "id": "codex" },
"inputTokens": <number>,
"outputTokens": <number>,
"totalTokens": <number>,
"contextTokens": <number>
}Screenshots, recordings, and evidence
NOT_ENOUGH_INFO
Impact and severity
Affected: users relying on openclaw gateway usage-cost or the usage dashboard to monitor OpenAI Codex token usage.
Severity: Medium. This does not appear to block Codex sessions, but it makes usage reporting incomplete or misleading.
Frequency: Observed when Codex sessions contain token fields but do not appear as a visible openai-codex / codex provider or runtime bucket.
Consequence: Users can see that there are missing-cost entries, but cannot tell how much of the missing usage came from Codex or how many Codex tokens were used cumulatively.
Additional information
This may be a follow-up UX gap after #85882.
#85858 / #85882 correctly fixed the case where token-burning Codex / gpt-5.5 usage with all-zero or unknown pricing could be reported as authoritative $0 cost.
This issue is about the follow-up behavior: after Codex entries become missing-cost entries, their token usage should still be visible somewhere in usage-cost / the usage dashboard.
Related:
- [Bug]: gateway usage-cost reports $0 for codex/gpt-5.5 (zero cost table) — budget/spike monitoring is blind to API-key spend #85858: Codex /
gpt-5.5all-zero pricing should not be reported as authoritative$0cost - fix(usage-cost): surface unpriced-model spend as missingCostEntries instead of a confident $0 #85882: Treat token-burning all-zero / unknown-priced usage as missing cost
- Codex OAuth / ChatGPT subscription usage is recorded as per-token cost in session logs and COST_LOG-style workflows #78760: Codex OAuth / ChatGPT-backed cost should not be shown as authoritative API spend
- No programmatic access to cumulative token usage or cost data per session #12299: Historical cumulative token/cost visibility issue
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jul 1, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 30, 2026, 11:14 PM ET / 03:14 UTC.
Summary
Keep open: current main preserves missing-cost Codex token totals internally, but
usage-coststill exposes only aggregate missing entries and the dashboard cards remain cost-first rather than clearly labeling an unknown-cost Codex runtime bucket.Reproducibility: yes. at source level: current
mainpreserves missing-cost token totals internally, but the public cost summary and visible dashboard cards do not expose a clear missing-cost Codex bucket. I did not run a live Codex-backed session, so this is not a full live reproduction.Next step
A focused repair is plausible, but the public output shape and Codex bucket naming need maintainer compatibility judgment before an autonomous PR.
Review details
Best possible solution:
Expose the existing missing-cost provider/model or runtime token aggregates through additive CLI JSON/human output and dashboard labels without changing Codex billing semantics.
Do we have a high-confidence way to reproduce the issue?
Yes at source level: current
mainpreserves missing-cost token totals internally, but the public cost summary and visible dashboard cards do not expose a clear missing-cost Codex bucket. I did not run a live Codex-backed session, so this is not a full live reproduction.Is this the best way to solve the issue?
No current-main solution fully solves it. The narrow maintainable fix is an additive reporting/display change using existing usage aggregates, but maintainers should choose the Codex runtime bucket label and output shape.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
openai; a fix should not reviveopenai-codexas a live provider route.Codex review notes: model internal, reasoning high; reviewed against fa3c9de45965.
Label changes
Label changes:
clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.clawsweeper:needs-product-decision: Current issue advisory state selects this label.Label justifications:
P2: The issue affects usage/cost observability for Codex users but does not block sessions or cause data loss.impact:other: The concrete impact is misleading usage reporting, which is maintainer-visible but outside the specific owned impact taxonomy.maturity:stable: The affected gateway-runtime and CLI observability surfaces match M4 Stable features from the maturity shortlist.Evidence reviewed
Acceptance criteria:
What I checked:
CostUsageSummaryexposes daily totals and aggregate totals only, with no provider/model/runtime bucket field for missing-cost usage. (src/infra/session-cost-usage.types.ts:59, fa3c9de45965)modelUsagetotals and applies missing-cost accounting per model entry. (src/infra/session-cost-usage.ts:2406, fa3c9de45965)src/infra/session-cost-usage.ts:1261, fa3c9de45965)usage-costhuman renderer prints total cost/tokens, aggregate missing entry count, and latest day only. (src/cli/gateway-cli/register.ts:200, fa3c9de45965)totalCostas the headline value and put token totals in subtext, which makes unknown-cost buckets easy to miss. (ui/src/ui/views/usage-render-overview.ts:763, fa3c9de45965)../codex/codex-rs/protocol/src/protocol.rs:2056, db887d03e1f9)Likely related people:
src/infra/session-cost-usage.ts,src/infra/session-cost-usage.types.ts,src/utils/usage-format.ts)ui/src/ui/views/usage.ts,ui/src/ui/usage-helpers.ts,src/gateway/server-methods/usage.ts)src/infra/session-cost-usage.ts,src/infra/session-cost-usage.test.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.openclaw-barnacle commentedon Jul 15, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
fix(agents): reject synchronous sessions_send self-targets, break dow…
fix(agents): reject synchronous sessions_send self-targets, break dow…