Skip to content

fix(mobile): explain why a file outside the workspace can't be shown on the phone - #33341

Merged
nwparker merged 2 commits into
mainfrom
nwparker/mobile-outside-workspace-tabs
Oct 25, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/mobile-outside-workspace-tabs

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​49 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​48
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4

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

  • 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

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9833b353-505c-48dc-86a9-b06477224dfa
Commits

Reviewing files that changed from the base of the PR and between 4b752de and 6ac8809.

Files selected for processing: 2
  • src/renderer/src/runtime/sync-runtime-graph-outside-workspace-file-tabs.test.ts
  • src/renderer/src/runtime/sync-runtime-graph/mobile-session-surfaces.ts

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: Passed 2 · Failed 1 · Inconclusive 2

Failed Failed checks: 1 warning · 2 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Warning 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 Inconclusive 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 Inconclusive 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 Passed checks: 2 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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

  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 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker 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
@nwparker
nwparker merged commit 9017194 into main Oct 25, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant