Skip to content

docs(remote): the desktop client now shares the phone's catalog, replay and gaps - #1019

Merged
huichen merged 1 commit into
mainfrom
docs/remote-closeout
Oct 13, 2026
Merged

huichen merged 1 commit into
mainfrom
docs/remote-closeout

Conversation

@huichen

@huichen huichen commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

目的

把远程客户端对齐这一轮的成果写回唯一维护位置的内部文档 docs/internals/desktop/CONNECTION.md §2.2.2(The Desktop as a client: connecting out),以及它的中文对照 CONNECTION.zh-CN.md。只改文档,最小 diff。

逐句改动与依据(按 origin/main 的实际代码核对)

# 被改动的句子(原文) 新写法 依据(commit / PR)
1 表行 get_events_since incremental replay | re-reads history when a link returns 删表,改为散文:链路恢复用 get_events_since 重放,「整页重读」只作兜底(旧宿主回 Unsupported command、重放窗口校验不过) #1013 perf(remote): incremental replay on remote timeline resume(desktop/src/features/remote-peer/useRemoteTimeline.ts:401,:443 注释写明回退条件)
2 表行 get_prompt_receipt polling | waits for the send acknowledgement 删表,改为散文:落盘的 prompt/继续请求在重发前先核对 get_prompt_receipt #1012 feat(remote): durable remote composer drafts and offline prompt outbox with idempotent receipts(remotePromptOutbox.ts、remotePeerClient.ts:349)
3 Two differences are **mechanism, not gaps** 改为「仍存的一处差异是机制而非缺口」:手机对可疑已失败的 socket 用 get_presence 探活再决定是否断开,桌面端读它本就持有的 presence 订阅 反向核对:grep -rn get_presence desktop/src desktop/src-tauri/src/remote_peer/ → 0 命中;mobile/src/remote/client.ts:357 有(restoreServingConnection,用于「先验证再拆连接」)
4 能力对齐列举(…workspaces; approval mode; skill recommendation) 补 including renaming one;并补一句「原本只有手机具备的行为也已补齐」:草稿按宿主+会话隔离落盘、离线 outbox、完成铃、问题导航、列表搜索、图片缩放平移 #1007(mobile/src/remote/useSessionCatalog.ts:646 发 rename_workspace);#1012(remoteComposerDraft.ts:25-26,key = desktopId+sessionId);#1009(useRemoteDoneBell.ts、desktop/src/lib/windowAttention.ts);#1018(RemoteConversationView.tsx:13,15 挂 QuestionNavControl);#1014(ActivityRail.tsx:265 searchQuery);#1010(features/filepreview/ImagePreview.tsx、imageZoom.ts)
5 「会话列表的合并」段只说了 state.sessions 快照,未说它怎么来 新增:快照内容变化时推送、带领域名与 {epoch, revision}、按版本门应用;presence 心跳让丢掉的推送可见并一次补齐;对早于该机制的宿主保留低速按宿主读取 #1015 perf(remote): adopt push-based remote catalog with version gate and slow-poll fallback(remote_host/catalog.rs:24 写 version:{epoch,revision};useRemotePeers.ts:154-155 收 catalog、:290 handleCatalog、:19 CATALOG_POLL_MS = 60_000 兜底)

未改动(仍然成立):Known limitations 三条(宿主单槽位 / mobile 非活动桌面只读观察者 / 设备识别需新宿主)——第三条与本次无关,按纪律不动;第一条、第二条本轮未涉及。同理「远端做不到的要隐藏」(终端/Review/文件树/Reset-Debug)与「右侧面板进一步对齐尚未做」仍成立,未动。

用户可见文档(docs/wiki/{en,zh}/Remote.md)未动:其 searchable 指的是「分享进 FutureOS」时选择会话的搜索,与本次新增的桌面会话列表搜索不矛盾,且本轮成果是内部能力对齐。

核对命令与结果(改动后重跑,均在 origin/main 之后)

$ grep -n get_events_since desktop/src/features/remote-peer/useRemoteTimeline.ts
401:        type: "get_events_since",
443:      // An old host answers "Unsupported command" for get_events_since; fall

$ grep -rn get_prompt_receipt desktop/src/features/remote-peer/{remotePromptOutbox.ts,remotePeerClient.ts}
remotePromptOutbox.ts:9:  * Recovery checks `get_prompt_receipt` first: ...
remotePeerClient.ts:349:    { type: "get_prompt_receipt", promptId: commandId },

$ grep -rn get_presence desktop/src desktop/src-tauri/src/remote_peer/ | wc -l
0
$ grep -n get_presence mobile/src/remote/client.ts
357:        connection, { type: "get_presence" }, "list", FOREGROUND_PROBE_TIMEOUT_MS,

$ grep -n 'payload["version"]' desktop/src-tauri/src/remote_host/catalog.rs
24:    payload["version"] = json!({ "epoch": epoch, "revision": previous.0 });
$ grep -n 'CATALOG_POLL_MS = ' desktop/src/components/layout/hooks/useRemotePeers.ts
19:const CATALOG_POLL_MS = 60_000;

