Repository navigation
fix(openai): retain cache-write usage telemetry - #666
Merged
Merged
Conversation
Preserve nullable cache-write counts from Responses API usage and characterize raw telemetry without enabling new cost estimates. Refs #621.
This was referenced Oct 8, 2026
monit-reviewer
approved these changes
Oct 11, 2026
monit-reviewer
left a comment
There was a problem hiding this comment.
Automated PR Review
Reviewed commit: 29edd5c6877b
Profile: open-cli-collective-review - Posting as: monit-reviewer
Summary
| Reviewer | Findings |
|---|---|
| go:implementation-tests | 0 |
Reviewer Coverage
Complete coverage details are retained in the local coverage.json artifact.
go:implementation-tests— complete (broad); scope: 2 files; examples:internal/llmadapters/api.go,internal/llmadapters/api_test.go; body-inspected: 2 files; examples:internal/llmadapters/api.go,internal/llmadapters/api_test.go; skipped: none; context (not coverage): 1 file; examples:internal/pricing/pricing.go; constraints: Static review only; tests were inspected but not executed.
0 PR discussion threads considered. 0 summarized; 0 resolved.
Completed in 27s | $0.03 | openai-codex/gpt-6.1-sol | cr 0.10.328
| Field | Value |
|---|---|
| Model | openai-codex/gpt-6.1-sol |
| Reviewers | go:implementation-tests |
| Engine | pi_rpc · openai-codex/gpt-6.1-sol |
| Reviewed by | cr · monit-reviewer |
| Duration | 27s wall · 17s compute |
| Cost | $0.03 |
| Tokens | 10.2k in / 268 out |
Per-workstream usage
orchestrator-selection— openai-codex/gpt-6.1-sol- In: 5.6k
- Out: 121
- Cache read: 0
- Cache create: 0
- Cost: $0.01
- Duration: 3s
go:implementation-tests— openai-codex/gpt-6.1-sol- In: 977
- Out: 100
- Cache read: 19.6k
- Cache create: 0
- Cost: $0.00
- Duration: 10s
orchestrator-rollup— openai-codex/gpt-6.1-sol- In: 3.6k
- Out: 47
- Cache read: 0
- Cache create: 0
- Cost: $0.01
- Duration: 2s
monit-reviewer
approved these changes
Oct 11, 2026
monit-reviewer
left a comment
There was a problem hiding this comment.
Automated PR Review
Reviewed commit: 884955e14282
Profile: open-cli-collective-review - Posting as: monit-reviewer
Summary
| Reviewer | Findings |
|---|---|
| go:implementation-tests | 0 |
Reviewer Coverage
Complete coverage details are retained in the local coverage.json artifact.
go:implementation-tests— complete (constrained); scope: 2 files; examples:internal/llmadapters/api.go,internal/llmadapters/api_test.go; body-inspected: 2 files; examples:internal/llmadapters/api.go,internal/llmadapters/api_test.go; skipped: none; context (not coverage): 2 files; examples:docs/development.md,internal/pricing/pricing.go; constraints: Static inspection only; tests and build commands were not executed.
0 PR discussion threads considered. 0 summarized; 0 resolved.
Completed in 25s | $0.01 | openai-codex/gpt-6.1-sol | cr 0.10.328
| Field | Value |
|---|---|
| Model | openai-codex/gpt-6.1-sol |
| Reviewers | go:implementation-tests |
| Engine | pi_rpc · openai-codex/gpt-6.1-sol |
| Reviewed by | cr · monit-reviewer |
| Duration | 25s wall · 14s compute |
| Cost | $0.01 |
| Tokens | 4.6k in / 130 out |
Per-workstream usage
go:implementation-tests— openai-codex/gpt-6.1-sol- In: 992
- Out: 80
- Cache read: 22.9k
- Cache create: 0
- Cost: $0.01
- Duration: 11s
orchestrator-rollup— openai-codex/gpt-6.1-sol- In: 3.6k
- Out: 50
- Cache read: 0
- Cache create: 0
- Cost: $0.01
- Duration: 3s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refs #621.
Retain the Responses API's
usage.input_tokens_details.cache_write_tokensin the existing nullableCacheCreateusage field. Omitted/null counts remain unavailable; an explicit zero remains a reported zero.The field and inclusive input semantics are documented in OpenAI's prompt-caching guide.
Remaining cost work
This is a telemetry-only slice of #621. It adds no new estimator activation and does not complete OpenAI or Codex cost estimation.
Complete request histories are still needed across validation and transport retries. Context bands and observed service tiers must be selected per request before aggregation; the catalog currently has no numeric context boundary. Ordinary OpenAI input must exclude both cache reads and cache writes before applying rates. Missing, inconsistent, or otherwise incomplete billing evidence must leave future estimates unavailable.
No lifecycle, durable-schema, catalog, pricing-formula, or Codex changes are included.
Focused local validation
The exact proposed source passed bounded offline checks with
keyring_nopassageand an isolated cold build cache:-race: 16 top-level tests, 52 passing test/subtest results, no race diagnostics.All nine telemetry cases, six malformed/overflow cases, three bundled-price guards, and the Anthropic bucket regression were observed. No selected tests failed or skipped. Formatting and patch-application checks passed; source stayed unchanged throughout execution.
Full adapter-package tests, repository-wide tests, lint, standalone build, live-provider calls, and a baseline-red execution were not run locally. These focused results do not establish merge readiness.
Source scope
Based on
999e59ddfc74a67ffeef3c4b4a78a8528365afe6. The exact tested Git tree is1701116532002ffa0c8e3ab1653728d9bf1f15b0; onlyinternal/llmadapters/api.goandinternal/llmadapters/api_test.godiffer. This remains a draft, and #621 remains open.