Stop silently wiping Ask Lucid memory on a slow resume#110
Merged
Conversation
A resumed turn was abandoned after a 15s first-output deadline and re-run as a fresh, memoryless `claude -p` session — silently dropping the whole conversation. Coding turns plan before their first token and the phone waits up to 90s, so any resume slow past 15s wiped memory invisibly, with no error and nothing in the diagnostics dump. Align the daemon's resume first-output deadline with the phone's per-surface first-token budget: 30s for the pod ask path, a new 90s for coding. We no longer abandon a resume the phone is still awaiting. A genuinely dead handle still falls back to fresh — now after the phone's own timeout + lost/recover grace already cover the wait; an ended (empty) stream self-heals immediately as before.
This was referenced Jul 9, 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.
Fixes #107.
The bug
On the Code tab, Ask Lucid would answer a follow-up with zero memory of the earlier turns — no error, nothing in the diagnostics dump. It wasn't the socket: there was no reconnect between the message that still had memory and the one that didn't.
Every turn runs
claude -p --resume <sessionId>. The daemon bounded the resumed run with a 15s first-output deadline (RESUME_FIRST_OUTPUT_MS); if no first token arrived in 15s it assumed the--resumehandle was dead and silently re-ran withresume: undefined— a fresh, memoryless session in the same worktree (runCodeTurn.ts, same shape for the podaskinroom/client.ts). The fresh turn answers normally and hands back a new session id that the phone adopts, so the thread is re-anchored to a session that never saw the earlier messages.The mismatch: the phone waits 90s for a coding turn's first token (
CODE_FIRST_TOKEN_TIMEOUT) because coding turns legitimately plan/read before answering — but the daemon gave up at 15s. Any resumed coding turn slow past 15s silently lost its memory. (The executor only yields on the first assistant token, so this "first-output" window is really time-to-first-token.)The fix
Align the daemon's resume first-output deadline with the phone's per-surface first-token budget:
RESUME_FIRST_OUTPUT_MS15s → 30s (= phoneDEFAULT_FIRST_TOKEN_TIMEOUT)RESUME_CODE_FIRST_OUTPUT_MS= 90s (= phoneCODE_FIRST_TOKEN_TIMEOUT)We no longer abandon a resume the phone is still awaiting. A genuinely dead/pruned handle still falls back to fresh — just after this window, where the phone's own timeout + lost/recover grace already cover the wait. An ended (empty) stream still self-heals immediately as before; only a hanging handle waits out the deadline.
Tests
Follow-ups (filed separately)
'open'socket + orphaned send).