Skip to content

fix: worktree session files fail to open with "Session workspace changed during file read" - #172579

Merged
roboclaw-bot merged 1 commit into
mainfrom
fix/worktree-file-preview-read-source
Oct 14, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
fix/worktree-file-preview-read-source

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: files in a project worktree session fail to open in the side panel or Files panel with Session workspace changed during file read, even when nothing about the session has changed.

User Impact

User impact: HTML previews and other files from worktree-backed sessions open again in the Control UI. Sessions without a worktree were not affected.

Why This Change Was Made

sessions.files.list and sessions.files.get re-read the session after waiting for sandbox settlement, to refuse the read if the session was reset or moved to a different worktree in the meantime. Since #169757, that re-read used the logical session store path, which the retained-facts reader does not recognize, so it always came back empty and every worktree read was refused. The re-read now uses the session's captured read source, the same way the other retained-facts callers do. The safety check itself is unchanged.

Evidence

Real Gateway (isolated test instance), real project worktree session created with sessions.create, Control UI in Chromium, clicking an assistant link to halloween-theme/preview.html:

Before (current main code):

Before: the preview tab shows "Error: Session workspace changed during file read"

After (this PR):

After: the same link opens the rendered HTML preview

  • New src/gateway/server-methods/sessions-files.worktree.test.ts (real SQLite session storage and Gateway handlers):
    • reads files from a worktree session: fails on main with Session workspace changed during file read, passes with this change.
    • refuses the read when the session moves to another worktree during settlement: passes, so the guard still works.
  • Neighboring sessions-files suites: 6 files, 89 tests passed.
  • pnpm tsgo:core and the gateway test typecheck shards passed; oxfmt --check clean.

The browser proof used a temporary real-Gateway Control UI spec that is not part of this PR; the Gateway-level test above is the regression coverage.

Reported by @Patrick-Erichsen.

Work sessions

… source

sessions.files list/get for managed-worktree sessions re-reads the session
entry during settlement to detect a reset or worktree change. Since #169757
that re-read passed the logical store path to readRetainedSessionEntryFacts,
which only knows the physical SQLite path, so it always returned undefined
and every request failed with "Session workspace changed during file read".

Use the captured read source path, matching the other retained-facts callers.

Co-authored-by: Patrick-Erichsen <[email protected]>
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 14, 2026 21:59
@clawsweeper

clawsweeper Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Oct 14, 2026
@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) October 14, 2026 22:05
@roboclaw-bot
roboclaw-bot merged commit 52ecede into main Oct 14, 2026
190 checks passed
@roboclaw-bot
roboclaw-bot deleted the fix/worktree-file-preview-read-source branch October 14, 2026 22:31
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
… source (openclaw#172579)

sessions.files list/get for managed-worktree sessions re-reads the session
entry during settlement to detect a reset or worktree change. Since openclaw#169757
that re-read passed the logical store path to readRetainedSessionEntryFacts,
which only knows the physical SQLite path, so it always returned undefined
and every request failed with "Session workspace changed during file read".

Use the captured read source path, matching the other retained-facts callers.

Co-authored-by: Patrick-Erichsen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant