Skip to content

fix(mobile): load markdown tabs from any desktop split group; center load-error Retry - #28132

Merged
Jinwoo-H merged 4 commits into
mainfrom
mobile-markdown-load-fix
Oct 13, 2026
Merged

Jinwoo-H merged 4 commits into
mainfrom
mobile-markdown-load-fix

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​70 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​61
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​91 $\color{#cf222e}{\Huge{\mathbf{−}}}$​112 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21

What was wrong

On the phone, a markdown tab could show "Couldn't load markdown" even though the file was small and readable. This happened whenever the tab was in a desktop split group that the desktop wasn't focused on. The desktop only looked for the tab in its focused group, so it answered "tab not found". The phone only reads the file itself for a headless host, so it showed the generic error.

The reported tab matched this exactly: the markdown file was in the right-hand split group and the desktop was focused on the terminal group. The file being outside the workspace had nothing to do with it. A desktop with a window reads such files normally.

The error screen also had a layout bug. The Retry button was pinned to the left edge instead of sitting centered under the message.

What changed

  • Desktop: reading or saving a markdown tab for the phone now looks up the tab across all of the workspace's split groups, using the exact tab the phone asked for. The phone and the wire format are unchanged, so phones already in use get the fix when the desktop updates.
  • Phone: load errors now share one component that centers the message with its Retry button under it. The markdown reader, the session file reader, file preview, media preview and the file explorer all use it.
  • The error text is still "Couldn't load markdown". A desktop that hasn't been updated still reports a split-group tab as missing, so a more specific message like "tab closed" would be false there.

Verification

  • Reproduced on emulator-5624 against an isolated, hidden desktop: an external markdown tab in a split group while the desktop stays focused on its terminal group.
  • Before: the error, with Retry pinned left.
  • After: the same tab loads.
  • Layout check: the error state is centered when an error does happen. This shot uses the new page bundle on the old desktop, so the error can be forced.
  • Regression tests: one reads a tab in a split group the desktop isn't focused on, and one reads the requested tab when the same file is open in two groups. Both fail without the fix.
  • pnpm tc:web, mobile tsc, bridge tests, the full mobile suite, page-closure tests, oxlint and the changed-code quality gate all pass.
Before After: loads After: error layout
Before: Couldn't load markdown with Retry pinned left After: the split-group markdown tab loads After: error message with Retry centered

before-markdown-error

after-markdown-loads

after-error-layout

…er load-error Retry

The desktop answered markdown.readTab only for tabs in its focused split
group, so a phone opening a markdown tab from another group got
tab_not_found and showed "Couldn't load markdown". Resolve the tab across
all of the worktree's groups.

Load-error states now share one component that centers the message and its
Retry button; the markdown reader's button was pinned to the left.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c0c64ecd-6aa0-441c-bba3-1355053f09c7
📥 Commits

Reviewing files that changed from the base of the PR and between 5780f20 and 40f5dac.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The mobile views now use a shared error-state component, with retry actions where provided. Markdown bridge target resolution now looks up the requested editor tab in the worktree’s unified tabs. Added tests cover reads from an unfocused split group and requests for a specific tab when the same file appears in two groups.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 5780f

Saving from an unfocused split group is not covered by the new regression tests. Adding that test would improve confidence before merging; no current save failure is established.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes both primary changes: resolving mobile markdown tabs across desktop split groups and centering the load-error Retry control.
Description check Passed The description clearly explains the problem, user-visible behavior, implementation changes, verification steps, regression coverage, and visual results. It does not follow every template heading and …
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.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/renderer/src/runtime/mobile-markdown-bridge.test.ts (1)

150-178: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a save regression case for split-group resolution.

The new duplicate-tab test exercises only operation: 'read'. saveMobileMarkdownTab calls resolveMarkdownTarget separately at the start of the save and again inside the save queue. Existing save tests use only the default tab-md fixture. They do not cover a requested tab in an unfocused split group. A regression can therefore make mobile saving return tab_not_found or select the wrong target while all current tests pass.

Suggested fix
   it('reads the requested tab when the same file is open in two groups', async () => {
     openMarkdownFile()
     useAppStore.setState({
       unifiedTabsByWorktree: {
         'wt-1': [
           markdownUnifiedTab('tab-main', '/repo/README.md', 'group-main'),
           markdownUnifiedTab('tab-split', '/repo/README.md', 'group-split')
-        ]
+        ],
+      groupsByWorktree: {
+        'wt-1': [
+          { id: 'group-main', worktreeId: 'wt-1', activeTabId: 'tab-main', tabOrder: ['tab-main'] },
+          { id: 'group-split', worktreeId: 'wt-1', activeTabId: 'tab-split', tabOrder: ['tab-split'] }
+        ]
+      },
+      activeGroupIdByWorktree: { 'wt-1': 'group-main' }
       }
     })
-    setupWindow({ readFile: vi.fn().mockResolvedValue({ content: '# both', isBinary: false }) })
+    let diskContent = 'original'
+    const readFile = vi.fn().mockImplementation(async () => ({
+      content: diskContent,
+      isBinary: false
+    }))
+    const writeFile = vi.fn().mockImplementation(async ({ content }) => {
+      diskContent = content
+    })
+    setupWindow({ readFile, writeFile })
     const detach = attachMobileMarkdownBridge()
+    const detachAutosave = attachEditorAutosaveController(useAppStore as never)

     try {
       const response = await sendRequest({
         id: 'read-duplicate',
         operation: 'read',
@@
         result: { tabId: 'tab-split', filePath: '/repo/README.md', content: '# both' }
       })
+
+      const save = await sendRequest({
+        id: 'save-duplicate',
+        operation: 'save',
+        worktreeId: 'wt-1',
+        tabId: 'tab-split',
+        baseVersion: hashMarkdownContent('original'),
+        content: 'mobile edit'
+      })
+
+      expect(writeFile).toHaveBeenCalledWith(
+        expect.objectContaining({ filePath: '/repo/README.md', content: 'mobile edit' })
+      )
+      expect(save).toMatchObject({
+        id: 'save-duplicate',
+        ok: true,
+        result: { tabId: 'tab-split', content: 'mobile edit' }
+      })
     } finally {
+      detachAutosave()
       detach()
     }
   })

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 13ee5982-1bba-48ca-9097-8a2c21bc2a6a
📥 Commits

