Skip to content

Fix mobile Markdown read and save in inactive desktop splits - #10161

Open
GoodFarming wants to merge 2 commits into
stablyai:mainfrom
GoodFarming:fix/mobile-markdown-inactive-group
Open

GoodFarming wants to merge 2 commits into
stablyai:mainfrom
GoodFarming:fix/mobile-markdown-inactive-group

Conversation

@GoodFarming

@GoodFarming GoodFarming commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

A phone or paired client can read and save an open Markdown file in another desktop split without moving the desktop selection.

What Changed

Markdown requests now resolve the requested editor tab across that workspace's existing tab registry, then match its exact backing file. Previously lookup used the desktop-active split's navigation order, so an open file in another split returned tab_not_found. The existing save controller, content version checks, file-owner guards, and direct file-ID hydration fallback remain in use.

Why

The tab registry already identifies every split's editor. Reading it directly fixes lookup without activating a split, adding a cache, or changing editor libraries. This preserves GoodFarming's original #10161 fix and tests, with added workspace/type boundary controls and real paired save coverage. The commit retains GoodFarming as author.

VS Code's EditorService.findEditors likewise searches across groups unless a group is explicitly supplied. The exact Tiptap 3.31.3 and Monaco 0.55.1 sources were inspected; their parsing/model APIs are unchanged.

Linked Issue

Existing contribution #10161; no separate issue or duplicate PR.

Visual Proof

Before: the real paired read returned tab_not_found; the Markdown pane retained its original text.

Before

After: paired Save reaches disk and updates the Markdown pane while the sibling pane stays active.

After

Testing

Exact head: b1dda18a2d6d208cd35f9ce61ac2229983554154; base 996924081935cc67e94ccf609d9eded3f689b666 includes localization fix #25494.

  • Tested locally using hidden Electron/CDP on macOS with a separate paired client and real disk writes.
  • Automated regressions added: inactive-split read/save, preserved split selections, hydration fallback, unknown IDs, wrong workspace, terminal wrappers, and non-Markdown editors.
  • Original production: 2 regression failures / 14 controls passed; the same real paired test failed with tab_not_found.
  • Final: 31 tests / 5 suites passed; real paired test passed; full TypeScript checks, owned E2E typecheck, changed-code quality, staged lint, and fresh E2E app/CLI build passed.
  • Full pnpm lint reaches five existing mobile import-cycle warnings in client-context.tsx, host-client-hooks.ts, fit-scale.ts (two), and mouse-report-cell.ts. These unchanged cycles are being repaired separately; this PR adds none.

Review

Independent source review checked worktree and editor-type scoping, exact backing-file matching, hydration compatibility, and preservation of save/owner boundaries. No new dependency, IPC, wire field, shortcut, or global model scan.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material copied.

Notes

Physical Android, Windows/Linux desktop, and direct SSH were not exercised by this new UI proof. The fix changes host-side tab lookup only; existing remote file ownership and save guards remain authoritative.

Checklist

  • Small production change using the existing registry.
  • User-facing behavior and mechanism explained.
  • Before/after proof attached.
  • Correctness, stale state, host scope, and platform assumptions reviewed.
  • Focused tests, typechecks, build, and changed-code gates pass; full-lint baseline exceptions documented.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fa38e944-85d2-44a8-ace7-277e1d5da48f
📥 Commits

Reviewing files that changed from the base of the PR and between 68cd8e0e88f9d157b73fb030d627e58eb4fd280c and b1dda18.

📒 Files selected for processing (6)
  • src/renderer/src/lib/worktree-creation-hook-preparation.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
  • src/renderer/src/runtime/mobile-markdown-split-target.test.ts
  • tests/e2e/mobile-markdown-inactive-split.spec.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

Walkthrough

The mobile Markdown bridge now resolves file identifiers from unified editor tabs. The test harness adds shared fixture IDs, resets worktree-scoped editor state, and optionally creates unified tabs when it opens Markdown files. Tests cover fallback reads, unknown tab IDs, split-group reads and saves, and active group and tab state. An obsolete tab-order mock was removed.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to b1dda

The change lets paired mobile clients read and save Markdown in inactive desktop split groups without changing which group is active. Unknown or ineligible tabs still fail with tab_not_found. No actionable merge risk remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to b1dda

The change restores access to already-open Markdown files across splits while preserving workspace scoping and existing file permissions. No new access-control weakness was established. Interruption and recovery behavior remains incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The lookup change expands usable wrapper identifiers across splits, rather than demonstrating access to a new set of files. The same worktree-scoped Markdown files were already addressable through the base's direct file-ID fallback. File operations inherit the selected host-held file's existing local, SSH, or runtime ownership.

Trust Boundaries and Controls

  • observed — The inspected WebSocket entrypoint binds requests to a validated device credential, rejects conflicting channel and request tokens, and applies the mobile-method allowlist. The renderer then enforces worktree-scoped file resolution; its file-read path retains external SSH ownership validation and relative-path checks for remote runtime reads. These controls are unchanged by the PR.

Resilience and Maintainability Implications

  • observed — The existing save protocol serializes mobile saves per source-file ID, re-resolves queued targets, rejects stale versions unless content already matches, and conditionally restores the previous draft after failure without overwriting a different newer draft. The editor queue independently checks live file ownership and preserves newer dirty content. Verification failure can occur after disk content changes, so draft restoration is not disk rollback; the inspected tests explicitly represent that pre-existing limitation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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 6 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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.
Title check ✅ Passed The title clearly summarizes the main change: reading and saving Markdown in inactive desktop splits from mobile.
Description check ✅ Passed The description explains the user-facing change, implementation, rationale, testing, visual proof, and review considerations. It also addresses the template sections. The linked-issue section identifi…
  • Fix all pre-merge checks with AI

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6680e557-01ce-409c-9600-6fb284930b32

📥 Commits

Reviewing files that changed from the base of the PR and between 8a23618 and be72a418f9b88a968acee4b7d8cb03a60501b150.

📒 Files selected for processing (4)
  • 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 (1)
  • src/renderer/src/runtime/mobile-markdown-bridge-save-guards.test.ts

@AmethystLiang
AmethystLiang requested a review from OrcaWin July 24, 2026 16:51
@GoodFarming
GoodFarming force-pushed the fix/mobile-markdown-inactive-group branch from be72a41 to 850f1f0 Compare July 25, 2026 08:57
@nwparker nwparker added the bug Something isn't working label Jul 27, 2026
@GoodFarming
GoodFarming force-pushed the fix/mobile-markdown-inactive-group branch from 850f1f0 to 68cd8e0 Compare August 6, 2026 10:55
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 12dfe5ab-e7ce-4423-8ca3-e9edbf840814

📥 Commits

Reviewing files that changed from the base of the PR and between f713739 and 68cd8e0e88f9d157b73fb030d627e58eb4fd280c.

📒 Files selected for processing (4)
  • 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 (1)
  • src/renderer/src/runtime/mobile-markdown-bridge-save-guards.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/runtime/mobile-markdown-bridge.ts

nwparker and others added 2 commits October 5, 2026 02:22
Preserve the contributor lookup fix from stablyai#10161 and add real paired save proof plus workspace and content-type boundaries.
@nwparker
nwparker force-pushed the fix/mobile-markdown-inactive-group branch from 3666860 to b1dda18 Compare October 5, 2026 11:02
@nwparker nwparker changed the title fix(mobile): resolve markdown tabs across split groups Fix mobile Markdown read and save in inactive desktop splits Oct 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants