Skip to content

Bind mobile markdown creation to file owner - #10083

Merged
AmethystLiang merged 1 commit into
mainfrom
fix-p1-mobile-markdown-ownership
Jul 23, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
fix-p1-mobile-markdown-ownership

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary

When creating markdown files, bind the file creation operation to the execution host that owns the worktree. This ensures file mutations are routed correctly, especially for SSH-hosted worktrees where the connection generation must be captured at mutation time.

Implementation

Adds captureMobileFileMutationOwnership() to query the runtime for:

  • The worktree's execution host (local or SSH)
  • Current SSH connection generation (for SSH targets)

Ownership parameters are captured before file creation attempts and passed to the RPC request, ensuring correct routing when retrying with unique filenames.

Screenshots

No visual change

Testing

  • pnpm test — comprehensive vitest coverage added
  • Unit tests for buildMobileFileMutationOwnership(): validates local, remote, and SSH ownership detection with edge cases
  • Unit tests for captureMobileFileMutationOwnership(): verifies runtime capability checks, SSH state queries, and error handling
  • Tests confirm older runtimes are rejected before any file mutations

Notes

SSH connection generation is live-queried to prevent stale ownership data if the host reconnects between worktree inspection and file creation.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8441f082-8010-4679-837b-c2b1da7942ab

📥 Commits

Reviewing files that changed from the base of the PR and between fc05769 and c799b31.

📒 Files selected for processing (3)
  • mobile/app/h/[hostId]/session/[worktreeId].tsx
  • mobile/src/files/mobile-file-mutation-ownership.test.ts
  • mobile/src/files/mobile-file-mutation-ownership.ts

📝 Walkthrough

Walkthrough

Adds mobile helpers to resolve file-mutation ownership for local and SSH worktrees, including capability checks, worktree host lookup, SSH state retrieval, timeout handling, and validation tests. Updates markdown note creation to capture ownership before retries and include the resolved ownership fields in each files.createFile RPC request.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, implementation, screenshots, testing, and notes, but it omits the required AI Review Report and Security Audit sections. Add the missing AI Review Report and Security Audit sections, including the cross-platform review, risks checked, and any follow-up work.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately captures the main change: binding mobile markdown creation to the owning file host.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

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