diff --git a/docs/design/2026-10-31-managed-agent-structure-review.md b/docs/design/2026-10-31-managed-agent-structure-review.md index 20835b639ac..87b56e05659 100644 --- a/docs/design/2026-10-31-managed-agent-structure-review.md +++ b/docs/design/2026-10-31-managed-agent-structure-review.md @@ -194,7 +194,7 @@ cross-cutting "how the system works today" tour. nested records/constants resolve through inheritance (imports of nested types must name the owning role). A role-composition pin keeps the composite empty and owns no surface of its own. Consumer audit - (call-level, corrected after review): 22 single-role consumers inject + (call-level, corrected after review): 23 single-role consumers inject their role directly — lifecycle (`RenameEvidence`, `TurnInputEvidence`, `ChildLifecycleAdmissions`, `ActionResponseCoordinator`, `ContextCompressionCoordinator`, `ContextCompressionService`, @@ -202,7 +202,7 @@ cross-cutting "how the system works today" tour. query (`ManagedRuntimeCoordinator`, `SessionRecoveryService`, `ManagedExtensionCommandVerifier`, `ManagedSessionStore`, `ChildWorkspaceService`, `WorkspaceRuntimeResolver`, - `ManagedAutomationService`), policy (`ManagedMcpManagementService`, + `ManagedAutomationService`, `EmbeddedRuntimeBroker`), policy (`ManagedMcpManagementService`, `ManagedExtensionManagementService`), event projection (`MessageMaterializer`, `ReplayFloorAdvancer`, `ManagedToolResultStore`), and turn execution (`SessionWorktreeService`). Most of the remaining @@ -210,8 +210,8 @@ cross-cutting "how the system works today" tour. and keep the composite. The broker wiring is no longer one of them: `EmbeddedRuntimeBroker` forwards the store only into `WorkspaceRuntimeResolver` and `ManagedRuntimeCoordinator`, which both - take `SessionQueryStore`, so it is itself a candidate for the same - narrowing. Four of these — `ChildWorkspaceService`, + take `SessionQueryStore`, and it now injects `SessionQueryStore` itself. + Four of these — `ChildWorkspaceService`, `WorkspaceRuntimeResolver`, `ManagedAutomationService` and `TaskCancelCoordinator` — were initially deferred because their `this(...)` calls are constructor delegation within the same class rather diff --git a/docs/design/2026-10-31-managed-agent-structure-review.zh-CN.md b/docs/design/2026-10-31-managed-agent-structure-review.zh-CN.md index a10fb8d59c7..756ee1ab7b1 100644 --- a/docs/design/2026-10-31-managed-agent-structure-review.zh-CN.md +++ b/docs/design/2026-10-31-managed-agent-structure-review.zh-CN.md @@ -168,7 +168,7 @@ sweep 管理这个陷阱。各字段的单位本身是一份被钉住的绑定 `AgentStateStore` 保留为继承它们的组合接口,实现与测试继续使用完整 表面,嵌套 record/常量经继承解析(嵌套类型的 import 必须写拥有它的 角色)。角色组合 pin 保证组合接口自身为空、不拥有任何表面。消费方 - 审计(调用级,评审后更正):22 个单角色消费方已直接注入其角色—— + 审计(调用级,评审后更正):23 个单角色消费方已直接注入其角色—— 生命周期(`RenameEvidence`、`TurnInputEvidence`、 `ChildLifecycleAdmissions`、`ActionResponseCoordinator`、 `ContextCompressionCoordinator`、`ContextCompressionService`、 @@ -176,14 +176,14 @@ sweep 管理这个陷阱。各字段的单位本身是一份被钉住的绑定 (`ManagedRuntimeCoordinator`、 `SessionRecoveryService`、`ManagedExtensionCommandVerifier`、 `ManagedSessionStore`、`ChildWorkspaceService`、`WorkspaceRuntimeResolver`、 - `ManagedAutomationService`)、策略(`ManagedMcpManagementService`、 + `ManagedAutomationService`、`EmbeddedRuntimeBroker`)、策略(`ManagedMcpManagementService`、 `ManagedExtensionManagementService`)、事件投影 (`MessageMaterializer`、`ReplayFloorAdvancer`、`ManagedToolResultStore`)、 Turn 执行(`SessionWorktreeService`)。其余消费方多数跨角色,或把 store 透传给多角色依赖,继续使用组合接口。broker 装配已不在其列: `EmbeddedRuntimeBroker` 只把 store 转发给 `WorkspaceRuntimeResolver` 与 - `ManagedRuntimeCoordinator`,二者都收 `SessionQueryStore`,故它本身也是 - 同样收窄的候选。其中四个——`ChildWorkspaceService`、 + `ManagedRuntimeCoordinator`,二者都收 `SessionQueryStore`,它本身现已注入 + `SessionQueryStore`。其中四个——`ChildWorkspaceService`、 `WorkspaceRuntimeResolver`、`ManagedAutomationService`、 `TaskCancelCoordinator`——起初因 `this(...)` 是本类构造委托而非透传 而暂缓,已在 #15962 的后续中收窄。 diff --git a/packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/runtime/EmbeddedRuntimeBroker.java b/packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/runtime/EmbeddedRuntimeBroker.java index a447c1f6b3e..220d2f9e8d1 100644 --- a/packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/runtime/EmbeddedRuntimeBroker.java +++ b/packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/runtime/EmbeddedRuntimeBroker.java @@ -2,7 +2,7 @@ package com.alibaba.qwen.code.managedagent.config.runtime; import com.alibaba.qwen.code.managedagent.adapters.workspace.ChildWorktreeGit; import com.alibaba.qwen.code.managedagent.config.ManagedAgentProperties; -import com.alibaba.qwen.code.managedagent.contracts.session.AgentStateStore; +import com.alibaba.qwen.code.managedagent.contracts.session.SessionQueryStore; import com.alibaba.qwen.code.managedagent.contracts.workspace.ChildWorkspaceProvider; import com.alibaba.qwen.code.managedagent.contracts.workspace.RuntimeWarmer; import com.alibaba.qwen.code.managedagent.persistence.ExternalStorageRegistrationStore; @@ -55,7 +55,6 @@ public class EmbeddedRuntimeBroker implements RuntimeWarmer, AutoCloseable { private final RuntimeBrokerService service; private final RuntimeBrokerHttpServer server; private final RuntimeRecoveryCoordinator recovery; - private final AgentStateStore store; private final WorkspaceRuntimeResolver workspaces; private final ChildWorkspaceProvider childWorkspaces; private final com.alibaba.qwen.code.managedagent.contracts.workspace.ResidentWorkspaceCatalog residents; @@ -68,7 +67,7 @@ public class EmbeddedRuntimeBroker implements RuntimeWarmer, AutoCloseable { private final RuntimeBindingRepository extensionBindings; private final HttpRuntimeTransport extensionTransport; - public EmbeddedRuntimeBroker(AgentStateStore store, + public EmbeddedRuntimeBroker(SessionQueryStore store, ManagedAgentProperties properties, RuntimeBindingRepository bindingRepository, RuntimeSessionRepository sessionRepository, @@ -76,7 +75,7 @@ public class EmbeddedRuntimeBroker implements RuntimeWarmer, AutoCloseable { this(store, properties, bindingRepository, sessionRepository, executionRepository, null); } - public EmbeddedRuntimeBroker(AgentStateStore store, + public EmbeddedRuntimeBroker(SessionQueryStore store, ManagedAgentProperties properties, RuntimeBindingRepository bindingRepository, RuntimeSessionRepository sessionRepository, @@ -86,7 +85,7 @@ public class EmbeddedRuntimeBroker implements RuntimeWarmer, AutoCloseable { executionRepository, workspaceExecutionStore, null, null); } - public EmbeddedRuntimeBroker(AgentStateStore store, + public EmbeddedRuntimeBroker(SessionQueryStore store, ManagedAgentProperties properties, RuntimeBindingRepository bindingRepository, RuntimeSessionRepository sessionRepository, @@ -98,7 +97,7 @@ public class EmbeddedRuntimeBroker implements RuntimeWarmer, AutoCloseable { workspaceExecutionStore, publications, publicationData, null, null, null, null); } - public EmbeddedRuntimeBroker(AgentStateStore store, + public EmbeddedRuntimeBroker(SessionQueryStore store, ManagedAgentProperties properties, RuntimeBindingRepository bindingRepository, RuntimeSessionRepository sessionRepository, @@ -111,7 +110,7 @@ public class EmbeddedRuntimeBroker implements RuntimeWarmer, AutoCloseable { workspaceExecutionStore, publications, publicationData, null, null, null, ssh); } - public EmbeddedRuntimeBroker(AgentStateStore store, ManagedAgentProperties properties, + public EmbeddedRuntimeBroker(SessionQueryStore store, ManagedAgentProperties properties, RuntimeBindingRepository bindingRepository, RuntimeSessionRepository sessionRepository, ToolExecutionRepository executionRepository, WorkspaceExecutionStore workspaceExecutionStore, ToolPublicationStore publications, ToolPublicationDataStore publicationData, @@ -121,7 +120,7 @@ public class EmbeddedRuntimeBroker implements RuntimeWarmer, AutoCloseable { workspaceExecutionStore, publications, publicationData, jdbc, manager, null, null); } - public EmbeddedRuntimeBroker(AgentStateStore store, ManagedAgentProperties properties, + public EmbeddedRuntimeBroker(SessionQueryStore store, ManagedAgentProperties properties, RuntimeBindingRepository bindingRepository, RuntimeSessionRepository sessionRepository, ToolExecutionRepository executionRepository, WorkspaceExecutionStore workspaceExecutionStore, ToolPublicationStore publications, ToolPublicationDataStore publicationData, @@ -131,7 +130,7 @@ public class EmbeddedRuntimeBroker implements RuntimeWarmer, AutoCloseable { workspaceExecutionStore, publications, publicationData, jdbc, manager, null, ssh); } - EmbeddedRuntimeBroker(AgentStateStore store, ManagedAgentProperties properties, + EmbeddedRuntimeBroker(SessionQueryStore store, ManagedAgentProperties properties, RuntimeBindingRepository bindingRepository, RuntimeSessionRepository sessionRepository, ToolExecutionRepository executionRepository, WorkspaceExecutionStore workspaceExecutionStore, ToolPublicationStore publications, ToolPublicationDataStore publicationData, @@ -142,14 +141,13 @@ public class EmbeddedRuntimeBroker implements RuntimeWarmer, AutoCloseable { workspaceExecutionStore, publications, publicationData, jdbc, manager, residentProvisioner, null); } - private EmbeddedRuntimeBroker(AgentStateStore store, ManagedAgentProperties properties, + private EmbeddedRuntimeBroker(SessionQueryStore store, ManagedAgentProperties properties, RuntimeBindingRepository bindingRepository, RuntimeSessionRepository sessionRepository, ToolExecutionRepository executionRepository, WorkspaceExecutionStore workspaceExecutionStore, ToolPublicationStore publications, ToolPublicationDataStore publicationData, org.springframework.jdbc.core.JdbcTemplate jdbc, org.springframework.transaction.PlatformTransactionManager manager, RuntimeProvisioner residentProvisioner, SshWorkspaceService ssh) { - this.store = store; this.ssh = ssh; ManagedAgentProperties.RuntimeBroker broker = properties.getRuntimeBroker();