fix(amp): restore usage fetching#1444
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 11, 2026, 6:33 PM ET / 22:33 UTC. Summary Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 1912f75f4962. Label changesLabel justifications:
Evidence reviewedWhat 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
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 765d02c3ee
ℹ️ 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".
| guard let free = self.captures(in: text, pattern: freePattern), | ||
| let remaining = self.number(from: free[0]), | ||
| let quota = self.number(from: free[1]) | ||
| else { | ||
| throw AmpUsageError.parseFailed("Missing Amp Free usage data.") |
There was a problem hiding this comment.
Handle credits-only Amp usage output
When Amp returns paid-credits-only display text with no Amp Free: line, this guard throws before the Individual credits and workspace balances are parsed below. That makes both amp usage and the new web endpoint fail for paid/credits-only accounts, so the provider never shows the credit balance this change is meant to add; treat the free-tier line as optional and still build a snapshot from the credit lines when present.
Useful? React with 👍 / 👎.
765d02c to
75661f5
Compare
Co-authored-by: Echo <github@3kh0.net>
75661f5 to
fccae4c
Compare
Summary
userDisplayBalanceInfoendpointamp usagein Auto mode, with the browser-cookie web path as fallbackCloses #1317.
Supersedes #1400 because its fork does not allow maintainer edits. The implementation and contributor credit are preserved from @3kh0.
Security
sessioncookie is imported or accepted manuallyProof
swift test --filter Amp(17 tests)make checkgpt-5.5, confidence 0.79)Risk
Medium. This repairs an existing provider but depends on Amp's undocumented authenticated response format. Exact-head CI is required; no autonomous merge until the authenticated provider behavior receives maintainer product review.