Skip to content

feat(app): open OS Markdown files in the floating workspace - #10173

Closed
innocarpe wants to merge 3 commits into
stablyai:mainfrom
innocarpe:feat/os-open-markdown-floating
Closed

innocarpe wants to merge 3 commits into
stablyai:mainfrom
innocarpe:feat/os-open-markdown-floating

Conversation

@innocarpe

@innocarpe innocarpe commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Register Orca as an Open With handler for .md / .mdx / .markdown (electron-builder fileAssociations).
  • Queue OS open paths from:
    • cold-start process.argv (Windows/Linux)
    • macOS open-file (early, before ready)
    • second-instance commandLine when Orca is already running
  • When the main window can receive IPC, open the floating workspace and each document via the existing floating markdown open path (MarkdownDocument + openFile).
  • Re-enables the floating workspace setting if it was turned off, so Open With still works.

Fixes #10138

Test plan

  • Unit: argv extraction (absolute markdown only, switches ignored, Windows paths)
  • Unit: bridge queue / flush / auth skip
  • Unit: second-instance passes commandLine
  • Manual (packaged preferred): double-click .md → Orca opens floating workspace with that file
  • Manual: Orca already running → Open With another .md → focuses Orca and opens the file
  • Manual: non-markdown path ignored

ELI5

Orca can be chosen as Open With for .md/.mdx/.markdown files. OS open (cold start, second instance, macOS open-file) opens those files in the floating workspace markdown viewer.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@innocarpe, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: acfff848-ac94-4d00-83c5-00b510be93b8

📥 Commits

Reviewing files that changed from the base of the PR and between 0e01ef63979c239d82ae8da9b8fd4dfe03527f63 and 9e83e6d.

📒 Files selected for processing (1)
  • config/electron-builder.config.cjs
📝 Walkthrough

Walkthrough

Adds Electron file associations for Markdown formats and captures Markdown paths from operating-system launches, command-line arguments, and macOS open-file events. A main-process bridge queues, authorizes, resolves, deduplicates, and sends documents to the renderer through a new preload IPC subscription. The renderer force-opens the floating terminal and opens each document in the floating workspace. Web APIs expose a no-op equivalent, and tests cover path filtering, queue flushing, authorization failures, and second-instance arguments.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers summary and testing, but it omits required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections and include the AI review, security audit, screenshots or a no-visual-change note, and any platform-specific notes.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes register Markdown file handling and open queued files in the floating workspace whether Orca is running or not, matching #10138.
Out of Scope Changes check ✅ Passed The code changes stay focused on OS Markdown file opening, queueing, IPC plumbing, and tests, with no clear unrelated additions.
Title check ✅ Passed The title clearly summarizes the main change: adding OS support for opening Markdown files in the floating workspace.

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: 5


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ebae5e65-4a58-45d5-9633-5ca00c8a1e1d

📥 Commits

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

📒 Files selected for processing (14)
  • config/electron-builder.config.cjs
  • src/main/index.ts
  • src/main/startup/os-open-markdown-bridge.test.ts
  • src/main/startup/os-open-markdown-bridge.ts
  • src/main/startup/os-open-markdown-paths.test.ts
  • src/main/startup/os-open-markdown-paths.ts
  • src/main/startup/single-instance-lock.test.ts
  • src/main/startup/single-instance-lock.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/lib/floating-terminal.ts
  • src/renderer/src/web/web-preload-api.ts

Comment thread src/renderer/src/hooks/useIpcEvents.ts Resolved
Comment thread src/renderer/src/hooks/useIpcEvents.ts Resolved
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
Register .md/.mdx/.markdown file associations and route Finder/Explorer
"Open With" (cold start argv, second-instance commandLine, and macOS
open-file) into a queued main-process bridge that opens the floating
workspace and each document via the existing MarkdownDocument open path.

Closes stablyai#10138
…y races

CodeRabbit: re-check destroyed webContents after await; retry send;
re-queue on failure; normalize paths for dedupe; catch renderer async errors.
- Treat unhydrated settings (null) as floating-disabled so cold-start
  Open With still enables the floating workspace.
- Isolate per-document openFile failures so one bad path does not drop
  the rest of the batch.
- Normalize argv paths with platform-specific path APIs and cover
  dot-segment aliases in tests.
@nwparker

nwparker commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Superseded by #17906, which shipped this feature — thank you, and sorry this sat for so long.

You picked the right target. The floating workspace is what the issue asked for and what shipped, and you found the correct main-process primitives yourself: isMarkdownDocumentName, authorizeExternalPath, and markdownDocumentFromFilePath(root, path, { outsideRootRelativePath: 'basename' }) — which is exactly what Orca's existing pickFloatingMarkdownDocument does. That's a careful read of the codebase, not a guess, and the merged main-process shape follows it. You're credited as a co-author on the merged commit.

What changed in the ~6 weeks this was open, for context rather than criticism:

  • Your single-instance-lock.ts widening is already on main. requestDesktopActivation(argv) takes argv today and acquireSingleInstanceLock(app, requestDesktopActivation) forwards it, so that part became unnecessary — and the lambda form would now fail serve-desktop-activation-wiring.test.ts, which pins the exact call text.
  • App.tsx and useIpcEvents.ts no longer hold the code you edited. The floating-workspace panel moved to app-shell/use-floating-workspace-panel.ts and useIpcEvents was split into hooks/ipc-events/* bridges. src/main/index.ts itself went from 3831 lines to 110.
  • The send → sleep 250ms → send retry was replaced by a pull handler (ui:consumePendingMarkdownFileOpens), following the SkillShareDeepLinkState pattern main had already grown for exactly this "intent arrived before the renderer mounted" problem. That also removed the duplicate-delivery risk the retry carried.

One thing worth knowing for future work here, because it's a genuine trap and not something you could reasonably have predicted: putting fileAssociations at the top level feeds electron-builder's NSIS packager, whose APP_ASSOCIATE macro overwrites Software\Classes\.md's default value with no backup — silently taking .md from whichever editor owns it, for every existing user on their next update. #17906 registers Windows Open-With by hand instead, additively, and I verified the round trip on real Windows 11.

Thanks again for the careful work.

@innocarpe

Copy link
Copy Markdown
Contributor Author

Thank you for writing this up, and for the co-author credit on #17906.

You are right that the floating workspace was the right target, and the later pull-handler / additive Windows-association notes are useful context I could not have predicted from the July codebase. Closing the fork portfolio mirror as well.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support opening Markdown files from the OS (Finder / Explorer)

3 participants