Reviewing files that changed from the base of the PR and between 92a520c and 5780f20.

📒 Files selected for processing (16)
  • mobile/src/components/MobileLoadErrorState.tsx
  • mobile/src/files/MobileFileExplorerPanel.tsx
  • mobile/src/files/MobileFileMediaPreview.tsx
  • mobile/src/files/MobileFilePreviewBody.tsx
  • mobile/src/files/mobile-file-explorer-styles.ts
  • mobile/src/files/mobile-file-preview-styles.ts
  • mobile/src/session/MobileMarkdownReader.tsx
  • mobile/src/session/MobileSessionFileReader.tsx
  • mobile/src/session/MobileSessionMarkdownReader.test.tsx
  • mobile/src/session/MobileSessionMarkdownReader.tsx
  • mobile/src/session/mobile-session-review-comment-styles.ts
  • mobile/src/session/session-markdown-source-copy.test.tsx
  • src/renderer/src/runtime/mobile-markdown-bridge-save-guards.test.ts
  • src/renderer/src/runtime/mobile-markdown-bridge-test-harness.ts
  • src/renderer/src/runtime/mobile-markdown-bridge.test.ts
  • src/renderer/src/runtime/mobile-markdown-bridge.ts
💤 Files with no reviewable changes (4)
  • src/renderer/src/runtime/mobile-markdown-bridge-save-guards.test.ts
  • mobile/src/session/mobile-session-review-comment-styles.ts
  • mobile/src/files/mobile-file-preview-styles.ts
  • mobile/src/files/mobile-file-explorer-styles.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@Jinwoo-H
Jinwoo-H merged commit 26cd1c2 into main Oct 13, 2026
53 of 55 checks passed
@Jinwoo-H
Jinwoo-H deleted the mobile-markdown-load-fix branch October 13, 2026 02:57
karlorz added a commit to karlorz/orca that referenced this pull request Oct 13, 2026
* Update README downloads badge

* fix(i18n): drop chat-mode keys removed from en.json in stablyai#28113 (stablyai#28131)

