Harden Claude stale-session recovery#32
Merged
dimavrem22 merged 1 commit intoJul 9, 2026
Merged
Conversation
Claude resume recovery should handle the same missing-session failure even when it appears after client startup, without turning arbitrary runtime failures into retry loops. Constraint: PR inkbox-ai#29 only recovered the missing-resume path around client startup; SDK failures can also surface while submitting or reading a turn. Rejected: Retry every Claude turn failure | that could hide real login, permission, or process failures and create confusing loops. Confidence: high Scope-risk: narrow Directive: Keep retries limited to the known missing-resume signature and preserve actionable notices for all other turn failures. Tested: .venv/bin/python -m pytest tests/test_sessions.py -q; .venv/bin/python -m pytest -q Not-tested: Live iMessage turn with a mid-query missing resume from the real SDK.
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.
Summary
/healthor/clearnotice path while closing the broken client.Fixes #31
Why
PR #29 fixed the exact failure we hit through real Inkbox iMessage testing: Claude Code could not find an old saved conversation id, and the bridge now clears that stale id when the failure happens during startup.
This follow-up tightens the adjacent edge cases. The same missing-session error can surface after the client has connected, while the bridge submits the turn or starts reading the response. That is still the same recoverable stale-resume problem, so it should use the same one-time fresh retry instead of falling through to an error notice.
The cleanup also now drops conversation-scoped always-allowed tool grants when abandoning the old Claude conversation, so the fresh session does not inherit grants from stale context.
Validation
.venv/bin/python -m pytest tests/test_sessions.py -q.venv/bin/python -m pytest -qNotes
No conversation found with session IDcase.