Include token usage in model usage summaries#78247
Conversation
58e4bee to
d594d8a
Compare
|
Codex review: needs changes before merge. Reviewed July 3, 2026, 5:04 PM ET / 21:04 UTC. Summary PR surface: Docs +1, Other +159. Total +160 across 3 files. Reproducibility: yes. for the review findings: source inspection of PR head, current main, and upstream CodexBar source shows both the finite-cost regression path and the totalTokens-only split-nullability problem. The overall PR is a bundled skill enhancement, not a current-main bug report. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Refresh the branch onto current main and land a narrow model-usage skill enhancement that reuses Do we have a high-confidence way to reproduce the issue? Yes for the review findings: source inspection of PR head, current main, and upstream CodexBar source shows both the finite-cost regression path and the totalTokens-only split-nullability problem. The overall PR is a bundled skill enhancement, not a current-main bug report. Is this the best way to solve the issue? No, not as submitted. Parsing token data at the Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 010b61746379. Label changesLabel justifications:
Evidence reviewedPR surface: Docs +1, Other +159. Total +160 across 3 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Heads up: this PR needs to be updated against current |
Summary
model-usage --mode alltext and JSON output when CodexBar model breakdowns expose token fieldsprompt_tokens/completion_tokens/total_tokenstokens unavailablewhen CodexBar only provides per-model cost, avoiding invented token splits from aggregate daily totalsReal behavior proof
behavior:
skills/model-usage/scripts/model_usage.py --mode allnow prints and serializes per-model token usage for every model in the breakdown when token fields are present, while still listing cost-only models with an explicit unavailable token state.environment: Local OpenClaw checkout on macOS using Python 3.14 for the direct script smoke check and a Python virtualenv for repo-style skills checks. The input was a local redacted sample CodexBar cost payload with no secrets.
steps:
/tmp/model_usage_sample.jsonwith three model breakdown rows: CodexBar-style token fields, OpenAI-style token fields, and a cost-only row.python3 skills/model-usage/scripts/model_usage.py --provider codex --mode all --input /tmp/model_usage_sample.json.python3 skills/model-usage/scripts/model_usage.py --provider codex --mode all --format json --input /tmp/model_usage_sample.json.evidence:
observedResult: All three models appear in both text and JSON. The two models with token fields include computed token totals and input/output details. The cost-only model remains listed and reports
tokens unavailable/tokensAvailable: false, so the command does not invent a per-model token split from aggregate daily totals.notTested: I did not run against live CodexBar logs because this environment does not have the CodexBar CLI available on PATH; the verified smoke input mirrors the documented
modelBreakdowns[]payload shape.Verification
python3 -m py_compile skills/model-usage/scripts/model_usage.py skills/model-usage/scripts/test_model_usage.pypython3 skills/model-usage/scripts/test_model_usage.py/tmp/openclaw-skills-venv/bin/python -m ruff check --config skills/pyproject.toml skills/model-usage/tmp/openclaw-skills-venv/bin/python -m pytest -q -c skills/pyproject.toml skills/model-usageNotes
bd synccould not run in this checkout because no beads database exists.