fix: session output returns stale cache after /clear#477
Open
lshoravi wants to merge 1 commit intoasheshgoplani:mainfrom
Open
fix: session output returns stale cache after /clear#477lshoravi wants to merge 1 commit intoasheshgoplani:mainfrom
lshoravi wants to merge 1 commit intoasheshgoplani:mainfrom
Conversation
GetLastResponseBestEffort() read the JSONL file at the stored ClaudeSessionID, which succeeded with stale data because the pre-/clear file still exists on disk. The recovery paths (syncClaudeSessionFromDisk) only ran on error, so the newer session file was never discovered. Move session ID sync (tmux env + disk scan) to run proactively before the first read attempt, not as a fallback after failure. Closes: stale output after /clear
lshoravi
added a commit
to lshoravi/agent-deck
that referenced
this pull request
Apr 2, 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.
Hi, thanks for the great application. I'm submitting some stuff I changed locally, in case you want it upstream. (PR 2/3)
Summary
session outputreturned the pre-/clearresponse becauseGetLastResponseBestEffort()read from the old JSONL file (which still exists on disk) before checking whether a newer session file was availablesyncClaudeSessionFromDisk) to run before the first read attempt, not as a fallback after failureRoot cause
After
/clear, Claude Code creates a new session UUID on disk. The storedClaudeSessionIDstill pointed to the old file.getClaudeLastResponse()read the old file successfully, so the recovery paths (syncClaudeSessionFromDisk) never executed.Test plan
TestGetLastResponseBestEffort_ReturnsNewSessionAfterClear: sets up old + new JSONL files, pointsClaudeSessionIDat the old one, verifiesGetLastResponseBestEffortreturns the new content/clearon a waiting session, let it complete a new task, verifyagent-deck session output <session> -qreturns the new response