Expand description
Session persistence for crash recovery.
Responsibilities:
- Save, load, and clear session state to/from .ralph/cache/session.jsonc.
- Validate session state against current queue state.
- Provide session recovery detection and prompts.
Not handled here:
- Session state definition (see crate::contracts::session).
- Task execution logic (see crate::commands::run).
Invariants/assumptions:
- Session file is written atomically using fsutil::write_atomic.
- Session is considered stale if task no longer exists or is not Doing.
- Session timeout is checked before allowing resume.
Enums§
- Session
Validation Result - Result of session validation.
Functions§
- check_
session - Check for existing session and return validation result.
- clear_
session - Clear (delete) the session file.
- get_
git_ head_ commit - Get the git HEAD commit hash for session tracking.
- increment_
session_ progress - Increment the session’s tasks_completed_in_loop counter and persist.
- load_
session - Load session state from disk.
- prompt_
session_ recovery - Prompt the user for session recovery confirmation.
- prompt_
session_ recovery_ timeout - Prompt the user for session recovery with timeout warning.
- save_
session - Save session state to disk.
- session_
exists - Check if a session file exists.
- session_
path - Get the path to the session file.
- validate_
session - Validate a session against the current queue state.