You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): explain why a file outside the workspace can't be shown on the phone - #33341
A phone mirrors every desktop tab. A plain-text tab for a file outside its workspace (e.g. an external read-only file) can't be read from the phone, and tapping it used to show only "Couldn't load file preview". It now says "This file is outside the workspace. Open it on desktop to view it." The tab stays, so the phone's tabs still match the desktop's.
What Changed
documentReadErrorMessage in mobile/src/session/use-mobile-session-document-readers.ts maps the host's invalid_relative_path refusal to that message.
Why
A phone reads a file tab with files.read({ worktree, relativePath }). The host rejects an absolute path with invalid_relative_path (src/main/runtime/files/file-reads.ts:52), and its RPC layer sends that code as the runtime_error message, the same way file_too_large already arrives.
Hiding these tabs, the first version of this PR, would have made phone tabs differ from the desktop's, so users would think tabs were missing. Keeping the tab and saying why it can't be shown tells them where to go instead.
Compatibility: phone-only. Old and new desktops send the same code, and older phones keep the generic message.
Testing
use-mobile-session-document-readers.test.ts: a file-tab read refused with invalid_relative_path shows the explanation. The 19 tests in the file pass.
The changed-code gate passes.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Checklist
This PR is small and focused
I explained what changed and why
Before/after screenshots or videos attached for UI changes, or N/A with reason: N/A, one error-copy change in an existing error state
Cross-platform, SSH/remote, and path/shortcut impact considered: the code is the same on every platform and host type
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Walkthrough
The mobile session file-tab filter continues to exclude combined diff tabs. It now accepts Markdown files regardless of path and accepts other files only when relativePath differs from filePath. A new test checks snapshot tab types for read-only plaintext and Markdown files outside the workspace.
Priority: Normal
Merge Risk: Minimal · up to 6ac88
The mobile filter change is covered by targeted tests, with no actionable merge risk identified.
Pre-merge checks: 2 · 1 · 2
Failed checks: 1 warning · 2 inconclusive
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check
The title names the fix's main change: the phone now explains why a file outside the workspace can't be shown. It matches the PR's user-facing purpose, but the objectives describe a different change: …
Confirm which change this PR makes. The raw summary and PR objectives describe filtering plain-file tabs out of mobile tab publishing (mobile-session-surfaces.ts). The description describes a mobile error-message mapping in documentReadErro…
Description check
The description has the required sections: ELI5, What Changed, Why, Testing, Checklist. It leaves the Linked Issue section with the placeholder 'Fixes #' and no issue number. It also omits the Visual …
1) Replace 'Fixes #' with a real linked issue number. 2) Add the mobile-session-surfaces.ts change (the publishing filter for Markdown and relativePath) to What Changed, or explain why it is not part of this PR. 3) Confirm the Visual Proof …
Passed checks: 2 passed
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the fix's main change: the phone now explains why a file outside the workspace can't be shown. It matches the PR's user-facing purpose, but the objectives describe a different change: no longer publishing plain file tabs outside the workspace to phones. The title and the objectives therefore disagree on what the PR does, so the title does not clearly match the changeset as summarized.
Resolution
Confirm which change this PR makes. The raw summary and PR objectives describe filtering plain-file tabs out of mobile tab publishing (mobile-session-surfaces.ts). The description describes a mobile error-message mapping in documentReadErrorMessage and keeps the tab. Align the title, description, and code changes on one behavior, then retitle if needed, for example to state whether the phone hides the tab or shows an explanation for it.
Full details: Description check
Explanation
The description has the required sections: ELI5, What Changed, Why, Testing, Checklist. It leaves the Linked Issue section with the placeholder 'Fixes #' and no issue number. It also omits the Visual Proof section, though it says N/A with a reason in the checklist. The description explains the change in detail. The main gap is the Linked Issue, which the template says must always be present for outside contributors. The description also does not match the raw summary, which describes publishing rules in mobile-session-surfaces.ts that the description never mentions.
Resolution
Replace 'Fixes #' with a real linked issue number. 2) Add the mobile-session-surfaces.ts change (the publishing filter for Markdown and relativePath) to What Changed, or explain why it is not part of this PR. 3) Confirm the Visual Proof N/A reason is entered in the section itself, not only in the checklist. 4) State the AI Disclosure if an AI model was used, or leave it empty if the author is a StablyAI team member. 5) Mark the manual testing checkbox only if manual testing was done. The description states none was done.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
nwparker
changed the title
fix(mobile): stop publishing plain file tabs outside their workspace that phones can't read
fix(mobile): explain why a file outside the workspace can't be shown on the phone
Oct 25, 2026
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
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.
ELI5
A phone mirrors every desktop tab. A plain-text tab for a file outside its workspace (e.g. an external read-only file) can't be read from the phone, and tapping it used to show only "Couldn't load file preview". It now says "This file is outside the workspace. Open it on desktop to view it." The tab stays, so the phone's tabs still match the desktop's.
What Changed
documentReadErrorMessageinmobile/src/session/use-mobile-session-document-readers.tsmaps the host'sinvalid_relative_pathrefusal to that message.Why
files.read({ worktree, relativePath }). The host rejects an absolute path withinvalid_relative_path(src/main/runtime/files/file-reads.ts:52), and its RPC layer sends that code as theruntime_errormessage, the same wayfile_too_largealready arrives.Compatibility: phone-only. Old and new desktops send the same code, and older phones keep the generic message.
Testing
use-mobile-session-document-readers.test.ts: a file-tab read refused withinvalid_relative_pathshows the explanation. The 19 tests in the file pass.The changed-code gate passes.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Checklist
N/Awith reason: N/A, one error-copy change in an existing error state