Conversation
There was a problem hiding this comment.
All reported issues were addressed across 4 files
You’re at about 91% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
You’re at about 91% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
You’re at about 92% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
2b3b05c to
9f33b9d
Compare
Six gates treated local credential bytes as a proxy for usability. A vault-served account's local slot is the provider tombstone, so quota recovery, profile hydration, /claude-quota and the killswitch's eager refresh all skipped healthy accounts once custody emptied that slot. Each site now admits a live vault binding alongside local access; none admits an account with no credential anywhere.
liveMainVaultAccess hand-rolled its sibling and dropped the sibling's stale-version guard, so main profile hydration and /claude-quota could bearer a version already reported auth-failed. It now delegates to resolveClaustrumAccess, inheriting both the guard and the warm schedule. mainServedAccessToken is cleared on a successful main report only: a suppressed or failed report tells the vault nothing, so local belief must not diverge from what the vault received.
9f33b9d to
8772d86
Compare
| // the local credential is live or a live Claustrum binding serves it. | ||
| Boolean( | ||
| (account.access && account.expires && account.expires > now) || | ||
| vaultServed, |
There was a problem hiding this comment.
Cached quota crosses identities
When a non-scoped vault binding starts serving a different Anthropic identity, the account UUID is updated without clearing the existing quota snapshot. If the next quota refresh fails transiently, this new vault-presence branch accepts that old snapshot without checking its identity or authentication lineage. The replacement account can therefore inherit the previous account’s quota decision, either admitting an exhausted account or incorrectly blocking a healthy one. Clear or identity-fence the persisted snapshot before using vault presence to justify cached-quota recovery.
Knowledge Base Used:
v1.23.0 types fetchImpl as typeof fetch, which requires preconnect. The bare async stub no longer satisfies it.
|
@ualtinok, following up: re-checked against current Where the defects are on
CI is green on the current head. #233 builds on this branch. |
|
Closing: c2f3428 removed the handle cache this PR was built on ( |
Follow-up to #231, found by sweeping the class that PR's last commit belonged to.
The class
A vault-served account's local auth slot holds only the provider tombstone, so
account.access === ''while the account is healthy and serving. Every check that used local credential bytes as a proxy for usability became wrong the moment custody went live. Before custody every account carried real local bytes, so the proxy was sound — this is a precondition change turning dead branches live, not a regression.A read-only census over both packages examined 26 candidate gates: 6 live, 5 inert, 15 correct. Each inert verdict had to name the specific source-traced precondition that blocks the branch, or be downgraded to live-suspected.
Commit 1 — six presence gates
accounts.tscanUseCachedQuotaAfterRefreshErroraccount.access && expires > nowindex.tsmain profile hydrationmainAccessToken &&index.tsfallback sidebar profile!account.accessindex.tsmain sidebar profilemainAccessToken && mainStateindex.ts/claude-quotaauth.type === 'oauth' && auth.accessmainServedAccessToken ?? auth.accessindex.tskillswitch eager refreshBoolean(a.access)All widen to
local access || live vault binding. None admits an account with no credential anywhere. All six are reporting/refresh gates — no routing or serving eligibility rule is loosened, and theassertNotCustodyTombstonewire-refusal sites are untouched.The killswitch one is the only non-cosmetic member: a spend guard that skips its own freshness step degrades silently and in the expensive direction. Scoped honestly — the background poller still keeps that quota current, so the exposure is "may evaluate without forcing a fresh read", not "evaluates on stale data".
Commit 2 — reported-failed version refusal
Cross-family drift review caught that
liveMainVaultAccess(added in commit 1) hand-rolled its siblingresolveClaustrumAccessand dropped the sibling's stale-version guard. Reviewer probe: boot vault-served main → 401 →report_auth_failureat version N →/claude-quotastill sends that bearer. It now delegates, inheriting both the guard and the warm schedule.Implementing that surfaced a second, different defect:
mainServedAccessTokenwas never cleared. A bearer whose 401 we had already reported to the vault stayed the preferred main token for the process lifetime, with no reconciliation path — local belief diverging from what the vault was told. It is now cleared on a successful report only; clearing on a suppressed or failed report would make local state believe the vault knows something it was never told./claude-quotaalso had to move from??to||, or an empty served token short-circuits and the fix is inert on that path.Verification
Per-hunk revert evidence, one proof per site — with six hunks in play a whole-diff revert only shows the batch is load-bearing. One site's first two attempts produced a test that passed with its own fix reverted; the implementer reported that rather than shipping it green, and the assertion moved from end-state to action:
Commit 2's three proofs: warm callbacks
1 → 0, quota authorizations containing the dead bearer, and quota authorizations empty when the??/||chain is reverted.Gates on the rebased tree: core 200, opencode 1889, pi 114, e2e 36, typecheck 0, biome 0 across 189 files.
Deliberate scope:
get-before-report(re-fetch and retry on a vault-served 401 before reporting) is not in this PR. It is a larger behavioural change to a path a peer seat is currently measuring, and it deserves its own review.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes vault-served accounts being skipped by credential-presence checks, stops reusing a main vault bearer after its 401 was reported, and makes the Claustrum golden-pin check fail on drift or unchecked ancestry.
Bug Fixes
mainServedAccessTokenclears only after a successful auth-failure report; quota and profile paths use||instead of??so an empty served token doesn't short-circuit.liveMainVaultAccessdelegates toresolveClaustrumAccess, inheriting the stale-version refusal and warm schedule.cortexkit/claustrum, and the checker fails when the pinned ref no longer descends from the upstream default branch or content can't be verified.Written for commit 2df9d0e. Summary will update on new commits.
The PR is not yet safe to merge because cached quota can still cross identities when a non-scoped vault binding begins serving a replacement account.
Findings
Summary
This PR updates custody-aware credential gates so vault-served accounts participate in profile hydration, quota refresh, cached-quota recovery, and killswitch checks. It also refuses already-reported vault credential versions, clears successfully reported main credentials, centralizes the vault refresh TTL, and strengthens Claustrum fixture validation.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Account credential state] --> B{Local access available?} B -->|Yes| C[Use local credential] B -->|No| D{Live vault binding?} D -->|No| E[Exclude account] D -->|Yes| F[Resolve current vault credential] F --> G{Version previously reported failed?} G -->|Yes| E G -->|No| H[Hydrate profile and refresh quota] H --> I{Request returns auth failure?} I -->|No| J[Keep account eligible under quota policy] I -->|Yes| K[Report failed version to vault] K --> L{Report succeeded?} L -->|Yes| M[Clear served main token] L -->|No| N[Retain local state because vault was not notified]Reviews (2) · Last reviewed commit: "test(core): satisfy the tightened fetchI..."