* Speed up Mobile Checks by overlapping typechecks and tests (stablyai#28127)

Overlap mobile typechecks with tests and avoid repeated filesystem probes and unused device substitutes in recording replays. Keep state isolated between loaders, give exhaustive snapshot cases an explicit execution deadline, and retire obsolete locale keys that blocked repository validation.

* fix(orcad): identify instances by kernel start ticks, not drifting wall-clock start time (stablyai#28125)

* fix(orcad): identify instances by kernel start ticks, not drifting wall-clock start time

On Linux the start time is derived from /proc/stat btime, which drifts (WSL2, NTP),
so a live orcad was read as a reused PID and its managed stop reported exited
without ever writing the request. The lock and stop request now carry optional
linuxStartTicks + bootId; readers prefer them, and a wall-clock mismatch on Linux
for records without them is unverifiable, never proof of exit.

Co-Authored-By: Claude <[email protected]>

* fix(orcad): match stop receipts without the incarnation an older client drops

A request recovered by an older client loses linuxStartTicks/bootId, which made
the newer host reject its own receipts and decision records as mismatched. Also
exercise the incarnation reader against a real Linux /proc.

---------

Co-authored-by: Claude <[email protected]>

* docs(readme): point the Android APK links at 0.0.55 (stablyai#28134)

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* perf(runtime): stop re-sending the worktree list to mobile pollers on every terminal chunk (stablyai#28062)

* perf(runtime): let worktree.ps pollers opt out of per-chunk activity churn

worktree.ps carries `preview` and an exact `lastOutputAt` on every row, both
of which move on each PTY chunk, so the content-addressed snapshot id changed
on every poll while any agent printed and the whole catalog was resent.

Add an optional `coarseActivity: true` param. When set, the host drops
`preview` and floors `lastOutputAt` to 30 s before hashing, so the id holds
while only chunk-level activity moves. Callers without the param get the
byte-identical response they get today; older hosts strip the unknown key.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* perf(mobile): stop re-sending the worktree list on every terminal chunk

The host-screen snapshot poll now asks worktree.ps for `coarseActivity`, so
the catalog's snapshot id survives terminal output and the 3 s poll gets a
tiny `unchanged` reply instead of the whole catalog. `preview` is optional on
mobile rows because a coarse host leaves it out; old hosts ignore the param
and keep sending it.

Re-records the three worktree.catalog-snapshot goldens; the only semantic
change is the new request param.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* perf(runtime): coarsen worktree.ps activity for every snapshot poller

Drop the `coarseActivity` param: the only caller that sends
`afterSnapshotId` is the mobile snapshot poll, which never renders
`preview` and uses `lastOutputAt` only to rank rows. Snapshot polls now
always get a blank `preview` and a 30 s-floored `lastOutputAt`, so
already-shipped apps stop re-downloading the catalog on every terminal
chunk with only a desktop update. Callers without `afterSnapshotId`
still get the byte-identical response.

Reverts the mobile param, its scenario steps and the three re-recorded
goldens, and removes the unread `preview` field from mobile row types.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* fix(runtime): rank coarsened worktree.ps rows so in-bucket swaps keep the snapshot id

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* test: drop preview from row fixtures and keep the runtime cast on one line

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* fix(mobile): load markdown tabs from any desktop split group; center load-error Retry (stablyai#28132)

* fix(mobile): load markdown tabs from any desktop split group and center load-error Retry

The desktop answered markdown.readTab only for tabs in its focused split
group, so a phone opening a markdown tab from another group got
tab_not_found and showed "Couldn't load markdown". Resolve the tab across
all of the worktree's groups.

Load-error states now share one component that centers the message and its
Retry button; the markdown reader's button was pinned to the left.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* test(renderer): mobile markdown read picks the requested tab across groups

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* refactor(renderer): resolve mobile markdown tab to one file id

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* fix(wsl): run WSL git with Windows Git line-ending settings on checkouts Windows Git wrote (stablyai#27778)

* fix(wsl): run WSL git with Windows Git settings on Windows-authored drive checkouts

* fix(wsl): detect Windows Git checkouts from host autocrlf plus a whole-tree sample

* fix(wsl): keep WSL-created worktrees on Linux Git defaults and never commit CRLF on an unproven checkout

- worktree add / clone write a new checkout whose .git points at /mnt/..., which Windows Git
  cannot open; injecting autocrlf=true there produced CRLF files later read unflagged.
- Writes on a host-autocrlf=true checkout whose sample is unproven run with autocrlf=input,
  so staging normalizes CRLF without ever writing CRLF to disk.
- Writes wait for a stale host answer and re-check checkout identity after joining a sample.

* fix(wsl): compare a joined sample with the checkout identity read after it settles

* fix(runtime): stop a project's terminals before the host forgets the project (stablyai#28024)

* fix(runtime): stop a project's terminals before the host forgets the project

Removing a project on a runtime host (an SSH-managed or paired server) sent repo.rm first; the
host resolves terminal.stop through the project's workspace rows, which repo.rm deletes, so the
stop failed and the shells kept running on the host. Terminals stop first now. The removal toast
also drops the IPC wrapper from its message.

* fix(runtime): only stop host terminals when the host will accept the project removal

Probe with repo.show (same resolver as repo.rm) so a removal the host rejects, such as an
ambiguous project id, no longer kills the shells first. Also poll through terminal_not_writable
in the paired-client e2e.

* test(e2e): read the host shell pid through sh so non-POSIX login shells work

* fix: preserve relay pane claims across managed tab mirrors

* fix(mobile): cancel bridge-post retries when a terminal document stops

Mobile Checks verify failed on an unhandled ReferenceError: window is not
defined inside postToReactNativeWebView's scheduled send() retry while
viewport-frame.test.ts ran. Retries lived outside the document lifecycle, so
a stop left timers that later read a torn-down window.

Bind the default postToHost per scope, clear its timers on stop, no-op posts
after stop, and guard window before reading ReactNativeWebView. Preserve
bounded retry and deliver-when-bridge-appears behavior.

* fix(mobile): use supported own-property check for host overrides

* fix(mobile): align bridge retry teardown with document lifecycle contract

* style(mobile): format bridge retry lifecycle regression test

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Neil <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: Jinwoo Hong <[email protected]>
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