Skip to content

feat(office): preview Word, Excel and PowerPoint documents - #19741

Open
overjt wants to merge 6 commits into
stablyai:mainfrom
overjt:overjt/iofficecli
Open

overjt wants to merge 6 commits into
stablyai:mainfrom
overjt:overjt/iofficecli

Conversation

@overjt

@overjt overjt commented Sep 9, 2026 •

Copy link
Copy Markdown

ELI5

Today a .docx, .xlsx or .pptx in a workspace is a dead end — the editor says "Binary file — cannot display" and that is the whole story. This makes Orca render those documents so you can actually read them in a tab, keeps the render current while an agent edits the file, lets you point at a slide and hand that selection to the agent, and adds one Settings action that installs officecli's own Office skills for your agents. The rendering is done by officecli, which Orca detects but never installs for you.

What Changed

Snapshot preview. Opening an Office document renders it on the host that owns it — officecli view <f> html — and shows the result in the existing orca-preview:// partition, under the same strict CSP a workspace HTML document gets. Nothing about that partition is relaxed. The routing arm is added to getWorkspaceFilePreviewPlan, so the file tree, terminal file links and the editor's binary placeholder all inherit it.

A new inline preview-grant owner. The obvious design — write the rendered HTML somewhere and point a grant at it — does not fit: a runtime grant reads through the worktree-scoped files.read RPC, so the output would have to land inside the reader's worktree and show up in their git status. Since the snapshot is exactly one self-contained file, office:openSnapshot renders on the host, mints an inline grant over the bytes in main, and answers a URL. That owner reads no filesystem on any machine, so it is strictly narrower than both existing owners; the renderer never holds document bytes, and doc-preview-grant-ipc refuses to mint one from the renderer at all.

One host-side implementation, three transports. executeOfficeMethod is shared verbatim by this client's local host, src/relay/office-handler.ts (SSH) and src/main/runtime/rpc/methods/office.ts (paired). A refusal therefore cannot be named three different things depending on where the document lives — pinned by office-surface-parity.test.ts. Failures cross the boundary as stable codes (OFFICECLI_NOT_FOUND, OFFICECLI_UNSUPPORTED_FORMAT, OFFICE_RENDER_TOO_LARGE, …); every reader-facing sentence lives in the renderer.

A format we cannot render says so itself. .doc, .xls, .ppt, .odt, .ods, .odp get a first-class panel that names the format and offers the system app. It never mentions officecli, because the tool was not the problem and offering an install would send the reader to fix something that is already fine. .csv is deliberately untouched — Orca's CSV viewer owns it and officecli rejects it.

