feat(client): add resumable CLI sessions - #185
Conversation
Introduce persistent client session snapshots so chat, run, and script commands can resume prior conversation context across CLI invocations. Key changes: - add a session store under workspace .dare/sessions with snapshot save/load/list support - add --resume handling for chat, run, and script flows plus interactive /sessions list and top-level sessions list commands - extend parser, CLI orchestration, docs, OpenSpec artifacts, and governance evidence for the new session-management workflow - add unit and integration coverage for resume persistence and session discovery Rationale: - make the local CLI baseline closer to Codex CLI / Claude Code style continuity - remove the need to manually inspect persisted session files before resuming work - keep the implementation scoped to history restoration without introducing runtime checkpoint semantics yet
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 149e4e5dc2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Address review feedback about session-id traversal handling in the CLI session snapshot store. Key changes: - enforce a strict allowlist for session IDs - reject traversal-like tokens such as dot-dot even in tampered payloads - resolve snapshot paths and enforce they stay under workspace session storage - add unit coverage for invalid session IDs and tampered snapshots Rationale: - keep resume/session persistence scoped to workspace-owned snapshot files - prevent crafted resume targets or snapshot contents from escaping session-store boundaries
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c29366fe65
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| f"{schema_version or '<missing>'}" | ||
| ) | ||
|
|
||
| session_id = self._normalize_session_id(raw.get("session_id")) |
There was a problem hiding this comment.
Enforce snapshot filename/session_id consistency
_load_path trusts the session_id inside JSON without checking that it matches the file being loaded, and _build_session_state then uses that payload value as the active conversation id. If a snapshot file is renamed or copied (e.g. alias.json containing "session_id": "real-session"), --resume alias restores one session but subsequent saves write to real-session.json, silently updating the wrong session history; this can corrupt/rescope results for explicit resume targets. Reject mismatches between path.stem and parsed session_id when loading.
Useful? React with 👍 / 👎.
Summary
.dare/sessionsdirectory so chat, run, and script flows can resume prior conversation history--resumesupport plussessions listand/sessions listso resumable sessions can be discovered without manually browsing stored filesTest Plan
.venv/bin/python -m pytest -q tests/unit/test_client_cli.py.venv/bin/python -m pytest -q tests/integration/test_client_cli_flow.pyopenspec validate client-session-resume./scripts/ci/check_governance_traceability.sh./scripts/ci/check_governance_evidence_truth.shNotes