Skip to content

[Bug]: Show token/provider breakdown for missingCostEntries, especially openai-codex/* #98348

Closed

Description

@billcshi

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

  1. Start or use an OpenAI Codex-backed session.

  2. 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>
    }
  3. Run:

    openclaw gateway usage-cost

    or, for structured output:

    openclaw gateway usage-cost --json
  4. Open the usage dashboard / provider breakdown.

  5. 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 / codex provider 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-cost and the usage dashboard should show a separate openai-codex or codex provider/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:

Activity

  1. added
    bug
    on Jul 1, 2026
  2. added
    regression
    on Jul 1, 2026
  3. clawsweeper commented on Jul 1, 2026

    @clawsweeper
    Contributor

    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-cost still 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 main preserves 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 main preserves 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:

    • The exact visible bucket label needs maintainer judgment because OpenAI Codex is folded into openai; a fix should not revive openai-codex as a live provider route.
    • I did not run a live Codex-backed session, so the reproduction is source-backed rather than end-to-end observed.

    Codex review notes: model internal, reasoning high; reviewed against fa3c9de45965.

    Label changes

    Label changes:

    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
    • add clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.
    • add 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:

    • node scripts/run-vitest.mjs src/infra/session-cost-usage.test.ts
    • node scripts/run-vitest.mjs src/cli/gateway-cli.coverage.test.ts src/cli/gateway-cli/register.option-collisions.test.ts
    • node scripts/run-vitest.mjs ui/src/ui/views/usage-metrics.test.ts ui/src/ui/views/usage-render-overview.test.ts ui/src/ui/views/usage.test.ts

    What I checked:

    Likely related people:

    • steipete: Authored the merged zero-rate usage-cost fix and extracted session cost usage types used by this reporting path. (role: recent adjacent implementation contributor; confidence: high; commits: 116c600f6011, c256503ea129; files: src/infra/session-cost-usage.ts, src/infra/session-cost-usage.types.ts, src/utils/usage-format.ts)
    • Tak Hoffman: Introduced the Web UI token usage dashboard and sessions usage API surface that carry the current provider/model aggregates. (role: feature introducer; confidence: medium; commits: 8a352c8f9dfd; files: ui/src/ui/views/usage.ts, ui/src/ui/usage-helpers.ts, src/gateway/server-methods/usage.ts)
    • MichaelZelbel: Authored the merged missing-cost accounting PR that this issue explicitly follows up from. (role: related fix contributor; confidence: medium; commits: 116c600f6011; files: src/infra/session-cost-usage.ts, src/infra/session-cost-usage.test.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  4. added
    P2
    impact:other
    maturity:stable
    issue-rating: 🐚 platinum hermit
    clawsweeper:needs-live-repro
    clawsweeper:no-new-fix-pr
    clawsweeper:needs-maintainer-review
    clawsweeper:needs-product-decision
    on Jul 1, 2026
  5. openclaw-barnacle commented on Jul 15, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  6. added
    stale
    on Jul 15, 2026
  7. locked as resolved and limited conversation to collaborators on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2bugclawsweeper:needs-live-reproclawsweeper:needs-maintainer-reviewclawsweeper:needs-product-decisionclawsweeper:no-new-fix-primpact:otherissue-rating: 🐚 platinum hermitmaturity:stableregressionstale

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions