Skip to content

CM-72432: Retry token mint when a concurrent login is refused - #546

Merged
Ilanlido merged 1 commit into
mainfrom
CM-72432-retry-token-mint-on-auth-conflict
Sep 15, 2026
Merged

Ilanlido merged 1 commit into
mainfrom
CM-72432-retry-token-mint-on-auth-conflict

Conversation

@Ilanlido

Copy link
Copy Markdown
Collaborator

AI guardrails runs one CLI process per hook, and every process shares one cached token with a single expiry stamp, so a burst of them mints at the same instant. The identity provider's brute-force protection refuses same-user logins that land within milliseconds of each other, so all but the first are rejected. The refused scans fail open and record a scan failure, leaving the interaction unscanned.

On a 401 during refresh, wait briefly and prefer the token the winning process has just persisted, minting again only if nobody won. The wait is randomized so the refused processes do not collide a second time.

Comment thread cycode/cyclient/base_token_auth_client.py Outdated
AI guardrails runs one CLI process per hook, and every process shares one cached
token with a single expiry stamp, so a burst of them mints at the same instant.
The identity provider's brute-force protection refuses same-user logins that land
within milliseconds of each other, so all but the first are rejected. The refused
scans fail open and record a scan failure, leaving the interaction unscanned.

On a 401 during refresh, wait briefly and prefer the token the winning process has
just persisted, minting again only if nobody won. The wait is randomized so the
refused processes do not collide a second time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Ilanlido
Ilanlido force-pushed the CM-72432-retry-token-mint-on-auth-conflict branch from 4cd809b to b439bf0 Compare September 14, 2026 17:47
@Ilanlido
Ilanlido enabled auto-merge (squash) September 15, 2026 11:09
Comment thread cycode/cyclient/base_token_auth_client.py
@Ilanlido
Ilanlido merged commit ccf15f2 into main Sep 15, 2026
28 checks passed
@Ilanlido
Ilanlido deleted the CM-72432-retry-token-mint-on-auth-conflict branch September 15, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants