Repository navigation
fix(claude): keep the credits record whole and name the shared pause - #125
Merged
Merged
Conversation
Review follow-up to #124: - The credits record is replaced with a rename (atomic_write), so a refresh killed mid-write keeps the last record and its balance; leftover temporary files are swept under the account lock. Failed reads rewrite the record since #124, which made an in-place write riskier than before. - A record written by 2.4.0 ({cached_at, data}) names no organization. It was taken as the current one, so after a switch inside its TTL the previous organization's balance could be shown. Such a record is now re-checked once and never shown. - A credits 429 starts the shared usage backoff but left USAGE_RETRY_AT/USAGE_RETRY_REASON empty, as did a run that served a fresh usage snapshot while a backoff held. The card now names the next try whenever the pause holds, as docs/architecture.md describes. Refs #123 Signed-off-by: Bernardo Pinto Gomes <[email protected]>
PR Summary by QodoPreserve Claude credits records and report shared backoff
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can import rules and skills only from the repositories your team follows |
bernardopg
enabled auto-merge
November 11, 2026 18:33
bernardopg
added a commit
that referenced
this pull request
Nov 11, 2026
Claude Team accounts no longer ask for refused usage credits on every refresh (#123, #124, #125): a refusal is remembered for a day per organization, a credits 429 pauses the usage endpoint too, and the card names the next try. Signed-off-by: Bernardo Pinto Gomes <[email protected]>
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
Follow-up to #124, addressing the three findings of the automated review there:
claude-prepaid-cache.json, in place. The record is now built first and replaced withatomic_write(temp file +mv -fT), so a refresh killed mid-write keeps the last record and balance; leftoverclaude-prepaid-cache.json.??????files are swept under the account lock, as the transcript cache already was.{cached_at, data}record names no organization, and(.org // $org) == $orgtook it as the current one. After an organization switch inside its 10 minute TTL the previous organization's balance could be shown. Now only.org == $orgis honoured: such a record is re-checked once and never shown.USAGE_RETRY_AT/USAGE_RETRY_REASONempty, and so did a run serving a fresh usage snapshot while a backoff held.note_usage_backoffnow fills them whenever the pause holds (not for rejected credentials), asdocs/architecture.mdalready describes;use_usage_fallbackuses the same helper.CHANGELOG.mdUnreleased bullet for #123 updated. No UI string changed.Related issues
Refs #123, #124.
Type of change
Checklist
plugin.json.versionandCHANGELOG.mdare consistent (no release in this PR)i18n/en.jsonkeys have translations in every localegit commit -s) under the DCOTests (
tests/test-limit-resets.sh): a 2.4.0 record holding another balance is re-checked and not shown on a 403, then replaced by an organization-scoped read; a failing rename leaves the record byte-identical and the balance shown, with no temp file left; a credits 429 reportsUSAGE_RETRY_ATequal to the stored deadline andrate_limited, and the next run serving the fresh snapshot still reports it. Each test fails with its fix reverted. Local: Claude suites,check-metadata,check-changelog --base origin/main,check-dco, shellcheck,git diff --check, statement coverage 100.00% (2400/2400) with kcov built from the CI-pinned commit.