fix(sessions): make session path encoding injective and verify cwd on resume#96679
fix(sessions): make session path encoding injective and verify cwd on resume#96679maweibin wants to merge 1 commit into
Conversation
… resume (openclaw#96542) getDefaultSessionDir replaces path separators with '-' which means "client/app" and "client-app" produce identical encoded paths, causing session cross-contamination. Fix: use percent-encoding (%2F/%5C/%3A) to distinguish separators from literal hyphens. Also add cwd verification in continueRecent so that if a session file from a colliding directory is found, the code scans remaining files for one matching the requested cwd before falling back to a fresh session. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed June 25, 2026, 9:04 PM ET / 01:04 UTC. Summary PR surface: Source +39. Total +39 across 1 file. Reproducibility: yes. source-reproducible: current main and Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Preserve or migrate shipped default session directories while making resume/list select only sessions with a validated string Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main and Is this the best way to solve the issue? No. The PR touches the right session-manager boundary, but changing the shipped directory key without migration or legacy discovery is not upgrade-safe, and the new cwd check should validate the header type before resolving it. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a0b397748fa3. Label changesLabel justifications:
Evidence reviewedPR surface: Source +39. Total +39 across 1 file. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
Closing as this PR has low merge likelihood (unranked/silver rating, missing proof, security concerns). The fix approach may be revisited with better evidence in a future PR. |
What Problem This Solves
Issue #96542 reports that two genuinely different project directories whose paths differ only by a path separator (e.g.,
client/appvsclient-app) get encoded to the same session directory. When a user runscontinueRecentto resume the most recent session, it silently loads the other project's conversation history. The agent then executes tools in the requested cwd while carrying an unrelated project's transcript — with no cwd check ever catching the mismatch.Why This Change Was Made
Two linked defects:
getDefaultSessionDir:/,\,:all mapped to-, soclient/appandclient-appproduced the same encoded dir.findMostRecentSessionpicks the newest file by mtime without checkingheader.cwdagainst the requested cwd.The fix replaces the lossy mapping with percent-encoding (
/→%2F,\→%5C,:→%3A, with%escaped first) and adds cwd verification incontinueRecent. Onlysrc/agents/sessions/session-manager.tschanged.Evidence
Encoding is now injective — colliding path pairs produce different session dirs, normal paths unchanged, percent signs escaped:
Regression tests: 94 tests pass (2 files, including new coverage for encoding and cwd resume verification).
Format / lint:
oxfmt --checkclean,oxlintclean,git diff --checkno output.AI-assisted: Claude Code (Anthropic).