Repository navigation
fix(efficacy): keep a token a trial refreshed when the credential link is remade - #84
Merged
Merged
Conversation
…k is remade A trial's CLI saves a refreshed token as a new file, which breaks the scratch home's hard link to the account's credentials. The next re-link discarded that file and handed the next trial the rotated-out refresh token, so the trial failed at its first call and the run waited for a login. refresh_credentials now writes a home file that expires later back over the account's file, in place, before remaking the link. Closes #83 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX
The expiry comparison and the copy back were separate steps, so a second run could write a newer token between them and the first then overwrote it with its older one, in the account's file and every home linked to it. The compare, the write and the re-link now hold a lock file beside the account's credentials; a lock older than a minute, left by a dead run, is broken. Two self-test checks: the race, paused between the reads and the write, and a stale lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX
…hat writes them The lock holds off a second run, not the CLI, which saves its token by replacing the account's file. A save landing between the expiry comparison and copyfile() had its newer token overwritten, since copyfile() opened the replacement. write_back() now reads the account's expiry through the handle it then writes, and after writing checks the path still names that file; where a save replaced it, it compares again against the save rather than overwriting it. A self-test check races a replacement against the write-back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX
This was referenced Oct 30, 2026
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.
Stops runs stalling every 8 hours on an expired login. When a trial's CLI refreshes the token, the harness now keeps the new token instead of discarding it.
Before and after
What changed where
tests/efficacy/harness.pyexpires_at();refresh_credentialswrites back a newer home file;account=for teststests/efficacy/harness.pycredential_rotation_checks(): 4 checks on a fake account filedocs/architecture/06-runtime-view.mdChecks
The running round 5c keeps its old code; a watcher outside the harness covers it until the run restarts.
Closes #83
🤖 Generated with Claude Code
https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX