Repository navigation
fix(logout): remove a corrupt session file instead of keeping it - #727
Merged
LeMyst merged 1 commit intoOct 17, 2026
Merged
Conversation
LeMyst
reviewed
Oct 13, 2026
LeMyst
left a comment
Collaborator
There was a problem hiding this comment.
Looks good to me. SyncSession::load returns Err for an unreadable file, invalid JSON, or valid JSON with a malformed JWT, and the file is now removed in all three cases. If session.json is a directory, remove_file fails and the error surfaces cleanly.
- Nit: the comment ("only fails when the file exists but cannot be read or parsed") leaves out the bad-JWT case.
- Optional: a test with
common::with_isolated_configwould be easy.
🤖 Analysis and recommendations made by Claude (Anthropic's AI assistant), posted on behalf of @LeMyst.
A session file that fails to parse hit the `Not logged in.` arm and was left on disk, so `cook logout` could never get rid of it and every later command kept loading the same corrupt file. An unreadable file is still a session file: warn, remove it, and report the logout. Closes #716
drawmeanelephant
force-pushed
the
fix/716-logout-corrupt-session
branch
2 times, most recently
from
October 14, 2026 13:27
ec8983d to
60ef392
Compare
Contributor
Author
|
Comment updated to cover the malformed-JWT case — |
LeMyst
approved these changes
Oct 14, 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.
Closes #716
A session file that fails to parse fell into the
Not logged in.arm and stayed on disk, socook logoutcould never remove it.SyncSession::loadonly errors when the file exists but can't be read/parsed, so that arm now warns, deletes the file, and reports the logout.Test plan
session.json+cook logout→ warns, removes file, printsLogged out.cook logout→Not logged in.