Preserve Docs opener host routing - #2088
Merged
ymichael merged 1 commit intoAug 20, 2026
Merged
Conversation
ymichael
deleted the
bb/post-merge-fix-docs-opener-drops-explicit-host-thr_tivk5tf382
branch
August 20, 2026 22:41
ymichael
added a commit
that referenced
this pull request
Aug 20, 2026
## What was wrong PR #2088 correctly preserved `PluginFileOpenerSource.experimental_hostId` through the Docs frontend and private RPC, but `resolveOpenerFile` consumed it only for `source.kind === "host"`. Root Compose opens a project-source Markdown file as `{ kind: "workspace", environmentId: null, projectId, experimental_hostId }`, so Docs accepted the source identity and then skipped its only workspace branch, throwing “Docs can open workspace, host, and thread-storage files only.” The same project-backed file already works in the PDF opener through the core project content route. ## What changed Docs now resolves a workspace source with no environment and a project ID through the project's authoritative local-path source. An explicit `experimental_hostId` selects that host; omission resolves through `system.config().primaryHostId`, matching the public opener contract and core project-workspace routing. The resolved source root and host feed the existing confined Files SDK read, preview, and optimistic-write calls. Missing, duplicate, or non-absolute project-source identities fail closed instead of selecting another machine. This is the smallest complete fix: one resolver branch plus one server regression. Environment-backed workspace, absolute host-file, and thread-storage behavior is unchanged. There is no SDK, CLI, guide, configuration, or host-daemon wire change, so `HOST_DAEMON_PROTOCOL_VERSION` is unchanged. ## How you verified The pre-fix focused regression failed both project-backed cases with the reported error (2 failed, 31 passed): - `pnpm exec turbo run test --filter=bb-plugin-simple-notes -- server.test.ts` After the fix and the final rebase onto `deb723091` / merged #2059: - The focused server suite passed 32 tests. The regression proves selected-host read, preview, and optimistic save routing; omitted-host primary routing even when a different project source is marked default; and rejection of an unknown selected host before file I/O. - `pnpm exec turbo run test typecheck build --filter=bb-plugin-simple-notes --force` passed: 66 tests, Docs build and typecheck, 7 successful Turbo tasks. - `git diff --check origin/main...HEAD` passed. Related to #2088, #2083, and #2059. > AGENT GENERATED: by GPT-5.6-Sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The Docs file opener rebuilt the SDK's
PluginFileOpenerSourcefor its private RPC contract but droppedexperimental_hostId. Its backend schema could not accept that field, and host-file resolution hardcodedhostId: null, so opening, previewing, or autosaving a file selected on remote host A could read or overwrite the same absolute path on the primary host.What changed
The Docs app now carries the existing optional
experimental_hostIdthrough its opener source for bothopenFileandsaveOpenedFile. The Docs RPC schema and parser preserve that value, and host-file resolution returns it to the existing Files SDK read, preview, and write calls. When the field is omitted, resolution still returnsnull, intentionally preserving primary-host behavior.This is the smallest complete fix because it extends the direct data flow for the existing SDK source identity; it does not add a parallel host field or refactor unrelated routing. PR #2083 is now merged, and this branch is rebased on top of it; that PR changes persisted app-tab source routing, while this change fixes the separate Docs app/server RPC hop.
There is no host-daemon wire change: the plugin RPC is server-owned and the Files SDK already supports its host selector, so
HOST_DAEMON_PROTOCOL_VERSIONis unchanged. There are no CLI, guide, SDK, or user-facing configuration changes.How you verified
The regressions failed before the implementation with the exact routing break: the app test received an opener source without
experimental_hostId, while the server test rejected it as an unrecognized schema key (2 failed, 56 passed):pnpm exec turbo run test --filter=bb-plugin-simple-notes -- app.test.tsx server.test.tsAfter the fix:
host_remote.pnpm exec turbo run test typecheck build --filter=bb-plugin-simple-notes --forcepassed after the final rebase: 65 tests passed; the Docs typecheck and build passed; 7 Turbo tasks succeeded.git diff --check origin/main...HEADpassed.Related to #2005 and #2083.