Repository navigation
feat(claude): share bounded subscription dates across app and CLI - #4324
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed October 7, 2026, 9:37 PM ET / October 8, 2026, 01:37 UTC (Revision 6). ClawSweeper reviewWhat this changesAdds authenticated Claude subscription renewal and expiration dates to shared app and CLI results while preserving calendar-date precision and successful quota when billing is unavailable. Example: The user refreshes Claude usage with an available subscription renewal date.
Review scores
ProductKind: Feature · Worth it: Yes Merge readiness⛔ Blocked before merge - 2 items remain This PR needs real behavior proof before merge. The useful, owner-directed implementation has no actionable code findings, but the current authenticated billing path remains demonstrated only with synthetic fixtures and renders. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherCodexBar’s Claude provider retrieves account usage and returns a shared snapshot consumed by the menu, Settings preview, and CLI. This change adds optional billing dates to that snapshot after checking that the existing cookie session belongs to the quota account. flowchart TD
A[Accepted Claude quota] --> B[Existing session cookie]
B --> C[Verify account and organization]
C --> D[Fetch optional billing dates]
D --> E[Recheck ownership]
E --> F[Shared usage snapshot]
D -->|Unavailable or timeout| F
F --> G[Menu and Settings]
F --> H[CLI JSON]
Technical reviewBest possible solution: Retain the shared, bounded provider enrichment and substantiate it with redacted authenticated app or CLI output from the current implementation. Do we have a high-confidence way to reproduce the issue? Not applicable to a new capability; current-main source confirms Claude does not populate these billing dates, while synthetic fixtures demonstrate the proposed mapping. Is this the best way to solve the issue? Yes. Reusing the existing provider result and subscription rows avoids competing publication paths, although real authenticated execution remains unproven. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 844b0e19bbbb. Provenance checked
TestingProof path: in-process harness. Added test files: 3. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (5 earlier review cycles)
|
Reuse the shared subscription fields and menu rows with calendar-date precision. Resolve optional billing through the accepted provider fetch, preserving quota on timeout or unavailable metadata and checking OAuth and cookie ownership. Remove the separate app publication worker and its memory-cache credential path. Add synthetic strategy, serialization, ownership and presentation coverage, and document billing availability limits. Refs steipete#4324. Co-authored-by: emanuelst <9994339+emanuelst@users.noreply.github.com>
|
Thanks @emanuelst! Merged in fba66c0 with the maintainer follow-ups: the CLI now fetches the plan dates too, and environment OAuth credentials go through the memory cache the enrichment requires. Plan renewal and expiration dates show in the menu, settings and CLI/JSON output when the account responses carry them. Ships in the next release. |
Claude now supplies authenticated subscription renewal or paid-access expiration dates to the existing menu and Settings rows and to
codexbar usage --json.The maintainer pass keeps @emanuelst's billing schema, date-precision support, and ownership checks, while replacing the separate app-only publication worker with the normal provider result path. This also fixes missing CLI output and enrichment for accepted environment OAuth credentials. The original contributor commits remain in the branch.
Billing uses an existing manual or cached cookie. OAuth additionally verifies the account and organization with the exact token accepted for quota, before and after billing; browser ownership is also checked before and after billing, bypassing response caches. Billing has a two-second total budget after quota succeeds. Failures, cancellation of the optional request, unavailable permissions, and unrecognized metadata preserve quota; caller cancellation remains terminal. No billing task writes into an already published snapshot.
Scheduled endings take precedence over renewal. Missing dates render nothing, calendar-only values retain their original day, and JSON exports include the existing subscription fields plus an
...IsDateOnly: trueflag when appropriate. Older JSON defaults to timestamp precision. The feature adds 242 net production lines against the lane base, down from 420 in the original contribution.Verification
All Swift tests use
source Scripts/test_environment.shto scrub inherited secrets and suppress real Keychain access.swift test --build-system native --jobs 4 -Xswiftc -gnone --filter ClaudeSubscriptionCLITestsfailed one test with four missing date/JSON assertions. A separate focused run confirmed the accepted environment-credential cache gap.swift test --build-system native --jobs 4 -Xswiftc -gnone --filter 'ClaudeSubscription|ClaudeWebFetchDeadlineTests|ClaudeOAuthFetchStrategyAvailabilityTests|ClaudeCredentialOwnershipBoundaryTests|ClaudeActiveAccountIdentityInvalidationTests|WidgetTokenOwnerTests|ProviderArchitectureGatekeeperTests|ProviderSettingsDescriptorTests|UsageSnapshot|OpenAISubscriptionEnrichmentTests|MiniMaxMenuCardBillingTests|MenuCardNeuralWattTests|MenuCardKiloPassTests'— 291 tests in 27 suites passed.source Scripts/test_environment.sh && make checkunder Bash — passed with zero violations across 2,849 Swift files.CODEXBAR_TEST_SUITE_TIMEOUT=900 ./Scripts/test.sh --swift-command /tmp/codexbar-pr-4324/swift-native --direct-workers 4— all 144 groups passed (1,596 selections): 143 first-pass successes, one recovered group after a fresh-process retry, zero timeouts. The wrapper forwardstest/buildto Swift with--build-system native --jobs 4 -Xswiftc -gnone. The longer group limit was needed on the shared host; the initial 180-second run stopped at existing cost-history timeouts. The final run recovered one existing background-pricing test failure.b0fdb969b88c8b43e2143a3b75258b3f27bfc45a.The fixtures establish behavior for the reported
subscription_detailsschema. They do not establish billing endpoint availability for every Pro/Max/Team/Enterprise plan or organization role. The contributor reported live renewal proof; this maintainer pass uses synthetic fixtures. Live cancellation and Team/Enterprise billing availability remain unverified. No real account or running app was used for the tests or renders.Synthetic production-card proof
Before, with no billing metadata:
After, with a renewal date:
After, with paid-access expiration:
Refs #1119, #1266, #2503.