feat(runtime-host): add session continuity - #1358
Conversation
d56953c to
7767091
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
The projection boundary, terminal fence, and sequence validation have useful focused coverage.
[P2] A transition to waiting_for_user is not published. Runtime records that status through run_status_changed, but RootTurnCoordinator only forwards text, thinking, and tool events to SessionContinuityCoordinator. The subscribed snapshot can therefore remain running while the runtime is waiting for permission, until a terminal transition or unrelated queue update forces another projection read.
[P2] When an activated subscription fills its queue while a send is in flight, #evictSlowSubscriber calls sink.close() at packages/runtime-host/src/server/session-continuity-coordinator.ts:464-466. ConnectionSession wires that method to #teardown() at packages/runtime-host/src/server/connection-session.ts:165-174, so one slow subscription closes every other subscription and in-flight request on the same connection. The current slow-subscriber test uses two separate connections and does not cover this case.
I also found two blocking issues and will leave them inline. I would hold this until those are fixed.
|
@Astro-Han The two review-summary findings are also fixed in
The tests use the canonical Store projection for permission state and one real connection containing the blocked subscription, a sibling subscription, and normal status traffic. I also updated the PR body to record these decisions and the complete-event tool-output bound. 简体中文Review summary 中的两项 finding 也已在
测试通过 canonical Store projection 验证 permission state,并在同一真实 connection 中同时覆盖受阻订阅、兄弟订阅和普通 status traffic。PR body 也已同步记录这些决策及完整事件的 tool-output bound。 |
bced367 to
c5a50f9
Compare
c5a50f9 to
b0c2e84
Compare
|
@Astro-Han #1357 has landed, so I have rebased this branch onto the latest 简体中文#1357 已合并,因此我已将本分支 rebase 到最新 |
Astro-Han
left a comment
There was a problem hiding this comment.
Approved. The previous review blockers are fixed: dirty refreshes are not dropped, legal tool output fits one frame, permission entry invalidates the projection, and slow-subscriber eviction stays local to that subscription.
Non-blocking follow-ups:
- [P2] Permission-state projections do not converge on every transition.
permission_requestcan refresh before the asynchronous Run status write completes, andpermission_decision_ackdoes not refresh at all. A subscriber can retain a mixed or stalewaiting_for_usersnapshot until terminal. - [P2] Continuity accepts Pi
messageIdvalues that its wire decoder rejects. A provider ID such asprovider:msg:1can be emitted by the server but failrequireEntityIdon the client, which currently closes the shared connection. - [P3] Canonical Turn snapshot logic is duplicated between
canonical-turn-snapshot.tsandRootTurnCoordinator. - [P3] The execution handoff relies on production
start()paths yielding through durable I/O beforeonRunStarted()re-enters the Session gate. Please make that contract explicit or cover it with a regression test. - [P3]
session_removedexists in the protocol but has no server send path; a canonical read returningnullleaves the old subscription alive.
None of these block this non-serving slice. CI is green, and I did not find a P0 or P1.
English
Context
This PR establishes Session continuity on top of the Host-owned Message authority in #1357. It is part of the Runtime Host Session-core migration tracked in #1167.
The Runtime Host remains non-serving in production, and this PR does not switch any Desktop, TUI, CLI, or Headless entrypoint.
What changes
subscription.openandsubscription.closeoperations with an atomic snapshot/live barrier, per-subscription sequence numbers, bounded delivery, and slow-consumer isolation.Design
id/seqvalues through wire-only fragmentation.waiting_for_userwithout relying on an unrelated queue change.Evidence
Coverage exercises the snapshot/live barrier, in-flight refresh invalidation, permission waiting, exact terminal fencing, complete tool-output transfer through the real Pi producer and protocol decoder, hosted linked-child projection, pre-start interrupt, connection handoff, sequence/Epoch rejection, local slow-consumer isolation, and EOF cleanup.
Relevant Runtime Host and Runtime tests, workspace typechecks and builds, Biome checks, and
git diff --checkpass. Focused correctness review found no remaining P0-P2 issue in this slice.Scope
This slice intentionally does not add a generic event bus, durable replay log, resume token, independent Session query API, Interaction ownership, archive/remove control, Automation/Goal continuity, production surface wiring, or the M4/M5 production cutover.
Part of #1167. Related to #853.
简体中文
背景
本 PR 在 #1357 的 Host-owned Message authority 之上建立 Session continuity,属于 #1167 跟踪的 Runtime Host Session core 迁移。
Runtime Host 仍未进入 production serving;本 PR 不切换 Desktop、TUI、CLI 或 Headless 的任何入口。
改动内容
subscription.open与subscription.closeoperation,提供原子 snapshot/live barrier、每订阅序号、有界投递和慢消费者隔离。设计
id/seq。waiting_for_user。验证证据
覆盖 snapshot/live barrier、in-flight refresh invalidation、permission waiting、精确 terminal fence、经过真实 Pi producer 与协议 decoder 的完整 tool-output 传输、hosted linked-child projection、pre-start interrupt、connection handoff、sequence/Epoch 拒绝、局部慢消费者隔离及 EOF 清理。
相关 Runtime Host 与 Runtime 测试、workspace typecheck 与 build、Biome 检查及
git diff --check均通过;定向正确性审查未发现本 slice 仍有 P0-P2 问题。范围
本 slice 明确不加入 generic event bus、durable replay log、resume token、独立 Session query API、Interaction ownership、archive/remove control、Automation/Goal continuity、production surface wiring,或 M4/M5 production cutover。
属于 #1167;关联 #853。