fix(executor): validate session files exist before attempting resume#305
Merged
fix(executor): validate session files exist before attempting resume#305
Conversation
When resuming a session with --resume, validate that the session file actually exists before passing the flag to the CLI. This prevents ENOENT errors when session files are deleted or cleaned up externally. Changes: - Add ClaudeSessionExists() to validate Claude session files - Add codexSessionExists() to validate Codex session files - Add geminiSessionExists() to validate Gemini session files - Update all resume code paths to validate before using --resume: - runClaude, runClaudeResume - resumeClaudeDangerous, resumeClaudeSafe - runCodex (Codex executor) - runGemini (Gemini executor) - resumeCodexWithMode, resumeGeminiWithMode - Clear stale session IDs from DB when session file is missing Fixes issue where Gemini/Codex/Claude would fail with ENOENT when trying to resume a session whose file no longer exists. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
--resumeflagContext
PR #300 added session resume support for Gemini/Codex using
--resume <sessionID>. However, if the session file was deleted (manually, by CLI cleanup, or never created), the CLI would fail with:This fix validates that the session file exists before attempting to resume. If missing, it logs a message, clears the stale session ID from the DB, and starts fresh instead.
Test plan
go build ./...compiles successfullygo test ./internal/executor/...passes🤖 Generated with Claude Code