Add CLIProxyAPI cost attribution - #2457
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c82dab5a6d
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs real behavior proof before merge. Reviewed August 12, 2026, 5:14 AM ET / 09:14 UTC. ClawSweeper reviewWhat this changesAdds CLIProxyAPI telemetry and request-log correlation so Claude Code usage routed through a proxy can be priced and displayed under its verified upstream provider. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 10 items remain Keep open: current main does not provide this attribution feature, but the branch still depends on the removed JSON cost-cache path and has no real routed-run proof. The feature also needs a maintainer decision on owning a CLIProxyAPI endpoint/key configuration in CodexBar. Priority: P2 Review scores
Verification
How this fits togetherCodexBar scans local provider histories and cached telemetry to calculate costs, then supplies provider and model rows to the spend dashboard. This PR adds proxy logs and telemetry as a supplemental source for assigning Claude Code activity to an upstream provider. flowchart LR
A[Claude Code history] --> C[Proxy attribution]
B[Proxy logs and telemetry] --> C
C --> D[Cost report generation]
D --> E[Persistent cost store]
E --> F[Spend dashboard]
F --> G[Shared statistics]
Decision needed
Why: The PR adds durable credentials, a settings workflow, and a new attribution policy rather than repairing an established contract; maintainers must choose the supported product boundary before a large rebase lands. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Sponsor a narrowed, rebased implementation that stores and reads proxy attribution through the current cost-store boundary, preserves provider silos, and includes a redacted live CLIProxyAPI-routed dashboard proof. Do we have a high-confidence way to reproduce the issue? Not applicable as a pre-existing bug: this PR adds new attribution behavior, and its supplied evidence is fixture-based rather than a real CLIProxyAPI-routed setup. Is this the best way to solve the issue? No. The current branch is not the best merge path because it still uses the retired JSON cache API; porting the feature to the SQLite cost-store boundary is the narrower maintainable approach. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a90dfed5c264. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (117 earlier review cycles; latest 8 shown)
|
|
@codex review @clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3bedb05f8
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Follow-up fixes are pushed in 0f4bda0 and the three current review threads have been addressed. @codex review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f4bda0d9a
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
The current-head retention finding is fixed in e9b111e and its review thread is addressed. @codex review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9b111ef6c
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@clawsweeper re-review |
|
@codex review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Fixed the canonical ClawSweeper missing-credential removal finding in 65cfa9a. Removal now accepts both an actually removed credential and an already-missing credential, while preserving rollback for genuine clear failures. Added a concurrent-removal regression; 31 focused tests, make check, and all 824 full-suite selections across 69 groups pass. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65cfa9aadf
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Integrated the latest upstream Verification on this exact head:
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 112461d4bc
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review exact head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06312e5e53
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@clawsweeper re-review The two findings from canonical comment 5081410241 were fixed in exact head 06312e5, the required exact-head Codex review completed cleanly, and the automatic canonical refresh did not follow after approximately 15 minutes. Please update the same durable comment for this head. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Fixed both rollback findings from the canonical ClawSweeper checklist on head 1a66672:
Verification: focused CLIProxyAPIUsageCacheTests passed; make check passed; full make test passed all 828 selections across 69 groups with no retries or failures. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a66672e28
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed the exact-head Codex P2 on c694017:
Verification: focused CLIProxyAPIUsageCacheTests passed; make check passed; full make test passed all 828 selections across 69 groups with no retries or failures. Both handled Codex threads have disposition replies and are resolved. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c694017bf6
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Fixed the canonical ClawSweeper P2 cancellation finding in @codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Canonical finding fixed on exact head @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Summary
Verification
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make checkDEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make test(725 selections, 61 groups, all passed on the first attempt)swift test --filter SpendDashboardProxyAttributionTestsDEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer swift test --filter CLIProxyAPIAttributionResolverTests(24 tests)DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer swift test --filter CostUsageFetcherCacheSnapshotTests(13 tests)swift test --filter CostUsageFetcherTests(18 tests)DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer swift test --filter CostUsageFetcherUnknownModelPricingTests(7 tests)swift test --filter SpendDashboardCodexProxySourceTests(2 tests)swift test --filter SpendDashboardForceStateMachineTests(14 tests)SpendDashboardTokenProvenanceTests,SpendDashboardControllerTests,CostUsageCacheTests, andCostUsageScannerClaudeFableTestsRemaining proof