Skip to content

refactor(runtime): unify embedded event subscriptions - #1795

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/runtime-event-delivery
Jul 27, 2026
Merged

refactor(runtime): unify embedded event subscriptions#1795
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/runtime-event-delivery

Conversation

@limityan

@limityan limityan commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • make AgentRuntime the single event subscription entry for embedded TUI, headless CLI, Peer Host, ACP, and SDK Host
  • keep concrete EventQueue construction, legacy queue draining, and lifecycle ownership in Core product assembly
  • remove the CLI-specific Core event-source alias while retaining deprecated source compatibility for existing bitfun-core consumers
  • document the embedded event-delivery chain and each adapter's fail-closed projection

Architecture

flowchart LR
  Queue["Core EventQueue"] --> Owner["Core queue lifecycle owner"]
  Owner --> Runtime["AgentRuntime API"]
  Runtime --> Adapters["TUI / Exec / Peer / ACP / SDK Host adapters"]
Loading

First-party hosts use the AgentRuntime event API. The deprecated Core event-source and builder entries are thin migration facades over the same owner; they do not create another runtime or first-party subscription path.

The CLI continues to run embedded and does not depend on the SDK Host. This change adds no Shared IPC event operation, replay contract, background service, new event schema, or terminal API.

Independent review fixes

  • corrected the architecture diagram so Runtime cannot appear to bypass the Core lifecycle owner
  • documented ACP protocol failure and SDK Host RestartHost recovery alongside TUI, Exec, and Peer behavior
  • restored deprecated source compatibility for the previously public Core event-source and five-argument builder APIs

Three independent architecture, lifecycle, and product reviews found no remaining reproducible P0/P1/P2 issues after these fixes.

Scope

  • 12 files
  • 184 insertions / 55 deletions
  • one logical commit
  • local PR design and execution plans remain excluded from Git

Validation

  • cargo check --workspace
  • cargo test -p bitfun-cli (339 unit tests plus all integration suites)
  • cargo test -p bitfun-sdk-host-app (14 process and stdio tests)
  • cargo test -p bitfun-agent-runtime event_source -- --nocapture (6 tests)
  • cargo test -p bitfun-core product_runtime::tests:: -- --nocapture (17 tests)
  • node scripts/check-core-boundaries.mjs
  • node scripts/check-repo-hygiene.mjs
  • touched-file rustfmt --check and git diff --check
  • confirmed the bitfun-cli dependency tree contains no SDK Host package

@limityan
limityan force-pushed the yanzhn/runtime-event-delivery branch from ba6fc50 to 416489e Compare July 27, 2026 06:46
@limityan
limityan merged commit c9c3c10 into GCWing:main Jul 27, 2026
6 checks 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