Skip to content

feat(runtime-host): preserve capability providers across reconnect - #2608

Merged
M4n5ter merged 2 commits into
mainfrom
feat/2522-reconnect-capability-providers
Aug 9, 2026
Merged

M4n5ter merged 2 commits into
mainfrom
feat/2522-reconnect-capability-providers

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

  • persist one Desktop Runtime Host Client instance identity under the Electron userData profile;
  • key Client Capability providers by the authenticated principal and persistent Client instance instead of an ephemeral connection;
  • preserve Session affinity while a provider is disconnected and restore it only when that exact authenticated Client returns with an equivalent contract;
  • let a reconnecting Client take over its provider lease before the stale connection finishes closing, without allowing stale unregister or teardown to invalidate the replacement.

The wire registration ID remains an immutable manifest-version identity. Reconnect affinity uses the stable provider identity, so in-flight snapshots can retain their original registration without mutating it in place.

Refs #2522

Verification

  • npm --workspace @maka/runtime-host test — 797 tests passed;
  • npm --workspace @maka/runtime-host run typecheck;
  • npm exec -- tsc -p apps/desktop/tsconfig.main.json --noEmit;
  • focused real-UDS reconnect coverage verifies disconnect, unavailable state, authenticated rebind, and invocation over the replacement connection;
  • Biome and git diff --check pass for the affected files.

Remaining Phase 4 work

  • shared reconnect and bounded-backoff lifecycle;
  • subscription catch-up and operation-specific indeterminate-outcome handling;
  • unattended capability-provider service mode and provider-unavailable Automation behavior;
  • restart, partition, slow-consumer, revocation, and shutdown journeys.
简体中文

摘要

  • 在 Electron userData profile 下持久化 Desktop Runtime Host Client 实例身份;
  • Client Capability provider 不再绑定临时连接,而是绑定认证主体与持久 Client 实例;
  • provider 断开时保留 Session affinity;只有同一认证 Client 携带等价 contract 返回时才恢复;
  • 新连接可在旧连接完成关闭前接管 provider lease,旧连接后续的 unregister 或 teardown 不会破坏替代连接。

wire registration ID 继续表示不可变的 manifest 版本。重连 affinity 使用稳定 provider 身份,因此正在使用的 snapshot 可以继续引用原 registration,不需要原地修改。

关联 #2522

验证

  • npm --workspace @maka/runtime-host test:797 项测试通过;
  • npm --workspace @maka/runtime-host run typecheck
  • npm exec -- tsc -p apps/desktop/tsconfig.main.json --noEmit
  • 真实 UDS 重连覆盖验证了断开、不可用状态、认证身份重绑定,以及替代连接上的工具调用;
  • 受影响文件通过 Biome 与 git diff --check

Phase 4 剩余工作

  • 共享重连与有界退避生命周期;
  • subscription catch-up 与按 operation 区分的 indeterminate outcome 处理;
  • 无人值守 capability-provider service mode 与 Automation provider unavailable 行为;
  • restart、partition、slow consumer、revocation 与 shutdown 场景。

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@M4n5ter
M4n5ter marked this pull request as ready for review August 9, 2026 15:00
@M4n5ter
M4n5ter merged commit 511eeda into main Aug 9, 2026
9 checks passed
@M4n5ter
M4n5ter deleted the feat/2522-reconnect-capability-providers branch August 9, 2026 15:00
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