Detect, never install. When the owning host has no binary, the notice names that host (on a remote workspace the reader's own machine is the wrong place to look), shows the platform-correct install command as selectable text, and offers Run in terminal — which opens a terminal on that host with the command typed and not executed. That is the whole install mechanism. It keeps Orca from originating a powershell.exe invocation against a downloaded script, the pattern docs/reference/windows-edr-posture.md records as producing Defender incidents.

Live preview. The Live toggle starts officecli watch on the owning host and converts the page to http://127.0.0.1:<port> through the same door the address bar uses, so Back crosses back to the document. No new transport: a local workspace loads it directly, an SSH workspace's pages already mount on a proxy-verified partition routed through the target, and a paired workspace's page is bound to its runtime. officecli watch does not detect external edits, so refresh is pushed via POST /api/switch from a subscriber that outlives the pane.

Selection and marks. officecli returns selected elements as stable @id= paths that survive edits; Use selection puts a compact reference into the agent composer with submit: false — the reader pointed at something, they have not yet said what to do with it. The marks panel lists, jumps to and clears the watch process's advisory marks, and disappears entirely when no watch process holds the document, because marks are process state and an empty list would read as "no annotations".

Agent skills. One Settings action next to the existing agent controls, reading the catalogue from officecli skills list rather than hardcoding it, and reporting per (skill, agent) pair. No Orca-authored Office skill, no MCP registration.

Contract findings that changed the design

Verified against officecli 1.0.148 on macOS:

  • Macro-enabled formats render. The plan guessed they did not. view … html renders a genuine .docm (macro content type, vbaProject.bin part and relationship) byte-for-byte like its .docx twin, and the tool's own unsupported-type message names all three. Only create refuses them, and Orca never calls create. src/main/office/__fixtures__/sample.docm holds the verdict in place.
  • /api/switch takes file, not path — path answers 400 missing required field: file.
  • unwatch matches the spelling watch was given. A watch started from a relative path cannot be stopped by an absolute one; unwatch answers "No watch running" and the server keeps listening. Canonicalising at the edge is what makes teardown work at all, not just what keeps two opens from racing.
  • A second watch reports the running server's URL, so a client that lost track of its own session adopts it instead of asking the reader to hunt down a process.
  • view leaves a warm resident that self-exits after ~2 minutes idle. Orca does not call close on it: close also flushes in-memory edits, so an agent mid-batch would have its work written and its resident killed by somebody else's preview.

Why

Fixes #8301. Researchers, writers and technical authors keep Office documents beside code, and today Orca makes them leave to read one.

The approach deliberately invents almost no transport: snapshots ride the document-preview pipe that already renders workspace HTML behind a strict CSP, and live previews ride the browser pane and the routing that already reaches a remote host's loopback. The one genuinely new thing is the inline grant owner, and it exists to avoid widening read authority — it is narrower than what shipped before it.

officecli runs on the host that owns the document, always. A worktree on an SSH host renders with that host's binary, fonts and locale; an unresolved or unreachable owner is an error, never permission to render on the client. Loss of contact is reported as unverifiable and never as "the document is gone".

Linked Issue

Fixes #8301

Visual Proof

Opening a .docx from the editor — before / after

Before After
01-before-editor.png 02-after-editor.png

.docx rendered in the preview partition — paragraph, table and embedded image, with the re-render control, the Live toggle, Use selection, Reveal in folder and Open in the system app.

03-after-docx.png

.pptx, toolbar naming the kind:

04-after-pptx.png

A format we do not render — names the format, offers the system app, never mentions officecli:

05-after-unrenderable.png

Note on the grey band in the .docx shot: that is officecli's own page CSS (body { background: #f0f0f0 } with a fixed-width .page), not an Orca layout bug. The guest fills its container exactly — measured at x=281 width=809 for both guest and host — and the .pptx shot, which has no page box, fills edge to edge.

Testing

Ran on macOS (Apple Silicon), local workspace, against real officecli 1.0.148.

  • pnpm tc (all projects), oxlint over src + tests, check:max-lines-ratchet, check:reliability-gates, check:ts-nocheck-ratchet, check:runtime-electron-ratchet, and all four verify:localization-* scripts: clean.
  • 77 new unit tests. Notable ones rather than coverage padding: every documented /api/switch rejection maps to its code; parseAlreadyWatchedPort recovers the running server's port and rejects an out-of-range one; a symlinked and a redundantly-spelled path canonicalise to the same session key; the refresh control's four states, including that a missing binary stays retryable while an unsupported format does not; inline grants serve their one document and 404 everything else including ../secrets.env; relay/runtime method parity; and office.skillsInstall rejecting {skill: 'rm -rf /'} at the schema.
  • Integration, real binary. office-render-service.integration.test.ts renders all four committed fixtures and asserts zero non-data: src/href references — the self-contained-HTML property the whole CSP story rests on, so a future officecli that emits an external reference fails here instead of as a blank image in front of a reader. office-watch-manager.integration.test.ts drives start → serve → reuse → refresh → stop and asserts the port is genuinely released.
  • E2E (tests/e2e/office-document-preview.spec.ts, headless with ORCA_BACKGROUND_LAUNCH=1): a real .docx paints inside the preview partition, and a .doc shows the unrenderable panel with getByText(/officecli/i) asserted at count 0.
  • Screenshots above were captured by driving the built app through CDP on a hidden renderer, before and after, on this branch and on its parent commit.

Not tested: Windows and Linux (host fonts change the render — the plan calls for a manual pass per release), SSH and paired-runtime hosts end to end, and the live-preview path in E2E. The watch lifecycle underneath live preview is covered by the integration test against the real binary.

  • I manually tested these changes locally
  • Automated tests added/updated

AI Disclosure

Implemented with Claude Opus 5 via Claude Code, from docs/office-document-support-plan.md. All contract claims about officecli were verified by running the binary, not taken from the plan — five of them contradicted it and are listed above.

Review

Cross-platform: paths go through path.join / the win32 flavour; child processes go through src/shared/child-process/ (the ratchet test passes) with a WSL lane derived from the document path itself, so a \\wsl$\<distro>\… worktree uses the guest's binary and fonts. No hardcoded metaKey is introduced. Windows install guidance is shown, never executed.

SSH / remote: one shared implementation behind provider dispatch; the relay needs no negotiation because it is bundle-hash-locked to its client, while the paired-runtime path is gated on office.preview.v1 and maps method_not_found to "update the paired machine" rather than a broken preview. An unreachable host answers OFFICE_HOST_UNREACHABLE and never falls back to rendering locally.

Security: the preview partition's CSP is unchanged; inline grants read no filesystem; watch servers stay on loopback; office.* params are shape-validated on the host before any spawn and every call is an argv array — no reader-supplied string is ever interpolated into a shell string. The renderer cannot mint an inline grant.

Performance: the probe and binary resolution are cached per execution host and invalidated on the reader's Retry; snapshots are capped at 10 MB and refused rather than truncated; the fs-change subscription is one filtered listener per open preview and the live refresh is debounced.

Backwards compatibility: additive. The only behaviour change for an existing surface is the editor's Office binary placeholder gaining an Open preview button.

One defect was found and fixed during UI validation: the host-owner selector returned a fresh object each call, which under Zustand's Object.is comparison re-rendered the pane on every store write and looped through the effects — React #185, taking down the whole workbench. It is now useShallow, with the hazard documented at the hook.

Agent skill upstream boundary

  • Not applicable — no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments or documentation is copied or mechanically translated. Orca authors no Office skill content; the Settings action shells out to officecli skills install and reads its catalogue at runtime.

Notes

  • Feature-flagging: the plan suggested flagging live preview for its first release. This PR ships it unflagged but fails closed — the toggle is disabled with a stated reason when the host has no binary, when its officecli predates watch, or when the owner cannot be resolved, and any watch failure falls back to the snapshot silently. Happy to put it behind a flag if you would rather.
  • Known rough edge: the return trip from a live preview is the page's Back (conversion records that leg), not a second toggle — the pane is unmounted once the page converts. Use selection likewise reads from a running watch process, so the natural path is Live → select → Back → Use selection. Both are honest but less direct than the plan imagined; I can follow up with dedicated chrome on the live page.

Checklist

  • This PR is small and focused — one feature, but it is a large one; happy to split the phases into a stack if you would prefer to review them separately
  • I explained what changed and why (including ELI5)
  • Before/after screenshots attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • pnpm lint, pnpm typecheck, pnpm test pass locally (pnpm build not run; CI covers it)

@overjt
overjt requested a review from brennanb2025 as a code owner September 9, 2026 14:38

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

ℹ️ No critical issues — one minor suggestion and a nitpick, both below.

Reviewed changes

  • Inline snapshot grant — a new inline DocPreviewOwner serves self-contained HTML that main already holds; strictly narrower than both filesystem owners and un-mintable from the renderer, with traversal looked up against a Map rather than the filesystem.
  • One host-side implementation, three transports — executeOfficeMethod is shared verbatim by the local host, the SSH relay, and the paired runtime; failures cross the boundary as stable codes with reader-facing copy owned by the renderer.
  • Snapshot + live preview surfaces — render on the owning host, re-render control, officecli watch with pushed /api/switch refresh and a debounced fs subscription, loopback-only ports, and teardown on tab close/reload/disconnect/quit.
  • Selection → agent handoff and marks — stable @id= element paths land in the composer with submit: false; the marks panel reads the watch process's advisory marks and disappears when no watch holds the document.
  • Unrenderable-format panel + detect-never-install — first-class panel for .doc/.xls/.ppt/.odt/.ods/.odp that never mentions officecli; the missing-binary notice names the owning host and types (never executes) the install command.
  • Agent skills — a Settings action shells out to officecli skills install with the catalogue read at runtime; Orca authors no skill content.
  • Wiring & parity — additive routing arms in file-preview.ts; relay/runtime method-name and zod-schema parity tests; office.preview.v1 capability.

ℹ️ Literal NUL separators make two source files binary to Git

officeSessionKey in src/main/office/office-document-path.ts and recordKey in src/main/office/office-watch-client-ledger.ts use a raw \0 byte as the host/path separator inside a template literal. Git auto-detects both as binary (i/-text w/-text), which is why this PR's own diff renders them as "(binary file or no changes)" — the canonical-path and client-ledger modules are not reviewable at all from the diff, and future edits will hit the same wall (git diff, git blame, and grep all treat them as binary). The separator itself is also redundant: canonicalPath is always absolute, so a plain ${hostKey}${canonicalPath} cannot collide.

Technical details
# Replace the raw NUL separator with a visible one (or a `\u0000` escape)

## Affected sites
- `src/main/office/office-document-path.ts` — `officeSessionKey` returns `${hostKey}\0${canonicalPath}` with a literal NUL byte.
- `src/main/office/office-watch-client-ledger.ts` — `recordKey` returns `${officeHostOwnerKey(owner)}\0${path}` with a literal NUL byte.

## Required outcome
- Both files are text (diffable/`git blame`-able) again, with no behavior change:
  either `\u0000` as an escaped separator, or drop the separator entirely since both keys
  already terminate in an absolute `/`-prefixed path.

## Open questions for the human
- Was the NUL chosen deliberately as an unpronounceable collision guard, or is it leftover from a
  separator that outlived a switch to always-absolute paths?

ℹ️ Nitpicks

  • OFFICE_PREVIEW_UPDATE_REQUIRED_MESSAGE (src/shared/protocol-version.ts:102) is exported but never read — the office path reports OFFICE_HOST_UPDATE_REQUIRED as a code and lets the renderer supply the sentence. Consider dropping the unused constant.
  • The office.preview.v1 capability is advertised but never consumed; the actual old-host protection is the method_not_found → OFFICE_HOST_UPDATE_REQUIRED mapping in src/main/office/office-host-dispatch.ts, same as doc-preview-file-reader.ts. The comment in src/main/runtime/rpc/methods/office.ts ("reads the advertised capability up front") overstates a check that doesn't exist — worth rewording to "fails closed on method_not_found".

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This change adds first-class Office document support. It defines workspace-relative document contracts and host-aware officecli execution. It adds rendering, watch sessions, selection, marks, skills, error handling, IPC, preload, runtime RPC, SSH relay, and cleanup paths. It adds Office preview routing, live refresh, failure states, editor and terminal handling, inline preview grants, fixture documentation, and unit, integration, and end-to-end tests.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to b8ee4

This large feature adds first-class Office document preview support, and several previously raised concerns (duplicate RPC registration detection, an import cycle, and incorrect pluralization) have been fixed. A few real gaps remain: an invalid workspace path can silently fall back to a default execution context instead of failing loudly, long-running live document watches can grow memory without a total cap, cancelling a WSL-hosted Office operation may not stop the underlying process promptly, and a WSL-hosted document whose rendered output fails to read could appear as a valid but empty preview instead of a clear error. None of these are likely to cause data loss or a broad outage, but they should be addressed before merge to avoid confusing failures for real users.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.49% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 188 functions across 83 files. (1 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding Office document previews for Word, Excel, and PowerPoint files.
Description check ✅ Passed The description covers all required sections, including the change scope, rationale, linked issue, visual proof, testing, AI disclosure, review considerations, agent-skill boundary, notes, and checkli…
Linked Issues check ✅ Passed Issue #8301 requires first-class DOCX, PPTX, and XLSX support. The PR adds Office routing, file-tree handling, central previews, host-side officecli rendering, live watch support, and document-speci…
Out of Scope Changes check ✅ Passed The changes stay within issue #8301. Host dispatch, path containment, capability negotiation, watch cleanup, CSP-safe preview grants, localization, accessibility, settings integration, and cross-platf…
Full details: Docstring Coverage

Explanation

Docstring coverage is 41.49% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 188 functions across 83 files. (1 skipped: 1 unsupported.)


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

🧹 Nitpick comments (4)
src/main/office/office-watch-manager.integration.test.ts (1)

51-59: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Report a skip instead of a silent pass.

When officecli is absent, the test returns early and the reporter records a pass. The same happens after the started.ok guard. Nobody can tell from CI output that the watch lifecycle was never exercised. Use the test context to skip explicitly.

♻️ Proposed change
-  it('starts, serves, refreshes and stops without leaving a listener', async () => {
-    if (!installed) {
-      return
-    }
+  it('starts, serves, refreshes and stops without leaving a listener', async (ctx) => {
+    if (!installed) {
+      ctx.skip()
+      return
+    }
     const started = await startOfficeWatch(document)
     expect(started.ok).toBe(true)
src/main/office/office-surface-parity.test.ts (1)

18-18: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Preserve registration cardinality in the parity assertions.

OFFICE_RPC_METHODS and createOfficeMethods() currently contain each method once, so this is not a runtime defect. Set equality still hides a future duplicate. Compare sorted arrays to preserve cardinality.

Proposed fix
-    expect(new Set(registered)).toEqual(new Set(OFFICE_RPC_METHODS))
+    expect([...registered].sort()).toEqual([...OFFICE_RPC_METHODS].sort())
...
-    expect(new Set(registered)).toEqual(new Set(OFFICE_RPC_METHODS))
+    expect([...registered].sort()).toEqual([...OFFICE_RPC_METHODS].sort())
src/main/office/office-document-path.test.ts (1)

35-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Strengthen the normalization test. join removes . and .. before canonicalOfficeDocumentPath receives the value. Build noisy as a literal path so the test covers resolve normalization. This improves test coverage; current callers already canonicalize paths.

♻️ Proposed change
-    const noisy = join(directory, '.', 'sub', '..', 'deck.pptx')
+    const noisy = `${directory}${sep}.${sep}sub${sep}..${sep}deck.pptx`

Import sep from node:path.

src/main/browser/doc-preview-inline-grant.test.ts (1)

44-51: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add coverage for inline-key normalization.

normalizeInlineKey supports leading / and \ variants, but the inline-grant tests cover only document.html. The preview URL builder and parser already canonicalize these paths, so this adds regression coverage rather than fixing a current production failure.

♻️ Proposed additional test
+  it('normalizes slash variants onto the one key', async () => {
+    const grant = mint()
+    for (const path of [`/${INLINE_DOC_PREVIEW_ENTRY}`, `\\${INLINE_DOC_PREVIEW_ENTRY}`]) {
+      const outcome = await readDocPreviewFile(grant, path)
+      expect(outcome.ok).toBe(true)
+    }
+  })

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: bb12971c-74cc-4821-9bbd-512d86cbfb25

📥 Commits

Reviewing files that changed from the base of the PR and between b94bcdc and f1fc8ebccfa2f9cf37dcd25d01aa98e0aae83a0d.

⛔ Files ignored due to path filters (3)
  • src/main/office/__fixtures__/sample.docx is excluded by !**/*.docx
  • src/main/office/__fixtures__/sample.pptx is excluded by !**/*.pptx
  • src/main/office/__fixtures__/sample.xlsx is excluded by !**/*.xlsx
📒 Files selected for processing (88)
  • src/main/browser/doc-preview-file-reader.ts
  • src/main/browser/doc-preview-grant-registry.ts
  • src/main/browser/doc-preview-inline-grant.test.ts
  • src/main/ipc/doc-preview-grant-ipc.ts
  • src/main/ipc/office-preview-ipc.ts
  • src/main/office/__fixtures__/README.md
  • src/main/office/__fixtures__/sample.docm
  • src/main/office/office-document-path.test.ts
  • src/main/office/office-document-path.ts
  • src/main/office/office-error-codes.test.ts
  • src/main/office/office-error-codes.ts
  • src/main/office/office-host-dispatch.test.ts
  • src/main/office/office-host-dispatch.ts
  • src/main/office/office-local-execution.ts
  • src/main/office/office-method-executor.ts
  • src/main/office/office-probe-service.ts
  • src/main/office/office-render-service.integration.test.ts
  • src/main/office/office-render-service.ts
  • src/main/office/office-selection-service.ts
  • src/main/office/office-skills-service.test.ts
  • src/main/office/office-skills-service.ts
  • src/main/office/office-surface-parity.test.ts
  • src/main/office/office-watch-client-ledger.ts
  • src/main/office/office-watch-manager.integration.test.ts
  • src/main/office/office-watch-manager.ts
  • src/main/office/office-watch-port.test.ts
  • src/main/office/office-watch-port.ts
  • src/main/office/office-watch-refresh.ts
  • src/main/office/officecli-argv.test.ts
  • src/main/office/officecli-argv.ts
  • src/main/office/officecli-invocation.ts
  • src/main/office/officecli-lane.ts
  • src/main/office/officecli-resolution.ts
  • src/main/providers/filesystem-provider-contract.ts
  • src/main/providers/ssh-filesystem-office.ts
  • src/main/providers/ssh-filesystem-provider.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/office.ts
  • src/main/startup/main-process-ready-foundation.ts
  • src/main/window/main-window-webview-security.ts
  • src/preload/api-types.ts
  • src/preload/api/office-api.ts
  • src/preload/api/office-bridge.ts
  • src/preload/index.ts
  • src/relay/office-handler.ts
  • src/relay/relay-runtime-services.ts
  • src/renderer/src/app-shell/use-app-shell-services.ts
  • src/renderer/src/components/browser-pane/workspace-doc/office-marks-panel.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/office-missing-binary-notice.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-failure-panel.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-pane.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-refresh-state.test.ts
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-refresh-state.ts
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-status.ts
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-toolbar.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/use-office-document-change.ts
  • src/renderer/src/components/browser-pane/workspace-doc/use-office-probe.ts
  • src/renderer/src/components/browser-pane/workspace-doc/use-office-snapshot.ts
  • src/renderer/src/components/browser-pane/workspace-doc/workspace-doc-page-pane.tsx
  • src/renderer/src/components/editor/EditorEditFileSurface.tsx
  • src/renderer/src/components/editor/editor-office-binary-placeholder.tsx
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/components/settings/OfficeSkillsSetting.tsx
  • src/renderer/src/components/settings/office-skills-catalog-state.test.ts
  • src/renderer/src/components/settings/office-skills-catalog-state.ts
  • src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts
  • src/renderer/src/hooks/useOfficeLivePreviewSweep.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/file-preview.ts
  • src/renderer/src/lib/file-type-icon-extension-table.ts
  • src/renderer/src/lib/office-install-terminal.ts
  • src/renderer/src/lib/office-live-preview.ts
  • src/renderer/src/lib/office-live-refresh.ts
  • src/renderer/src/lib/office-preview-plan.test.ts
  • src/renderer/src/lib/office-preview-plan.ts
  • src/renderer/src/lib/office-selection-handoff.ts
  • src/renderer/src/lib/office-selection-reference.test.ts
  • src/renderer/src/lib/workspace-doc-page-conversion.ts
  • src/shared/binary-file-extensions.ts
  • src/shared/office-file-extensions.test.ts
  • src/shared/office-file-extensions.ts
  • src/shared/office-host-owner.ts
  • src/shared/office-preview-channels.ts
  • src/shared/office-preview-contracts.ts
  • src/shared/office-preview-rpc.ts
  • src/shared/protocol-version.ts
  • tests/e2e/helpers/officecli-availability.ts
  • tests/e2e/office-document-preview.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread src/main/office/office-probe-service.ts Resolved
Comment on lines +94 to +99
child.stdout?.on('data', (chunk: Buffer) => {
stdout += chunk.toString('utf8').slice(0, 4_000)
})
child.stderr?.on('data', (chunk: Buffer) => {
stderr += chunk.toString('utf8').slice(0, 4_000)
})

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Bound the accumulated stdout and stderr, not each chunk.

slice(0, 4_000) truncates every chunk, but the concatenation is unbounded. On the success path the session keeps the child (Line 109) and these listeners stay attached, so a watch server that logs on each request grows both strings for the whole lifetime of the live preview. Both buffers are only read inside startOnPort (Lines 113-135), so growth after readiness has no consumer.

Cap the total length, and stop collecting once readiness resolves.

🐛 Proposed fix to cap the buffers and detach the listeners
-  child.stdout?.on('data', (chunk: Buffer) => {
-    stdout += chunk.toString('utf8').slice(0, 4_000)
-  })
-  child.stderr?.on('data', (chunk: Buffer) => {
-    stderr += chunk.toString('utf8').slice(0, 4_000)
-  })
+  const MAX_CAPTURED_CHARS = 4_000
+  const onStdout = (chunk: Buffer): void => {
+    stdout = (stdout + chunk.toString('utf8')).slice(0, MAX_CAPTURED_CHARS)
+  }
+  const onStderr = (chunk: Buffer): void => {
+    stderr = (stderr + chunk.toString('utf8')).slice(0, MAX_CAPTURED_CHARS)
+  }
+  child.stdout?.on('data', onStdout)
+  child.stderr?.on('data', onStderr)

Then release the listeners after waitForWatchPort resolves:

   const readiness = await waitForWatchPort(port, {
     intervalMs: OFFICE_WATCH_READY_POLL_INTERVAL_MS,
     timeoutMs: OFFICE_WATCH_READY_TIMEOUT_MS,
     isAlive: () => !exited
   })
+  child.stdout?.off('data', onStdout)
+  child.stderr?.off('data', onStderr)
+  child.stdout?.resume()
+  child.stderr?.resume()
   if (readiness === 'ready') {

resume() keeps the pipes drained after the listeners are removed, so the child does not block on a full stdout buffer.

Comment on lines +57 to +66
if (lane.kind === 'wsl') {
const result = await runWslProcess({
program: resolved.path,
args,
distro: lane.distro,
loginPath: 'preferred',
cwd: options.cwd,
timeoutMs: options.timeoutMs,
maxOutputBytes: options.maxOutputBytes
})

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Description: Check runWslProcess option shape and officecli callers that pass an AbortSignal.
set -euo pipefail

fd -t f 'wsl-runner.ts' src | while IFS= read -r file; do
  ast-grep outline "$file" --items all
  rg -n -C 5 'signal|AbortSignal|RunWslProcessOptions|export (async )?function runWslProcess' "$file"
done

# Callers that hand a signal to runOfficecli.
rg -nP -C 4 'runOfficecli\(' src | rg -n -C 4 'signal'

Repository: stablyai/orca

Length of output: 2433


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- officecli invocation ---'
sed -n '1,125p' src/main/office/officecli-invocation.ts

printf '%s\n' '--- WSL runner contract and execution path ---'
sed -n '35,95p' src/main/wsl/wsl-runner.ts
sed -n '185,285p' src/main/wsl/wsl-runner.ts

printf '%s\n' '--- shared process runner signal contract ---'
sed -n '1,220p' src/shared/child-process/run-process.ts

printf '%s\n' '--- WSL option construction and signal references ---'
rg -n -C 4 'runWslProcess\\(|signal:|AbortSignal|timeoutMs' src/main src/shared/child-process

Repository: stablyai/orca

Length of output: 19075


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- officecli invocation ---'
sed -n '1,125p' src/main/office/officecli-invocation.ts

printf '%s\n' '--- WSL runner contract and execution path ---'
sed -n '35,95p' src/main/wsl/wsl-runner.ts
sed -n '185,285p' src/main/wsl/wsl-runner.ts

printf '%s\n' '--- shared process runner signal contract ---'
sed -n '1,220p' src/shared/child-process/run-process.ts

printf '%s\n' '--- WSL option construction and signal references ---'
rg -n -C 4 'runWslProcess\(|signal:|AbortSignal|timeoutMs' src/main src/shared/child-process

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,125p' src/main/office/officecli-invocation.ts
sed -n '35,95p' src/main/wsl/wsl-runner.ts
sed -n '185,285p' src/main/wsl/wsl-runner.ts
sed -n '1,220p' src/shared/child-process/run-process.ts
rg -n -C 4 'runWslProcess\(|signal:|AbortSignal|timeoutMs' src/main src/shared/child-process

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- process option contract ---'
sed -n '1,180p' src/shared/child-process/process-spec.ts

printf '%s\n' '--- WSL environment probe contract ---'
rg -n -C 8 'export (async )?function getWslGuestEnvironment|getWslGuestEnvironment\\(' src/main/wsl/wsl-guest-environment.ts src/main/wsl/wsl-runner.ts

Repository: stablyai/orca

Length of output: 3415


Propagate AbortSignal through the WSL runner.

ProcessSpec.signal kills the child when aborted, but WslSpec does not expose a signal and runWslProcess omits it from its final runProcess call. An aborted WSL Office call therefore cannot terminate its child and remains subject to timeoutMs. Add signal?: AbortSignal to WslSpec, pass options.signal to runWslProcess, and forward spec.signal to runProcess.

Comment thread src/renderer/src/i18n/locales/en.json Outdated
Comment on lines +11861 to +11862
"installed": "Installed {{count}} skills.",
"installedPartial": "Installed {{installed}}; {{failed}} could not be installed.",

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Handle pluralization for installedPartial independently.

OfficeSkillsSetting reaches this toast when failed > 0 and passes installed and failed, but no count option. A reachable { installed: 1, failed: 1 } result renders Installed 1; 1 could not be installed. Add the missing noun and use plural-aware translations for each count. Do not add only _one/_other variants to the existing key, because i18next cannot select them without count.

Comment thread src/renderer/src/lib/file-preview.ts Outdated
import type { OfficeDocKind } from '../../../shared/office-file-extensions'
import { resolveOfficePreviewRouting } from '@/lib/office-preview-plan'

export { convertBrowserPageToWorkspaceDoc } from '@/lib/workspace-doc-page-conversion'

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Break the file-preview.ts ↔ workspace-doc-page-conversion.ts cycle.

file-preview.ts re-exports convertBrowserPageToWorkspaceDoc, while workspace-doc-page-conversion.ts imports openFileInBrowserTab from file-preview.ts. This triggers the configured import/no-cycle warning, and lint runs that configuration with --deny-warnings, so the lint gate can fail. Update all callers and test mocks to import from @/lib/workspace-doc-page-conversion, then remove the re-export.

Comment on lines +63 to +70
export function isValidOfficeDocumentPath(value: unknown): value is string {
return (
typeof value === 'string' &&
value.trim().length > 0 &&
value.length <= MAX_PATH_LENGTH &&
!value.includes('\0')
)
}

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.

🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check whether office RPC registrations scope the document path to a worktree root.
set -euo pipefail

fd -t f 'office' src/main/runtime src/relay src/main/providers --exec rg -n -C6 'path|worktree|scope|resolveWithin|isInside|OFFICE_RENDER_METHOD|officeRequest' {}

# Compare with the existing scoped read path for reference.
rg -n -C6 'worktree|scope|isInside|resolveWithin' src/main/browser/doc-preview-file-reader.ts

Repository: stablyai/orca

Length of output: 2860


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- shared RPC definitions ---'
cat -n src/shared/office-preview-rpc.ts | sed -n '1,180p'

printf '%s\n' '--- SSH relay ---'
fd -t f -i 'office' src | xargs -r rg -n -C8 'createOfficeMethods|DocumentPath|executeOfficeMethod|officeRequest|dispatchOfficeRequest|OFFICE_RENDER_METHOD'

printf '%s\n' '--- runtime registration and render implementation ---'
rg -n -C10 'createOfficeMethods|office.preview|renderOfficeLocally|renderOffice|officecli|DocumentPath|isValidOfficeDocumentPath|resolveWithin|worktree' src/main src/relay src/shared

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Office-related files ---'
git ls-files | rg '(^|/)(office|.*office.*)\.(ts|tsx)$'

printf '%s\n' '--- Office path validators and executors ---'
rg -l 'DocumentPath|isValidOfficeDocumentPath|renderOfficeLocally|executeOfficeMethod' src --glob '*.ts' --glob '*.tsx' |
  while IFS= read -r file; do
    echo "### $file"
    rg -n -C5 'DocumentPath|isValidOfficeDocumentPath|renderOfficeLocally|executeOfficeMethod|officeRequest|createOfficeMethods' "$file"
  done

Repository: stablyai/orca

Length of output: 28095


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- canonical path handling ---'
cat -n src/main/office/office-document-path.ts

printf '%s\n' '--- local execution and lane resolution ---'
cat -n src/main/office/office-local-execution.ts | sed -n '1,180p'
rg -n -C8 'function resolveOfficeLaneTarget|resolveOfficeLaneTarget|type OfficecliLane|NATIVE_OFFICECLI_LANE|resolve.*Path|worktree|root' src/main/office src/main/providers/ssh-filesystem-office.ts

printf '%s\n' '--- scoped file-read implementation ---'
rg -n -C8 'canonical.*Path|resolveWithin|isInside|worktree|files.read|doc-preview-file-reader' src/main src/shared --glob '*.ts'

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat -n src/main/office/office-document-path.ts
printf '%s\n' '---'
cat -n src/main/office/office-local-execution.ts | sed -n '1,180p'
printf '%s\n' '---'
cat -n src/main/office/officecli-lane.ts
printf '%s\n' '---'
cat -n src/main/providers/ssh-filesystem-office.ts

Repository: stablyai/orca

Length of output: 11751


Path Traversal

Exploitability: Difficult
CWE: CWE-22 — Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Bind Office paths to the owning worktree before execution.

canonicalOfficeDocumentPath only requires an absolute, existing path and resolves symlinks. It does not enforce a permitted root. The local, SSH, and runtime paths then pass the canonical path to officecli, so a caller can request Office files outside the worktree and receive their preview or extracted data. Add a host-side root-boundary check after canonicalisation.

@greptile-apps

greptile-apps Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Too many files changed for review (104 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@overjt

overjt commented Sep 9, 2026

Copy link
Copy Markdown
Author

Thanks both — all of it acted on in 45897ba, plus something neither review caught.

The repo's own gate was failing. pnpm run check:code-quality:changed reported 7 findings (6 × switch-exhaustiveness-check, 1 × react-doctor no-adjust-state-on-prop-change). I had run plain oxlint instead of the gate AGENTS.md actually specifies, so CI would have gone red. Fixed: the method executor is now one exhaustive switch with no default, so adding a method to OFFICE_RPC_METHODS without handling it is a compile error; the copy tables enumerate every error code, so a new code forces a copy decision; and the document-change reset happens during render instead of in an effect.

@pullfrog — the NUL separator: confirmed, and worse than a nitpick. Byte-inspected: one \x00 in each of the two files, and git diff --numstat returned - - for both — so the canonicalisation and client-ledger modules, the two most security-relevant files in the PR, were literally unreviewable in the diff. It was a deliberate collision guard (a separator has to be a byte neither half can contain), so I kept that property without the exotic byte: both keys are now JSON.stringify([...]), matching localSshBrowserAuthorityConnectionIdentity. git diff --numstat main..HEAD now reports 122 and 62 lines instead of -.

Both nitpicks were right too: the unused OFFICE_PREVIEW_UPDATE_REQUIRED_MESSAGE is gone, and the comment claiming the runtime "reads the advertised capability up front" now says what the code does — the host advertises office.preview.v1 so a client can see the surface exists, but the protection that runs is the method_not_found → OFFICE_HOST_UPDATE_REQUIRED mapping on the calling side.

@coderabbitai — one correction and one partial disagreement.

Path traversal (CWE-22, Major): the severity is overstated, but the fix was worth doing and I did it. A paired client can already call terminal.create + terminal.send and run arbitrary shell on the host, so office.render(absolutePath) crossed no trust boundary that wasn't already crossed — there's no escalation. What is real is the consistency gap: every runtime files.* method is (worktree, relativePath) and office was the only one taking a bare absolute path. So documents are now named as (workspaceRoot, relativePath); the host joins, canonicalises both, and enforces isPathInsideOrEqual, reusing the same helper readAuthorizedDocPreviewFile already uses. Canonicalise-then-check, not a lexical check, because a symlink inside the workspace defeats the lexical one — that case is pinned in office-document-boundary.test.ts and ablation-checked (disabling the containment branch turns exactly the two boundary tests red). Documents outside any workspace keep working by falling back to their own directory as the root, the same fallback buildDocPreviewGrantRequest uses.

Import cycle: the cycle is real and I broke it — 6 production callers plus 2 test mocks now import from @/lib/workspace-doc-page-conversion and the compat re-export is gone. But the stated mechanism is wrong: import/no-cycle is configured at warn with maxDepth: 3 and the native gate reports 0 findings, so the lint gate was not failing on it. It was worth fixing because I introduced it gratuitously, not because it was breaking CI.

Everything else landed as suggested: the accumulated (not per-chunk) stdout/stderr cap with the listeners detached and the pipes resumed once readiness settles; supportsWatch matched at any indentation — and thank you for #5, the Live gate genuinely was missing because an earlier blind string-replace silently no-op'd and typecheck can't see that; watch teardown when the reader leaves the live page, keyed on the live page's id since a conversion always mints a fresh one; "Reveal in folder" hidden rather than falling back to a different action behind the same label; _one/_other plurals following the connectedHostCountLabel convention (the caller picks the key, because translate(key, fallback) resolves the inline fallback for en); aria-pressed on the toggles; the E2E helper running the fallback binary rather than stat-ing it; explicit ctx.skip(); sorted-array parity assertions; and the inline-key normalization test.

One I did not take: AbortSignal through the WSL runner. The gap is real, but zero callers pass a signal — it was dead option surface I'd added. Rather than plumb a signal through shared WSL infrastructure for something nothing uses, I'd sooner leave it; say the word if you'd prefer the plumbing.

Verified: pnpm tc, the changed-files quality gate (0 findings), 6953 tests, and both Office E2E specs still green.

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

Important

The workspace-boundary refactor is clean and addresses every prior finding, but the stopOfficeWatch fallback now breaks watch teardown on Windows (see the inline comment). Fixing it is a one-line change.

Reviewed changes

  • Bound Office methods to a (workspaceRoot, relativePath) pair — the bare absolute path param became a root-plus-relative pair across the IPC shape, the shared RPC contracts, the local/SSH/paired host implementations, and every renderer call site, with a host-side resolveOfficeDocumentTarget that joins, canonicalises (symlinks included, plus a WSL readlink -f lane) and proves containment before any spawn.
  • Replaced the NUL-byte session separators — officeSessionKey and recordKey are now JSON tuples, restoring both modules to diffable text; the inline-grant slash-normalisation test and the parity assertions (sorted arrays instead of sets) were added alongside.
  • Made the integration test skip explicitly (ctx.skip()) and broadened supportsWatch detection (^[ \t]+watch\b); the E2E binary probe now runs officecli --version rather than only statting it.
  • Gated the Live toggle on a real probe answer — useOfficeProbe gained an answered flag so an absent binary no longer masquerades as a missing one for the first frames, and "too old to watch" is surfaced separately from failure.
  • Keyed the live-preview sweep on the converted page id — findLivePageId ties teardown to the freshly minted live page, so Back-to-document retires the watch instead of keying on the surviving workspace row.
  • Polish — plural-aware mark and skills copy, aria-pressed on the skills toggle, "Reveal in folder" hidden on remote hosts, and the misleading office.preview.v1 comment plus the unused OFFICE_PREVIEW_UPDATE_REQUIRED_MESSAGE removed.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/office/office-watch-manager.ts Resolved

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

Important

Every prior finding except one landed cleanly in 45897baa70 and I found no new defects in the delta. The one that remains open — a hardcoded / in the stopOfficeWatch fallback key — is a genuine, still-unfixed leak on native Windows, so I am not approving until it is resolved.

⚠️ Windows stop fallback rebuilds the session key with a hardcoded /

stopOfficeWatch falls back to canonicalPath = \${ref.workspaceRoot}/${ref.relativePath}` when the document no longer canonicalises. On native Windows the key recorded at start (resolveOfficeDocumentTarget→realpath) spells the path with backslashes (c:\repo\a\b.docx), while this fallback produces the mixed c:\repo/a\b.docx. officeSessionKeylowercases both but the separators still differ, sosessions.get(...)misses, theunwatchcall goes out with a spelling the server never saw, and the process-tree kill that owns the child never runs — leaking theofficecli watchprocess and its loopback port until app quit. The fix is to rebuild the fallback withjoinOfficeRelativePath(ref.workspaceRoot, ref.relativePath)(which selects the lane's separator) rather than the manual/join; the symlinked-path case stays unrecoverable by any lexical join, andstopAllOfficeWatches` remains the quit-time backstop.

Reviewed changes

  • Bound every document to a workspace — every office method now names (workspaceRoot, relativePath) instead of a bare absolute path; the host joins and canonicalises both halves and enforces isPathInsideOrEqual, with a new OFFICE_DOCUMENT_OUTSIDE_WORKSPACE code and boundary tests that pin the symlink escape.
  • Restored two modules to text — officeSessionKey and recordKey now build JSON.stringify([...]) tuples instead of a raw NUL separator, so office-document-path.ts and office-watch-client-ledger.ts diff normally again.
  • Made the method executor exhaustive — executeOfficeMethod is one switch with no default, so an unhandled OFFICE_RPC_METHODS entry is a compile error; the copy tables enumerate every error code for the same reason.
  • Re-keyed live-preview teardown — the sweep watches the converted live page's fresh id rather than the workspace row, so Back-to-document retires the watch.
  • Hardened the probe — an answered flag stops the Live toggle blaming a present binary during first render, and supportsWatch now matches any indentation.
  • Polished surface copy — _one/_other plural keys, aria-pressed on skill toggles, "Reveal in folder" hidden on remote hosts, the unused constant dropped, and the office.preview.v1 comment rewritten to match the code.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@overjt

overjt commented Sep 9, 2026

Copy link
Copy Markdown
Author

@pullfrog — confirmed, fixed in a343908, and the finding turned up a second bug underneath it.

Your finding is real. startOfficeWatch keys on resolveOfficeDocumentTarget → realpath, which on Windows spells C:\repo\docs\a.docx; the delete-fallback built C:\repo/docs\a.docx. officeSessionKey lowercased both but not the separators, so sessions.get(...) missed and the watch process plus its loopback port leaked until app quit. It reaches users in the ordinary way you describe — the document deleted between watch-start and pane close.

I fixed the class rather than the instance. Your suggested one-liner is right about the cause but incomplete: joinOfficeRelativePath only picks the first separator from the root's shape, so a relative half carrying docs/a.docx still yields C:\repo\docs/a.docx and the lookup would still miss. So the key itself now normalises through normalizeRuntimePathForComparison — the same basis isPathInsideOrEqual already uses for the boundary check — and the two producers cannot disagree by separator at all. I took the lane-aware join too, for the reason you'd want it anyway: that string is also the argument handed to officecli unwatch, not just a registry lookup.

The second bug. Normalising by the path's shape rather than by process.platform fixes something I'd shipped in the previous commit: officeSessionKey lowercased whenever the host was Windows, but a WSL lane on a Windows host hands back a guest path on a case-sensitive filesystem. /home/me/Repo/a.docx and /home/me/repo/a.docx are two documents on ext4, and the old key merged them — so opening the second would have reused the first's watch and shown the wrong document. That one was mine, not something either review flagged.

Both are pinned in office-document-path.test.ts and ablation-checked: restoring the old key implementation turns the separator/case test red. One honest caveat in the test comment — the WSL assertion only discriminates the two implementations on Windows; what pins the fix on every platform is the case half of the separator test, where a Windows-shaped path folds while running on macOS, proving the fold follows the path rather than the host.

Verified: pnpm tc, the changed-files quality gate (0 findings), and the office suite (53 tests) green.

On your open question from the first review, now that both are settled: the NUL was a deliberate collision guard, not a leftover — a separator has to be a byte neither half can contain. Dropping it entirely (${hostKey}${canonicalPath}) would have been unsafe for the same reason: hostKey is ssh:<connectionId> and a connection id can contain /, so two different pairs could concatenate to one string. The JSON tuple keeps that property and stays text.

@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: 4

Caution

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

⚠️ Outside diff range comments (2)
src/main/office/office-render-service.ts (1)

95-95: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject failed WSL output reads.

Line 95 returns read.stdout even when cat exits non-zero. The preceding wc result is also unchecked. If officecli exits successfully but does not create document.html, WSL returns empty stdout and this function reports { ok: true, html: '' } instead of a render failure.

Check both process exit codes and throw or return OFFICECLI_RENDER_FAILED when either read command fails. Add a WSL test where the render command succeeds without creating the output file.

src/main/office/office-watch-manager.ts (1)

96-100: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Bound the watch output buffers. startOnPort keeps stdout and stderr listeners attached to the long-lived officecli child. Each listener appends up to 4,000 characters from every chunk, but neither accumulated string has a total cap. A noisy live preview can therefore grow main-process memory until the watch stops. Keep draining both streams, but bound each accumulated buffer at this capture site.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 149c0543-4a9a-46cb-a97e-38e7947c1eb1

📥 Commits

Reviewing files that changed from the base of the PR and between f1fc8ebccfa2f9cf37dcd25d01aa98e0aae83a0d and 45897baa70ff7b80028dd1cfe1c22993236dd050.

📒 Files selected for processing (48)
  • src/main/browser/doc-preview-inline-grant.test.ts
  • src/main/ipc/office-preview-ipc.ts
  • src/main/office/office-document-boundary.test.ts
  • src/main/office/office-document-path.ts
  • src/main/office/office-host-dispatch.test.ts
  • src/main/office/office-host-dispatch.ts
  • src/main/office/office-local-execution.ts
  • src/main/office/office-method-executor.ts
  • src/main/office/office-probe-service.ts
  • src/main/office/office-render-service.integration.test.ts
  • src/main/office/office-render-service.ts
  • src/main/office/office-selection-service.ts
  • src/main/office/office-surface-parity.test.ts
  • src/main/office/office-watch-client-ledger.ts
  • src/main/office/office-watch-manager.integration.test.ts
  • src/main/office/office-watch-manager.ts
  • src/main/office/office-watch-refresh.ts
  • src/main/runtime/rpc/methods/office.ts
  • src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/browser-page-toolbar.tsx
  • src/renderer/src/components/browser-pane/navigate/workspace-doc-address-submission.ts
  • src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-pane.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/doc-preview-address-edit.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/office-marks-panel.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-pane.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-status.ts
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-toolbar.tsx
  • src/renderer/src/components/browser-pane/workspace-doc/use-office-document-change.ts
  • src/renderer/src/components/browser-pane/workspace-doc/use-office-probe.ts
  • src/renderer/src/components/browser-pane/workspace-doc/use-office-snapshot.ts
  • src/renderer/src/components/settings/OfficeSkillsSetting.tsx
  • src/renderer/src/components/settings/office-skills-install-copy.test.ts
  • src/renderer/src/components/settings/office-skills-install-copy.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/browser-page-conversion-history.test.ts
  • src/renderer/src/lib/browser-page-conversion-history.ts
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/lib/file-preview.ts
  • src/renderer/src/lib/office-live-preview.ts
  • src/renderer/src/lib/office-live-refresh.ts
  • src/renderer/src/lib/office-preview-plan.ts
  • src/renderer/src/lib/office-selection-handoff.ts
  • src/shared/office-host-owner.ts
  • src/shared/office-preview-channels.ts
  • src/shared/office-preview-contracts.ts
  • src/shared/office-preview-rpc.ts
  • src/shared/protocol-version.ts
  • tests/e2e/helpers/officecli-availability.ts
💤 Files with no reviewable changes (4)
  • src/shared/protocol-version.ts
  • src/main/office/office-watch-client-ledger.ts
  • src/main/office/office-document-path.ts
  • src/renderer/src/lib/file-preview.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/renderer/src/components/browser-pane/workspace-doc/office-marks-panel.tsx
  • src/renderer/src/components/settings/OfficeSkillsSetting.tsx
  • tests/e2e/helpers/officecli-availability.ts
  • src/main/office/office-host-dispatch.ts
  • src/main/office/office-render-service.integration.test.ts
  • src/main/office/office-watch-refresh.ts
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-toolbar.tsx
  • src/renderer/src/i18n/locales/en.json

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread src/main/office/office-watch-manager.ts Resolved
Comment thread src/main/office/office-watch-manager.ts Resolved
Comment thread src/main/runtime/rpc/methods/office.ts Resolved
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@overjt Thanks for the detailed verification and correction.

I agree that the original CWE-22 severity overstated the impact in this trust model. The canonicalized (workspaceRoot, relativePath) contract and post-canonicalization containment check are still the correct design. The symlink boundary test is important coverage.

I also agree with leaving AbortSignal out of the WSL runner for now. No current caller supplies a signal, so the plumbing would add inactive shared infrastructure.

The exhaustive gate fixes, text-safe JSON tuple keys, corrected capability description, and reported test results address the review items.

🐇✅


✏️ Learnings added
Learnt from: overjt
URL: https://github.com/stablyai/orca/pull/19741

Timestamp: 2026-09-09T20:14:57.029Z
Learning: For Office preview RPC methods, a paired client already has arbitrary shell execution on the owning host through `terminal.create` and `terminal.send`. A bare absolute document path therefore does not introduce a new privilege boundary, but Office document operations must still use canonicalized `(workspaceRoot, relativePath)` inputs and enforce containment after canonicalization, including symlink escapes, for consistency with the runtime `files.*` contract.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

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

✅ No new issues found.

Reviewed changes

  • Keyed watch sessions on a normalised path — officeSessionKey now routes both producers through normalizeRuntimePathForComparison, so the realpath spelling (C:\repo\docs\a.docx) and the delete-fallback join can no longer disagree by separator; stopOfficeWatch also falls back through joinOfficeRelativePath, which fixes the string handed to officecli unwatch too, not just the registry lookup.
  • Folded case by the path's shape, not the host platform — the WSL lane's guest path stays case-sensitive, so /home/me/Repo/a.docx and /home/me/repo/a.docx remain two documents on ext4 instead of sharing one watch and showing the wrong document.
  • Pinned both in office-document-path.test.ts — separator and case assertions plus a WSL case-sensitivity assertion, with the honest caveat documented that the case half of the separator test is what proves the shape-driven fold off Windows.

The prior finding is resolved, and the NUL-separator question is settled: it was a deliberate collision guard, and the JSON tuple keeps that injectivity in text.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes

  • Normalised the watch-session key — officeSessionKey now runs the canonical path through normalizeRuntimePathForComparison (the same basis isPathInsideOrEqual uses), so the two key producers — realpath at start and the lexical-join fallback at stop — can no longer disagree on separator spelling, closing the native-Windows watch leak flagged last review.
  • Rebuilt the stop fallback with the lane-aware join — stopOfficeWatch now uses joinOfficeRelativePath instead of a hardcoded /, so the fallback string works as both the registry lookup and the officecli unwatch argument on Windows.
  • Fixed a latent WSL case-folding bug — case-folding now follows the path's shape rather than process.platform, so a WSL lane on a Windows host no longer merges /home/me/Repo and /home/me/repo into one session.
  • Pinned both halves with tests — new officeSessionKey cases prove Windows separators and case fold regardless of host platform, and that a WSL guest path stays case-sensitive.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@overjt

overjt commented Sep 9, 2026

Copy link
Copy Markdown
Author

@coderabbitai — all four taken, in 240cf8d. They were written against 45897ba but I re-diffed each against HEAD; all four were still live.

Stop pending watch startups. Confirmed: stopOfficeWatch never consulted starting. A stop issued inside the readiness budget found no session, returned ok, and the child registered a moment later kept its process and loopback port for the rest of the run — reachable by clicking Live and closing the tab, with up to a 15s window. The stop now awaits an in-flight start before the lookup; readiness is bounded, so the wait is too. I went with awaiting rather than cancellation because cancelling a half-spawned watch is a lot of machinery for a path that already has a bounded ceiling. Pinned by a start-then-stop test in office-watch-manager.integration.test.ts, ablation-checked — removing the await turns it red.

unwatch with a rejected path. Taken, and it needed one more step than either of us wrote. Adding the containment check alone would have done nothing: isPathInsideOrEqual folds separators and case but does not resolve .., so /w/repo/../../elsewhere/x.docx still tests as inside /w/repo — I checked before trusting it. So joinOfficeRelativePath now normalises through the right path flavour first, collapsing the traversal to /elsewhere/x.docx, and the fallback re-tests containment on that. I skipped the session-identity bookkeeping you suggested: with the join collapsing traversal, the lexical check is sufficient for the only case the fallback exists to serve (the document deleted while watched), and the symlink case it cannot cover is already why resolveOfficeDocumentTarget re-tests after realpath.

RPC boundary validation. Confirmed exactly as described — zod accepted " " and NUL-carrying strings that isValidOfficeDocumentPath rejects, and an invalid optional workspaceRoot then read as absent and selected this host's default lane. Both schemas refine through the shared predicates now, so the wire and the host agree on what a usable path is.

Symlink test on Windows. Taken, it.skipIf(process.platform === 'win32'), matching worktree-trash.test.ts. The containment logic under test is platform-independent, so nothing is lost.

Verified: pnpm tc, the changed-files quality gate (0 findings), and 70 office/shared tests green.

Two earlier items from your first pass I should close out explicitly, since they were about code that has since been rewritten: the path param they concerned no longer exists — documents are (workspaceRoot, relativePath) and the host resolves and bounds them. And the AbortSignal-through-WSL gap is still open by choice, since no caller passes a signal; happy to plumb it if you'd rather not carry the dead option.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@overjt Thanks for the detailed follow-up.

The four findings are addressed.

  • Awaiting the bounded pending startup prevents the late watch registration and port leak.
  • Normalizing joinOfficeRelativePath before the fallback containment check closes the traversal case.
  • Shared predicate refinement makes the RPC schema and host validation agree.
  • The Windows skip matches the existing symlink-test policy.

Leaving AbortSignal out of the WSL runner is reasonable while no caller supplies one. It avoids inactive shared infrastructure.

🐇✅


🧠 Learnings used
Learnt from: overjt
URL: https://github.com/stablyai/orca/pull/19741

Timestamp: 2026-09-09T20:14:57.037Z
Learning: For Office preview RPC methods, a paired client already has arbitrary shell execution on the owning host through `terminal.create` and `terminal.send`. A bare absolute document path therefore does not introduce a new privilege boundary, but Office document operations must still use canonicalized `(workspaceRoot, relativePath)` inputs and enforce containment after canonicalization, including symlink escapes, for consistency with the runtime `files.*` contract.

You are interacting with an AI system.

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

ℹ️ No critical issues — one minor observation about an in-flight race the new stop-path wait still does not fully cover, inline.

Reviewed changes

  • Collapsed ./.. in joinOfficeRelativePath — the shared join now runs the result through the lane-flavoured path.normalize, so a caller that cannot canonicalise (the stop path, once the document is deleted) can still test containment lexically without realpath.
  • Applied the boundary on the way out — stopOfficeWatch's deleted-document fallback now rejects a traversal relative path (OFFICE_DOCUMENT_OUTSIDE_WORKSPACE) instead of handing it to officecli unwatch, using isPathInsideOrEqual on the collapsed join.
  • Waited for an in-flight start before reading the session registry — stopOfficeWatch awaits the start promise for its key, closing the "reader clicks Live, then closes the tab inside the readiness budget" leak.
  • Refined the paired-runtime schemas through the shared predicates — WorkspaceRoot and RelativePath now .refine on isValidOfficeDocumentPath/isValidOfficeRelativePath, so a whitespace-only or NUL-carrying root no longer reads as absent and silently probes the default lane.
  • Adjusted tests — the symlink-escape boundary case skips on Windows (needs elevation/Developer Mode), and new tests pin traversal collapse plus stopping a watch whose start is still in flight.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/office/office-watch-manager.ts Resolved
Renders .docx/.xlsx/.pptx on the host that owns the document, through
officecli, and shows the result in the existing document-preview
partition. Adds a live-preview toggle, selection handoff to the agent
composer, and a Settings action that installs officecli's own agent
skills.

One host-side implementation is shared by the local host, the SSH relay
and paired runtimes, so a refusal cannot be named three different things
depending on where the document lives. Failures cross the boundary as
stable codes; the renderer owns every reader-facing sentence.

Snapshots ride a new `inline` preview-grant owner that reads no
filesystem at all — strictly narrower than both existing owners, and it
keeps rendered output out of the reader's worktree and git status.
Addresses the PR review, plus the repo's own changed-files quality gate,
which was failing with seven findings CI would have caught.

Documents are now named as (workspace root, path relative to it) — the
shape every runtime `files.*` method already uses. The host joins the
two, canonicalises both, and refuses anything landing outside the root,
so the check survives a symlink that a lexical test would miss. office
was the only surface taking a bare absolute path; it no longer is.

Two path modules carried a literal NUL byte as a key separator, which
made Git treat them as binary — the canonicalisation and client-ledger
modules were unreviewable in the diff. Both now build the key from a
JSON tuple, which is collision-proof without the exotic byte.

Also: the Live toggle now really is gated on the host's `watch` support
(the earlier edit silently no-op'd and typecheck cannot see that); the
watch is torn down when the reader leaves the live page rather than only
when the tab closes; "Reveal in folder" hides on remote hosts instead of
quietly opening the system app; watch stdout/stderr are bounded in total
rather than per chunk; and counted strings use the repo's `_one`/`_other`
plural convention.
The stop path falls back to a lexical join when the document has been
deleted since the watch started, and that join spelled a Windows path
with a stray forward slash — `C:\repo/a.docx` against the all-backslash
spelling realpath recorded at start. The lookup missed, so the watch
process and its loopback port leaked until app quit.

Rather than fix the one producer, the key itself now normalises through
`normalizeRuntimePathForComparison` — the same basis `isPathInsideOrEqual`
already uses — so the two producers cannot disagree by separator at all.
The fallback also uses the lane's own join, because that string is handed
to `officecli unwatch` as well as being the registry key.

That normaliser also folds case by the path's shape instead of this
process's platform, which fixes a second, latent bug: a WSL lane on a
Windows host hands back a guest path on a case-sensitive filesystem, and
the old `process.platform === 'win32'` lowercase merged `/home/me/Repo`
and `/home/me/repo` into one session — showing the wrong document.
Four findings from the CodeRabbit pass on 45897ba, all still present.

`stopOfficeWatch` never consulted `starting`, so a stop issued while a
watch was still coming up found no session, returned ok, and the child
registered a moment later kept its process and loopback port for the
rest of the run. Readiness is bounded at 15s and so is the wait, so the
stop now awaits an in-flight start before looking the session up.

The delete-fallback also handed its lexically joined path to `officecli
unwatch` without re-testing the boundary, so a traversal relative path
reached the tool after every other method had refused it. It is checked
lexically now — which needed `joinOfficeRelativePath` to collapse `..`
first, because `isPathInsideOrEqual` folds separators and case but does
not resolve traversal, and the check would otherwise have passed
`/w/repo/../../elsewhere/x.docx` as inside `/w/repo`.

Also: the runtime schemas refine through the shared predicates, so a
whitespace-only or NUL-carrying `workspaceRoot` is an RPC validation
error instead of quietly reading as absent and selecting the default
lane; and the symlink boundary test skips on Windows, where creating one
needs elevation, as `worktree-trash.test.ts` already does.
Rebasing onto main landed two contracts the office surface predates: RPC
methods now bind a shared params schema the generated catalog indexes by
identity, and changed files may not use type assertions.

- Move the office param schemas to src/shared/rpc-contract/office-params.ts
  and register OFFICE_METHODS as plain defineMethod declarations, so the
  catalog and the params-parity gate see each method's literal name.
- Replace the unknown-params casts with record guards; the two remaining
  casts are wire replies and carry a SAFETY rationale.

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

ℹ️ No new issues — this delta is a type-safety and RPC params catalog cleanup, verified against the type-parity gate and the targeted tests.

Reviewed changes

Reviewed the delta fc51d75c82..b8ee4bf0e0 (commit b8ee4bf0e0, "follow main's RPC params catalog and casting rule"); all earlier commits were covered by prior pullfrog reviews.

  • Moved the paired-runtime params schemas into the shared contract — src/main/runtime/rpc/methods/office.ts now binds OfficeDocumentParams / OfficeElementParams / OfficeOptionalDocumentParams / OfficeProbeParams / OfficeSkillInstallParams from the new src/shared/rpc-contract/office-params.ts, so the RPC params type-parity gate (which only catalogs schemas reachable from src/shared) sees the office methods instead of treating them as uncatalogued.
  • Regenerated the RPC params catalog — rpc-params-catalog.generated.ts gains the eleven office.* entries; pnpm run generate:rpc-params-catalog --check is clean.
  • Turned createOfficeMethods() into the exported const OFFICE_METHODS — consumed by methods/index.ts and the surface-parity test, which is what lets the generator resolve each method's params schema by identity.
  • Replaced type assertions with unknown-safe narrowing — isRecord/field helpers in office-preview-ipc.ts, office-method-executor.ts, office-selection-service.ts, office-host-owner.ts and office-preview-rpc.ts; 'html' in outcome in office-host-dispatch.ts; .find/.some/Set in place of as casts; documented SAFETY: exemptions where a cast remains.

Verified locally: pnpm tc:node, pnpm tc:web, the catalog drift check, and the six targeted office/shared test files (40 tests) all pass.

The one open pullfrog thread from review 5159695954 (the stopOfficeWatch in-flight-start race) is untouched by this commit and remains open as a non-blocking observation; it is not re-raised here.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@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: Advanced

Run ID: fc9e6d63-e2f4-4d1f-8a5d-8042b385e311

📥 Commits

Reviewing files that changed from the base of the PR and between 240cf8daf167ac869a1ec4406e613d2241ad1ce7 and b8ee4bf.

⛔ Files ignored due to path filters (1)
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (23)
  • src/main/ipc/office-preview-ipc.ts
  • src/main/office/office-document-boundary.test.ts
  • src/main/office/office-host-dispatch.ts
  • src/main/office/office-method-executor.ts
  • src/main/office/office-selection-service.ts
  • src/main/office/office-surface-parity.test.ts
  • src/main/providers/filesystem-provider-contract.ts
  • src/main/providers/ssh-filesystem-office.ts
  • src/main/providers/ssh-filesystem-provider.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/office.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/browser-pane/workspace-doc/office-preview-status.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/office-preview-plan.test.ts
  • src/shared/office-file-extensions.test.ts
  • src/shared/office-host-owner.ts
  • src/shared/office-preview-contracts.ts
  • src/shared/office-preview-rpc.ts
  • src/shared/protocol-version.ts
  • src/shared/rpc-contract/office-params.ts
  • tests/e2e/office-document-preview.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/i18n/locales/en.json

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread src/main/ipc/office-preview-ipc.ts Resolved
…op race

Three findings from the PR review bots, all reproducible:

- An invalid `workspaceRoot` read as absent, and absent means "this host's
  default lane". Only the paired-runtime path has a zod schema; the local IPC
  and SSH relay paths hand params straight to the executor, so a skills
  install for a WSL workspace could land in the native lane and report
  success. `readOfficeWorkspaceRoot` now answers three states and both paths
  refuse the unusable one.
- `stopOfficeWatch` waited on `starting`, which is keyed on the canonical
  path and therefore empty until the start's `realpath` resolves. A stop that
  canonicalised first left the child running. The start now claims a lexical
  intent key before its first await, and the stop waits on that.
- The e2e spec left report.docx and legacy.doc in the worker-scoped seeded
  repo; both are now removed after Electron shuts down.

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

✅ No new issues found.

Reviewed changes

Reviewed the delta b8ee4bf0e0..9f1e5610d4 (commit 9f1e5610d4); the six underlying commits were covered by prior pullfrog reviews. This delta closes both open threads from the last review: the stopOfficeWatch in-flight-start race and the absent-vs-unusable workspace-root ambiguity.

  • Made an unusable workspace root a typed refusal — the new readOfficeWorkspaceRoot reads workspaceRoot as three states ({} absent means the host's default lane, { workspaceRoot } valid, null supplied-but-unusable); the IPC layer and the method executor now refuse a whitespace-only, NUL-carrying or non-string root with OFFICECLI_FILE_NOT_FOUND instead of silently probing or installing skills into the native lane.
  • Closed the start/stop race — startOfficeWatch now claims a lexical startingIntents key synchronously, before its first await, and stopOfficeWatch awaits that key before its own resolveOfficeDocumentTarget. A stop that wins the realpath race can no longer miss a later-registering child and leak its process and loopback port.
  • Tidied the E2E fixtures — the seeded .docx/.doc are now removed through registerPostElectronShutdownCleanup, so the worker-scoped repo is not left dirty for later tests.

Verification: pnpm tc:node clean; oxlint clean on the eight changed files; office-document-boundary, office-surface-parity, office-document-path and office-file-extensions pass; office-watch-manager.integration passes with 2 skips (no officecli on this runner, so the new race test does not execute here).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support Office document formats (DOCX, PPTX, XLSX) as first-class file types

1 participant