Repository navigation
fix(switch): a global switch between stores with one mtime now reaches running sessions - #1
Closed
xingfanxia wants to merge 1 commit into
Closed
xingfanxia wants to merge 1 commit into
xingfanxia wants to merge 1 commit into
Conversation
…s running sessions Claude Code re-reads .credentials.json only when the mtime of what the link resolves to differs from the one it memoized. The runtime swap already moves the incoming store mtime first; the global switch (clauth switch, and the guarded relink) did not, so between two stores carrying the same mtime the link moved, the switch reported success, and running sessions kept authenticating as the account they had been switched off. Both relinks now stamp the incoming store through the same touch and receipt the runtime swap uses, only when the live path resolves to a different store with an equal mtime, after the Keychain mirror and before the repoint. Also corrects the session-token sample in docs/claude-split: a sidecar that carries a refreshToken key, even empty, is not accepted and the switch then installs the rotating pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Superseded: the fix landed on fork main as 40ebca4 + faad403 (ported from upstream PR uwuclxdy#175). |
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.
This makes a global switch reach sessions that are already running when the two credential stores happen to carry the same mtime. Claude Code re-reads
.credentials.jsononly when the mtime of what the link resolves to differs from the one it memoized. The runtime swap already stamps the incoming store first;clauth switchand the guarded relink did not, so between two equal-mtime stores the link moved, the command reported success, and running sessions kept using the account they had been switched off. I moved the stamp body ofruntime::touch_storeintotouch_store_atso both paths share one stamp and one touch receipt, and call it fromforce_link_profile_credentialsandlink_profile_credentialsafter the Keychain mirror and before the repoint, only when the live path resolves to a different store with an equal mtime. Beyond the ask, I corrected the session-token sample indocs/claude-split/README.md: a sidecar that carries arefreshTokenkey, even empty, is not accepted as a session token, and the switch then installs the profile's rotating pair into the live slot; I reproduced that with synthetic profiles. I did not build or test on macOS.agent
cargo fmt --all -- --checkclean;cargo test --release --locked -- claude:: runtime:: profile_cache::387 passed, 0 failed, including three new tests;cargo clippy --locked --all-targets --all-features --release -- -D warningsfails at two places this change does not touch. Full suite not run. operator verification: unknowncommands and details
global_switch_between_equal_mtime_stores_stays_visible_to_running_sessions(A→B→A),guarded_relink_between_equal_mtime_stores_stays_visible_to_running_sessions,global_switch_leaves_a_store_alone_when_its_mtime_already_differs.clauth switchA→B→A. The sink saw A, A, A before this change and A, B, A with it.src/daemon/api/mod.rs:144(deprecatedfetch_update) andsrc/fallback.rs:1775(needless borrow).