Skip to content

fix(mobile): create and edit notes on headless hosts - #31291

Merged
nwparker merged 5 commits into
mainfrom
nwparker/mobile-headless-markdown
Oct 21, 2026
Merged

nwparker merged 5 commits into
mainfrom
nwparker/mobile-headless-markdown

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​91 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​91
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​249 $\color{#cf222e}{\Huge{\mathbf{−}}}$​44 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​205

Creating a Markdown Note from a phone paired to a headless host failed with renderer_unavailable after creating the file. Every retry left another orphan note. Headless hosts now open persisted editor tabs and read/save notes through the existing authorized filesystem and disk-precondition writer.

Reproduction (iPhone 17 Pro simulator, iOS 26.1): pair directly to a headless host, open a workspace, tap New Tab → Markdown Note. Before: error toast and no note tab. After: the note opens, accepts text, and saves to disk.

Validation: paired-headless RPC regression covers creation, read, save, stale phone conflicts, external edits, and closing; 13 editor/projection unit tests pass; pnpm tc:node and changed-code quality pass. Simulator screenshot below shows the saved result. Desktop-paired note creation/edit/save was also exercised.

Before:

(screenshot removed: contained real product data)

After:

(screenshot removed: contained real product data)

Addresses the headless Markdown-note reproduction in #22186, reported by @shota46. Related community work reviewed: @Jinwoo-H's #31101 (disk-backed Markdown tab reads/saves), @brennanb2025's #25436 (broader host-owned editor tabs, SSH, and diffs), and @Meapri's #23357 (device-side file/diff fallback, explicitly leaving new notes for separate work). Thank you for the reports, implementations, and regression coverage. This PR is an independently implemented, narrower headless-note fix; it does not supersede those PRs' remaining scope or claim their commits as its own.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 9421f3d1-9dee-4bfb-9717-bb9121c3bb29
📥 Commits

Reviewing files that changed from the base of the PR and between a1d2800 and c8ba378.

📒 Files selected for processing: 2
  • src/main/runtime/files/headless-markdown-document.ts
  • src/main/runtime/workspaces/workspace-file-session-targets.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 runtime now delegates editor opening to a shared opener that can publish headless mobile tabs. When notifier read or save handlers are unavailable, Markdown tab operations use headless document handling backed by workspace session state and authorized local files. The end-to-end test covers opening and editing Markdown files, successful saves, version conflicts, multiple tabs, and reads after tab closure.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to c8ba3

Mobile note saves can overwrite a concurrent external edit. Make the disk conflict check and write atomic before merging, unless that data-loss risk is explicitly accepted.

Pre-merge checks: Passed 4 · Failed 1

Failed 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 2 functions across 5 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 identifies the mobile headless-host fix for creating and editing notes.
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.
Description check Passed The description clearly explains the problem, user-visible change, implementation approach, linked issue (#22186), visual before/after evidence, and validation performed. It does not use the repositor…
Full details: Description check

Explanation

The description clearly explains the problem, user-visible change, implementation approach, linked issue (#22186), visual before/after evidence, and validation performed. It does not use the repository template headings and omits the checklist, AI disclosure, review, boundary, notes, and explicit automated-test checklist items, but the core required information is present.

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Make the disk precondition and write atomic. · headless-markdown-document.ts:141-143

src/main/runtime/files/headless-markdown-document.ts:141-143
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Make the disk precondition and write atomic.

HeadlessMarkdownDocuments.save calls writeFileWithDiskPrecondition after the mobile route selects the headless path. The shared writer checks the signature and then calls writeFile separately. Another process can edit the file between those operations. The mobile content then overwrites that edit, and the reread reports success because it sees the mobile content. This violates the conflict and data-preservation behavior. Move a true compare-and-write guarantee into the shared local writer. The existing in-process queues do not protect against another process.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ab139c6f-16b9-44f8-9279-b324833981d1
📥 Commits

Reviewing files that changed from the base of the PR and between 9e84bdb and a1d2800.

📒 Files selected for processing: 1
  • config/tsconfig.e2e.json

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

@nwparker
nwparker merged commit 018c6e0 into main Oct 21, 2026
57 of 58 checks passed
Jinwoo-H added a commit that referenced this pull request Oct 21, 2026
#31291 added HeadlessMarkdownDocuments for windowless phone Markdown reads and saves, next to
the window relay. This branch replaces both with one path through main and the disk, so its
read/save wiring and module are dropped; its headless editor-open and session-update changes
stay, and its e2e (headless-mobile-markdown.spec.ts) runs against the merged path.
Jinwoo-H added a commit that referenced this pull request Oct 21, 2026
Jinwoo-H added a commit that referenced this pull request Oct 21, 2026
…nge and draws only main's update (dark, layout-owner build only) (#31438)

* Editor tabs main-first: the window sends each editor action to main and draws editor tabs only from main's frames (dark, layout-owner build only)

With ORCA_LAYOUT_OWNER_IS_MAIN on, editor open (preview replace, open to the side), reopen at
its position, close, close-all, promote, the resolved conflict placeholder, a restored-editor
move and a disk rename are layout commands the window sends before it draws anything. Window
content (open file records, drafts, buffers, the autosave gate) is written at once for an open,
and rekeyed in the same store update as the frame for a move or rename. Main publishes each
non-edit tab's view, keeps views in memory across applies and partition changes, stamps the
tab's time, folds same-file duplicates, and republishes a windowless host's session.tabs after
its own file open. The switch-off path is unchanged.

* test(d3a-2): the buffer view index follows a rename main answers

* test(e2e): the old-phone baseline records a windowless server opening the file, as main does since #31291 (test only)
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