Repository navigation
feat: support WMA, A2A agents, and OpenSandbox runners - #1469
Robert0622 wants to merge 3 commits into
Conversation
crispinhu27
left a comment
There was a problem hiding this comment.
初审 c0d3e7c5:BLOCKED(运行时验证未完成)
审查版本:head c0d3e7c5(base main be6918d7)。上游 34f1c341 新增 WMA/A2A/OpenSandbox 三条执行路径(44 文件 +2937/−37),c0d3e7c5 在此基础上将 OpenSandbox POST 超时从 20s 增到 2 分钟(Docker 拉镜像场景),新增 TestCreateAllowsColdImageStartup 覆盖,并简化 TestExternalA2ASOP 改用 Artifact 断言。
审查范围
- 核心协议层:
internal/managedagent/(a2a.go、wma.go、acp.go、tencent.go,含测试) - 执行引擎层:
internal/engine/managed_agent.go、opensandbox.go、opensandbox_test.go、node_execute.go、sop_executors.go、run_start.go - Runner 层:
internal/runner/external_agent.go、external_agent_test.go、opensandbox_test.go - OpenSandbox 客户端:
internal/opensandbox/client.go、client_test.go - 配置入口:
cmd/agentflow/optional_execution.go、cmd/agentflow-runner/a2a_config.go - 前端:
web/app/agents.js、web/app/runners.js、web/index.html - 文档:
docs/architecture.md
静态分析结果
安全控制:
- A2A
NewA2A验证 endpoint scheme/hostname/User/Fragment/RawQuery;loopback 模式严格调用net.ParseIP + IsLoopback();non-loopback 只允许 HTTPS。 - WMA
NewWMA验证 HTTPS origin;API key 要求ck_或pt_前缀;TencentCloud 和 OpenAPI 两种模式互斥。 - Bootstrap token:
WorkspaceFromBootstrap验证前缀 + base64 格式 +safeID正则;ValidBootstrap使用hmac.Equal时序安全比对,signing key 至少 32 字节。 - OpenSandbox 配置:拒绝通配符
"*"、空 project ID 和重复绑定;binding()对 scope/workspace 做 SHA-256 截断存 Kubernetes label,满足 63 字符限制。
幂等与并发:
ManagedPromptAttemptfence 在 dispatch 前写库,重启后不会重发同一 attempt。provisionOpenSandbox先写ExecutionResourcePending再 POST,重启后只做 Find,幂等正确。- OpenSandbox Runner 注册路径:
OpenSandboxRegistrant在批准前验证 token 仍绑定存活 workspace,防止旧 token 重用。
sop_executors.go:seen 由 bool 改为 int(索引),多节点复用同一 managed executor 时取 AND 合并 Configured,逻辑正确。
ACP SSE 流:readEvents 用 bufio.Scanner + 1 MiB limit,空行分隔事件,prompt() cancel 时发 session/cancel cleanup,逻辑完整。
CI 结果
core全部步骤通过(含 Non-browser Go tests、Real-browser Go tests、Coverage gate、Browser-free UI tests),审查版本c0d3e7c5。- 其余 14 项 checks 全部
success,无失败项。
UNVERIFIED(阻塞 Approve 的原因)
本次审查未能在真实后端上执行以下端到端路径,缺少外部凭据:
- WMA ACP SSE 连接与
session/prompt完整对话(需要真实 WorkBuddy Managed Agent session)。 - A2A remote HTTPS 端点(
ExternalAgentRemote路径,需要真实 A2A 服务)。 - OpenSandbox Docker/Kubernetes 后端生命周期(provision → sandbox Running → Runner 注册 → release,需要真实 OpenSandbox 服务)。
上述验证需作者或部署方提供环境凭据后完成,TestOpenSandboxMixedSOP 和 TestExternalA2ASOP 的真实后端路径(LF_WMA_E2E_SESSION_ID、LF_OPENSANDBOX_E2E_URL)均已在测试中预留。
结论:无已确认阻塞缺陷;但必要运行时验证尚未完成,暂无法 Approve。待上述三条路径在真实环境完成端到端验证后可提交 Approve。
🤖 Generated with Claude Code
本轮 CR 结论:LGTM,可以合入head: 代码审查(45 个文件,+2979/−37)PR 新增三大集成能力,全部通过 opt-in 配置开关,不改动现有执行路径: 1. WorkBuddy Managed Agent(WMA)+ A2A 外部 Agent
2. OpenSandbox(Docker/Kubernetes 工作区)
3. 前端 + API 层
代码逻辑整体清晰,安全设计合理(opt-in、API key 头、签名、runner ID 命名空间隔离)。测试覆盖了所有新 HTTP 客户端、取消路径、A2A 端点策略和 OpenSandbox 后端绑定。 部署实测(本机 MariaDB +
|
…utcome - A WMA/A2A node interrupted mid-turn (control-plane restart) hit the dispatch fence on recovery, but shouldRetryFailedAttempt treated that error as retryable, so with maxAttempts>=2 attempt N+1 sent the same prompt again. The fence now returns errManagedTurnUnknown, which is never retried automatically. - The fenced attempt kept the "执行实例退出,等待恢复" activity, so an explicit retry continued the same attempt and hit the fence forever. The fence now clears that marker so a retry starts a new attempt. - A WMA/A2A turn that runs past the 5-minute budget reports "<provider> Agent 未在 5m0s 内完成本轮,已请求取消" instead of a bare "context deadline exceeded"; run cancellation keeps the plain error. - Document both behaviours in docs/architecture.md. Co-Authored-By: Claude Code <noreply@anthropic.com>
What changed
LOOP roles can invoke a published WorkBuddy Managed Agent session or an external A2A v0.3 Agent. A2A supports a service on a user's personal Runner and a project-scoped HTTPS service. Each managed turn publishes a text artifact through the existing LOOP handoff.
Deployments can assign a project workspace to an OpenSandbox Docker or Kubernetes backend. The run freezes its backend and uses a dedicated Runner for the shared workspace. The server signs Runner registration and releases the sandbox after completion. A create request can use the full startup budget for cold images.
Scope
Compatibility
The integrations use opt-in deployment bindings. For OpenSandbox, select a native LOOP profile and assign a backend to the project. The dedicated Runner executes within the assigned container. The new run and role fields are optional JSON fields. See Architecture for configuration.
Validation
hy4flashstreamed a response through the Tencent Cloud control plane and ACP. The public branch ran a mixed LOOP on OpenSandbox 1.2.0 on both Docker and Kind Kubernetes 1.32.2. Two downstream steps consumed the artifact and reused the workspace. Both backends released the sandbox.bash scripts/build-chatbot.shbuilt the app and passed 535 Chat tests.npm run coverageinwebtestpassed 387 tests with 85.95% line coverage. Public Playwright acceptance passed 28 tests and skipped 3 opt-in model tests.go vet ./...,python3 scripts/check-public.py, andbash scripts/scan-secrets.shpassed.TestRunnerStartsPanelBrowserInRunSandboxstartup error also reproduces on publicmainon this host.Safety
mainand contains only the execution integration.