Repository navigation
fix(doc-preview): preview SSH host files only through the host's Orca server - #47204
Conversation
Preview grants checked the file's SSH connection id before its server, so a row that still named an SSH target got an ssh grant that main refuses with "Remote connection dropped". Every served SSH host is a managed server now, so grants are runtime-only; a host with no server says so instead of opening a preview that can't load.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
合入上游 fa60d0a..33dfd04(1988 个提交),110 个冲突文件全部按「以上游为底、重放 fork 改动」解决。 上游这一段的主要变化与 fork 侧的应对: - stablyai#46786 删除约 93% 的测试与配套夹具:登记表摘掉已不存在的上游测试;fork 测试仍需要的 38 个夹具搬进 src/fork-test-support、tests/e2e/fork-fixtures;守护 fork 行为的用例移植到各功能自有测试。 - 主进程状态重构为 DesktopCore:fork 启动代码改读 state.core.runtime;Goal 与本地任务的启动调用从行数已满的启动流程文件迁到 chat-journal-startup(时序不变,serve 仍在绑定 RPC 前等待 Goal 注册)。 - stablyai#46479 配对端智能体列表改为非 React 增量发布:公共会话名改成覆盖层接入,并修复发布器就绪前解析出的名字不随首发发出的问题。 - stablyai#47204 文档预览只经主机上的 Orca 服务端:局域网分享目标与 HTML 窗格内预览随之只认 runtime 授权。 - stablyai#48447 移除 Gemini CLI、测试专用导出被删:相应 fork 用例调整。 - 新棘轮(zod-prefer-lazy 等)命中的 fork 既有代码登记进基线;手机网页包脚本数量表按实测更新。 Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01GvYgJSDZu9H4rmSuyr1FeT
ELI5
HTML previews of files on an SSH host already work, because Orca now runs its own server on every SSH host it connects to. One leftover code path still tried to read some of those files "directly over SSH", which nothing in Orca can do any more. That path could only fail, with a misleading "Remote connection dropped" message. This PR removes it, so remote previews always go through the host's Orca server. When a host has no server, Orca now says so up front instead of opening a preview that can't load.
What Changed
buildDocPreviewGrantRequestused to check the file's SSHconnectionIdbefore its runtime server. If there was a connectionId, it minted ansshgrant. Main's doc-preview reader refuses everysshgrant withSSH_HOST_NOT_SERVED_MESSAGE("Remote connection dropped. Click Reconnect…"). Grants now only go to the server that owns the workspace (runtimeEnvironmentIdOrLocalUnlessTwin). A row that names no server gets no grant.getWorkspaceFilePreviewPlannow resolves the server first, the same order the file explorer, editor reads, markdown preview and chat links already use. A row that still names a bare SSH target (a legacy pre-orcad row whose host no Orca server serves) is refused with the existingsshHostWithoutServerMessage: "No Orca server is running on yet. Connect the host to set one up, then try again." Before, it opened a tab that could only fail.sshgrant any more, so thesshowner kind is removed from the preload type, IPC validation, the main grant registry, both readers, artifact share and external-link confirmation.What users see:
Why
Since 1.4.225 every served SSH host runs on orcad. The SSH-to-orcad migration deletes
connectionIdfrom the rows it moves, so a served host's rows areruntime:<env>with no connectionId. This desktop's main process serves nossh:route (requireLocalRoutethrowsSshHostNotServedError). Thesshgrant was therefore dead weight that could only produce a false "connection dropped".Alternatives considered:
Linked Issue
No GitHub issue. Remote browser parity gap M43 from the 2026-11-22 sweep. The gap's main claim (previews on SSH workspaces always fail while connected) did not reproduce on main: managed SSH previews already work. This PR fixes the leftover legacy path the gap pointed at.
Visual Proof
The preview behaviour on a connected SSH host is unchanged, so there is no before/after. These are live captures from a hidden dev build of this branch, against a real loopback SSH host running a freshly deployed orcad.
A managed SSH workspace previewing
index.htmlfrom the host, through the runtime grant:A legacy bare
ssh:row (injected into the renderer store, since no current flow creates one). No grant is minted and no guest page is created; the restored tab shows the existing "Preview unavailable" panel:Testing
Real remote run on macOS. A hidden dev build of this branch (
ORCA_BACKGROUND_LAUNCH=1, mock keychain, scratch HOME) connected to a userland sshd on 127.0.0.1 and deployed this branch's orcad template. I added a git repo on the host throughrepo.addon the managed server, then openedindex.htmlas a workspace doc tab.orca-preview://runtime grant.style.cssloaded too.Legacy bare
ssh:row (store-injected, branch only): no grant or guest is created (CDP target count unchanged), and the panel shows "Preview unavailable". On main this row mints ansshgrant that the reader refuses with "Remote connection dropped" (read from code,doc-preview-grants.ts:35-38anddoc-preview-file-reader.ts:252-253; not run).pnpm check:changedpassed, as didpnpm tc:webandpnpm tc:node.One review round (Codex + Claude) came back with no findings.
No test added: no existing tests pin these functions, and the change removes a branch rather than adding logic.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None, because this only reorders two checks that run when a preview opens, and deletes branches.
Risk
The riskiest part is the plan order. The runtime server is now checked before the per-file SSH id. A runtime row with a legacy nested SSH id now asks its server instead of failing on this desktop. Ambiguous ownership (
undefined) is still refused before either check, and twins are still refused first. Local workspaces still openfile://tabs. The grant IPC runs entirely inside one app, so there is no mixed-version wire impact. Older desktops, servers and phones see no change. Back out with a plain revert.Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
files.reador file grants. No new read path.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)