fix(sessions): skip auto-resume for sessions whose history is gone - #561
Open
RonenMars wants to merge 1 commit into
Open
fix(sessions): skip auto-resume for sessions whose history is gone#561RonenMars wants to merge 1 commit into
RonenMars wants to merge 1 commit into
Conversation
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 #483.
The problem
Boot auto-resume spent one of its concurrency slots on every registry row it planned to resume, including rows whose provider history no longer exists on disk. Those attempts can only fail, and they fail after taking the slot — so a handful of dead rows delayed or crowded out the sessions that could actually come back.
planAutoResume()had no way to know: it checked whether the project directory still existed, but not whether the conversation history did.The change
A bounded pre-flight pass resolves each candidate's conversation target before planning, and rows whose history is missing are skipped rather than attempted.
autoResumeSkipReason()is now exported so the pre-flight can cheaply drop rows that would be skipped anyway — no point resolving a target for a row already failing the age or project-exists test.AUTO_RESUME_CONCURRENCY, awaitingPromise.racewhen the in-flight set is full, so it does not itself become an unbounded fan-out at boot.historyExists: true, deliberately preserving the existing per-attempt failure handling rather than silently converting an unknown into a skip.planAutoResume()gains ahistoryExistspredicate, defaulted to() => trueso every other caller behaves exactly as before.Codex path fixed alongside
Resolving the target surfaced a gap for Codex placeholder ids: neither the conversation lookup nor the JSONL path is keyed by the placeholder, so a Codex row could resolve no project path and be reported as
history_file_missing— permanently unretryable — when its rollout was in fact present in the cache.resolveConversationTarget()now falls back to the cached conversation meta when the row is Codex and the cached path exists on disk, feeding bothprojectPathandhistoryPath. Thehistory_file_missingverdict now requires that fallback to have failed too.Note
historyPathis still kept separate fromjsonlPath: feeding it toconversationBusy()would arm the mtime heuristic for Codex, which is the over-broad signal the original report ruled out.Verification
tsc --noEmitclean;biome checkclean across 378 files.__tests__/auto-resume-on-boot.test.tsgrows by 278 lines covering the skip path, the concurrency bound, and the Codex fallback.A note for anyone verifying on this branch in place: it lives in a worktree under
.worktrees/, wherenpm run lintsilently checks nothing — biome ignores dot-directories, sobiome check .reports "These paths were provided but ignored: ." and exits clean. The checks above were run with explicit paths.