Skip to content

perf(agent-runtime): isolate leaf capability closures - #2275

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/agent-runtime-leaf-capabilities
Aug 14, 2026
Merged

perf(agent-runtime): isolate leaf capability closures#2275
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/agent-runtime-leaf-capabilities

Conversation

@limityan

Copy link
Copy Markdown
Collaborator

背景

bitfun-agent-runtime 的空默认构建此前仍等同完整 Runtime。DeepResearch 纯编号与 Hook 设置解析等窄 consumer 会被迫编译 Session、Tool、Runtime Services 和进程执行能力;Services Integrations 的 deep-research / hook-import 也通过完整 Agent Runtime 继承无关闭包。

本 PR 按真实 owner 在同一 crate 内切分源码和依赖,不新增 crate、transport、兼容 full umbrella、CI job 或 workspace package。

变更

  • 将 Agent Runtime 收敛为 5 个明确 feature:空 defaultdeep-researchnative-hook-settingsnative-hook-runtime 和完整 agent-runtime
  • 逐项闭合 10 个直接 consumer 的 normal/dev/optional edge、forwarder、activator 和 aggregate;完整 Runtime 不隐式包含 DeepResearch。
  • DeepResearch post-turn IO 改为使用当前 session 注入的 WorkspaceFileSystem,不再把 Remote SSH 路径交给 Windows host 文件系统探测。
  • 路径拼接由 filesystem provider 持有:本地沿用宿主 PathBuf 语义,Remote SSH 对 /~~/repo、相对 root 和 . 保持 POSIX。
  • DeepResearch 的报告、sidecar schema 和 best-effort 行为保持不变;公开 IO error 继续使用 std::io::Error / PathBuf 并保留 ErrorKind
  • DeepResearch 与 Hook settings 使用独立 integration target;Hook 子进程失败域继续独立,其他 Runtime 合同保持既有聚合边界。
  • 复用现有 core-boundary checker,看护 feature graph、consumer edge、source cfg、显式测试拓扑和 Agent Runtime 根模块闭集;不增加第二套 checker 或流水线。

编译图

normal,build 的版本化 package instance 去重,target 为 Windows x86_64、macOS arm64、Linux x86_64:

闭包 Windows macOS Linux
Agent Runtime feature-free 76 → 1 79 → 1 78 → 1
Agent Runtime agent-runtime 76 → 76 79 → 79 78 → 78
Agent Runtime Hook settings 76 → 10 79 → 10 78 → 10
Services Integrations DeepResearch 77 → 36 80 → 38 79 → 37
Services Integrations Hook import 121 → 89 112 → 79 111 → 78
Core product-full 569 → 569 556 → 556 600 → 600

这里报告依赖图和 focused-test 输入,不宣称完整产品 wall-clock 提速。Cargo.lock 字节不变,无新增、升级或降级 package;.github/** 不变。

兼容边界

  • Rust Runtime SDK 版本提升为 v6。仓外 embedder 需要显式选择 bitfun-agent-runtime/agent-runtime;启用后原 sdk 路径和运行行为保持不变。
  • run_for_session_workspace / try_renumber_research_report 现在要求注入 WorkspaceFileSystem,用于消除远程路径向宿主文件系统回退。这是有意的 Rust source migration。
  • WorkspaceFileSystem::join_path 是带默认实现的 additive port;现有本地 provider 无需改写,Remote provider 显式覆盖路径方言。

验证

  • node --test scripts/check-core-boundaries.test.mjs:119/119
  • node scripts/check-core-boundaries.mjs
  • cargo test --locked -p bitfun-agent-runtime --no-default-features --features agent-runtime,deep-research --lib --tests
  • cargo test --locked -p bitfun-services-integrations --no-default-features --features deep-research --lib deep_research::tests::
  • Remote SSH provider POSIX absolute/home/relative path focused test
  • 64 个 OS publisher thread 的 EventQueue 顺序测试连续 5 轮
  • cargo check --locked -p bitfun-core --no-default-features --features product-full
  • cargo check --locked -p bitfun-agent-runtime --no-default-features --features agent-runtime --example sdk_minimal
  • cargo metadata --locked --offline --no-deps
  • pnpm run check:repo-hygiene
  • 两轮独立对抗复审及 findings 修复后的最终闭环复核:无 P0-P3

本地未连接真实 SSH/SFTP/container,也未在 Windows 主机执行 macOS 编译;这些平台集成继续由现有 CI 验证,不新增流水线检查。

Split DeepResearch and native Hook settings from the full portable runtime, close all direct consumer feature profiles, and preserve provider-owned workspace IO semantics.

BREAKING CHANGE: Rust Runtime SDK v6 embedders must explicitly enable the agent-runtime feature; DeepResearch report helpers now require an injected WorkspaceFileSystem.
@limityan
limityan marked this pull request as ready for review August 14, 2026 03:13
@limityan
limityan merged commit 8480386 into GCWing:main Aug 14, 2026
7 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