$ grep -n 'KEY_PREFIX\|function storageKey' desktop/src/features/remote-peer/remoteComposerDraft.ts
23:const KEY_PREFIX = "remote-composer-draft:";
25:function storageKey(desktopId: string, sessionId: string): string {
26:  return `${KEY_PREFIX}${desktopId}:${sessionId || "draft:new"}`;

$ grep -n QuestionNavControl desktop/src/features/remote-peer/RemoteConversationView.tsx
13:import { QuestionNavControl } from "../agent/QuestionNavControl";
$ grep -n searchQuery desktop/src/components/layout/ActivityRail.tsx
265:  const [searchQuery, setSearchQuery] = useState("");
$ ls desktop/src/components/layout/hooks/useRemoteDoneBell.ts desktop/src/lib/windowAttention.ts
desktop/src/features/filepreview/ImagePreview.tsx  (zoom: imageZoom.ts)

「该断言现在是否仍成立」:

断言 是否仍成立 证据
桌面端仅靠轮询取目录 否(已改) 推送 + 版本门 + 60s 兜底
桌面端重连整页重读 否(已改) get_events_since 优先,整页读兜底
桌面端无持久离线队列 否(已改) remotePromptOutbox.ts(localStorage 落盘 + 回执核对)
桌面端远端切会话草稿串台/不落盘 否(已改) remoteComposerDraft.ts 按 desktopId+sessionId
桌面端无完成提醒 / 无问题导航 / 列表无搜索 / 预览无缩放 否(均已改) #1009 / #1018 / #1014 / #1010
mobile 无 rename_workspace 否(已改) mobile/src/remote/useSessionCatalog.ts:646
mobile 非活动桌面是只读观察者(轮询) 是(未动) mobile/src/remote/useDesktopCatalogs.ts:16 CATALOG_POLL_MS = 20_000、:24 注释 read-only observers
远端会话无终端/Review/文件树 是(未动) 本轮未涉及
设备识别需较新宿主 是(未动,与本次无关) 本轮未涉及

验证

文档无构建。已核对:所有引用的路径/标识符都在 origin/main 上真实存在(见上);改动后文中不再出现「desktop 只用轮询」「重连整页重读」「两处机制不同」等过期断言(grep -n "15 s\|re-reads history\|Two differences" docs/internals/desktop/CONNECTION.md 无命中)。

…ay and gaps

Bring §2.2.2 (The Desktop as a client) back in line with origin/main after the
remote-alignment round (#1007, #1009, #1010, #1012, #1013, #1014, #1015, #1017,
#1018):

- The two "mechanism, not a gap" table rows are gone: the desktop replays with
  get_events_since (falling back to one whole-page read) and probes
  get_prompt_receipt on a stored send, both as the phone does. The one remaining
  mechanism difference -- get_presence on a suspect socket vs. the presence
  subscription -- is stated in prose.
- The capability paragraph names the gains: workspace rename on the phone, and
  per-host/per-conversation drafts, the stored outbox, the done bell, question
  navigation, list search and image zoom on the desktop.
- The merged-list paragraph describes the pushed catalog: domain-tagged snapshots
  gated by {epoch, revision}, healed by the presence heartbeat, with a slow
  per-host read only as the fallback for older hosts.
- CONNECTION.zh-CN.md carries the same edits.
@huichen
huichen enabled auto-merge (squash) October 13, 2026 05:46
@huichen
huichen merged commit 88fe90a into main Oct 13, 2026
12 checks passed
@huichen
huichen deleted the docs/remote-closeout branch October 13, 2026 05:46
huichen added a commit that referenced this pull request Oct 13, 2026
…1020)

* feat(remote): read the run's log on the desktop, so a reply is whole

A remote conversation is read from two lanes: the host's *record* (a page of
its journal) and its *stream* (the events it pushes). Neither is the run: the
page ends where the agent last saved, and the pushes begin where this window
subscribed, so a reader who opens a conversation while the host is answering
sees a fragment — and used to see it twice, as the page's copy and the pushed
one were folded together on the assumption that the two lanes do not overlap.

They can. The run's own log is the third lane, and this makes the desktop read
it the way the phone already does (`get_events_since`): at an open (the state
read says which run is in flight, before any frame happens to arrive), when a
link comes back, and when a push declares a gap the feed could see. A reply
rebuilt from its log covers the run from its beginning, so the record's partial
copy of that run is hidden and the reply is drawn once — with the run's *own*
start time, which no push can carry, and continued in place by the frames that
follow.

What moved to `@future-os/thread-projection`, because both clients read the
same host: the run cursor (`runCursor`), the replay page loop and its integrity
rules (`replay`, `readRunReplay`), and the run's own start and duration in the
projector. The desktop's duplicate port of the cursor (replayWindow) is gone,
and so is the second copy of the page loop the phone kept for itself.

The fold is kept, but demoted: it is the answer for a run this client has *not*
read the log of — an older host that does not serve the command, or the first
read still in flight. A fragment built from pushes alone is dropped when the run
ends (its beginning is only in the record, so keeping it draws the words
twice), where a rebuilt reply is kept until the record is readable (the record
trails the terminal frame, which is what used to make a settled reply blink).

Verified: desktop 297 files / 3978 tests, mobile 153 suites / 3076 tests, the
shared package's 19 files / 595 tests, `tsc`, `eslint` on both clients. The
harness gained the two commands the desktop now reads and `remote-mid-flight`
asserts what only the log can give: one row, carrying the page's words and the
run's, timed at the run's own eight minutes. It fails without the read ("the
reply is timed from the reader's arrival"), and `remote-streaming` and
`remote-lean-stream` — which cover the fold path — still pass.

* docs(remote): the two clients' read of a run's log, as it now stands

The paragraph #1019 wrote described the state #1013 left: the desktop replayed
on resume and handed everything else to one whole-page read. Both clients now
read a run's log at the same three moments, the reply they draw comes from it,
and the page is kept for the part the log cannot answer. Says what the fallback
is when a host does not serve the command, which is no longer "one whole-page
read" but the fold.

* test(mobile): clear the lane in the refusal test, so jest exits

The rewritten case exercises a path that arms the lane's retry timer, and it is
not a fake-timer test: leaving it armed kept the node process alive after the
suite finished. Locally that is a jest warning; in CI it is the mobile job stuck
`in_progress` (35 minutes and counting) on a step whose tests had all passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant