Repository navigation
Conversation
kiro-cli's token refreshers serialise the same sign-in flow with different casing (PKCE and Pkce, minutes apart on one login). The fingerprint hashed the raw spelling, so a routine refresh read as an account change and the next turn's identity sweep retired idle chats together with their running spawn_run sub-agents. Case-fold oauth_flow before hashing. A genuine flow change still moves the fingerprint, and identifiers (start_url, client_id) stay exact. Refs kirodotdev#14979
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify CI runs [DESIGN-REVIEWED] db9da7f Description read[DESCRIPTION-READ] c4b4457847f0611688daa26c1331bb274813f06e684d8e764f75e50b09921aee That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the one premise: kiro-cli never distinguishes two real sign-in flows by casing alone — case-folding would silently merge them into one fingerprint. What this change shipsInventory (3 items) — 3 justifiedIntent: FIX — stop a routine kiro-cli token refresh (which re-spells
The mechanism is one private constant plus one [FIRST-PRINCIPLES-REVIEWED] db9da7f Description read[DESCRIPTION-READ] 7840ed7efb7cb77d0eb58403acbf73603cc7665e069e956b9eaaeccb5bf0b0b7 That sha256 names the PR description this verdict read. Recompute it with |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
|
Follow-up on the open question from the description: I ran the patched The remaining red check, Backend Tests (Windows) shard 1, fails in |
|
The Windows shard 1 failure reproduces on unrelated PRs today (same two tests in |
|
Thank you for this fix, @Flolight — the case-insensitive To get it onto an in-repo branch where the full CI and review lanes run, the change now continues in #16925. Your original commits are carried over unchanged, so you keep full credit in the commit history (you remain the author of both commits). #16925 is rebased on current Closing this PR in favour of #16925. Thanks again for the contribution and the thorough write-up! |
Problem / Motivation
Goal: A routine kiro-cli token refresh no longer reads as an account switch, so idle chats and their running
spawn_runsub-agents stop being retired about once an hour.kiro-cli's token refreshers write the same sign-in flow into the
kirocli:odic:tokenblob with different casing:PKCEandPkce, minutes apart, on one unchanged login (timeline in #14979).oauth_flowis one of the allowlisted stable claims inidentity_fingerprint, and_identity_claimshashes its raw spelling. The fingerprint therefore changes on those refreshes, and the next turn in any chat runs the identity sweep, which retires every idle chat and cancels the sub-agents it launched ("provider shutdown").Why it matters
Users whose kiro-cli refreshers alternate the
oauth_flowspelling lose long-runningspawn_runwork sessions without warning as soon as they use another chat after a refresh. On the reporter's machine this killed two running sub-agents in one afternoon, and the value flipped three times in 95 minutes. #14609 does not cover it: the chat was started under the pre-flip fingerprint, so it is still retired.Not a goal
oauth_flowchanges case), identity sweep kills runningspawn_runsub-agents #14979). Separate behaviour change.What changed (motivation → approach → change)
oauth_flowis compared byte-exact, and its spelling alternates between refreshers._CASE_INSENSITIVE_CLAIM_FIELDS = {"oauth_flow"};_identity_claimscase-folds those values before hashing.oauth_flowstays in the allowlist, so a real flow change (PKCE to device code) still moves the fingerprint. All other claims (start_url,client_id,region,scopes) keep exact comparison; the tests coverstart_urlandclient_id. Chosen over droppingoauth_flowfrom the allowlist, which would lose a signal that currently distinguishes two logins.Backwards compatibility
Compatible: the fingerprint is an in-memory digest compared within one process lifetime; its value changes once on upgrade (for every oauth_flow spelling), which is the same one-time effect as any restart, and nothing persists or rejects the old value.
Tests
In
test/test_external_logout_detection.py::TestIdentityFingerprint:test_oauth_flow_casing_is_not_an_account_change:PKCE,Pkce,pkcegive one fingerprint. Fails onmain, passes with the fix.test_an_oauth_flow_change_is_still_detected:PKCEtodevice_codestill changes it.test_start_url_and_client_id_stay_case_sensitive: case changes inclient_idorstart_urlstill change it.test/test_external_logout_detection.py: 173 passed.scripts/local-gate.py: 2232 passed, 2 failed intest/test_kiro_prerequisite.py(test_timeout_without_a_runnable_candidate_is_still_not_installed,test_no_candidate_has_nothing_to_report); both fail identically on unmodifiedmainon the same macOS machine, so they are environment-related and not caused by this diff. black, isort, flake8 clean;mypy --platform linuxclean on the changed module.Manual verification
N/A: unit coverage exercises the exact store shape. The casing flip itself was observed on a live store and is documented in #14979.
Related Issues
Fixes #14979. Related: #14605, #14609.
Pattern harvest
Not generalizable:
oauth_flowis the only allowlisted claim that is a label rather than an identifier, and the allowlist is already the guard for new fields.Checklist
identity_fingerprintContribution License Agreement