Skip to content

fix(cli): improve scan usage and cost reports - #853

Merged
ianw-oai merged 3 commits into
mainfrom
dev/ianw/improve-scan-accounting
Sep 9, 2026
Merged

ianw-oai merged 3 commits into
mainfrom
dev/ianw/improve-scan-accounting

Conversation

@ianw-oai

@ianw-oai ianw-oai commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Scan summaries omitted cache-write and total token counts. Missing cache-write usage appeared as zero, and some model prices were missing or outdated. This change shows the full token breakdown and records the prices used for each estimate.

Changes

  • Show uncached input, cache reads, cache writes, output, and total tokens. Mark missing cache-write counts and the derived uncached count as unavailable.
  • Add GPT-5.5 and GPT-6 Astra prices. Update GPT-5.6, Sol, and Daybreak Blue prices. Show unavailable cost when prices or usage are missing.
  • Save the price source, date, tier, context category, and rates with each estimate. Preserve known cache-write charges when other workers omit that data.
  • Keep cache-write data from matching session logs when the completion receipt contains a default zero.
  • Wrap longer dashboard summaries and document the estimate limits.

Testing

  • TypeScript full suite: 2,423 passed, 43 skipped, 0 failed, with isolated test state.
  • The seeded full run hit one timeout in the unchanged 4,096-file copy test. That test passed on its own on retry.
  • Focused accounting, SDK event, CLI, and dashboard tests: 344 passed, including four cases through the real SDK parser.
  • Scan-history Python tests: 26 passed.
  • Type checks and formatting checks passed.
  • Plugin Ruff checks, Ruff format checks, and portable source checks passed.
  • Git whitespace check passed.

Risk and rollout

The added result fields are optional for compatibility with older saved results. Estimates use standard short-context prices. Missing cache-write data can understate cost. Updated prices also change when existing cost limits stop a scan. If the Codex runtime converts omitted cache-write counts to zero before logging them, the CLI cannot recover that distinction.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the bug Something isn't working label Sep 9, 2026
@ianw-oai
ianw-oai marked this pull request as ready for review September 9, 2026 21:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-09T22:48:59.589028Z 2c4cdda New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread sdk/typescript/src/cost-model.ts Resolved

@daneschneider-oai daneschneider-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to unblock, with the P2 finding below recorded as a non-blocking follow-up: missing cache-write usage can still appear as a measured zero after Codex runtime normalization.

Validation: 120 focused accounting, dashboard, and CLI summary tests passed. Separately reproduced the availability flag being lost when the tracker receives the SDK-normalized final usage.

Comment thread sdk/typescript/src/cost-model.ts Resolved
@ianw-oai
ianw-oai merged commit 5c5d4b5 into main Sep 9, 2026
46 checks passed
@ianw-oai
ianw-oai deleted the dev/ianw/improve-scan-accounting branch September 9, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants