Add the WorkflowDef-to-squad compiler with host intent steps (Q3 WP1) #99

Merged
weichen merged 1 commits from feature/q3-wfcompile into main 2026-10-08 02:38:39 +00:00
Owner

Why

Q3 WP1:core.WorkflowDef 编译为 squad 图执行(P4 上限与 DeniedTools 在编译入口强制),为 WP2 退役 legacy SpawnSubagent 压缩执行器铺路。

What

  • internal/wfcompile(新包):
    • 编译器:六类步骤映射(prompt→角色步 Brief;hitl/tool/artifact/card/script→宿主 intent 步 wf.;critic→wf.critic 评审步 + evaluator-optimizer Loop,预算=maxRetries+1);{{input}}/{{slots.}} 编译期渲染;{{steps.X.output}} 哨兵保护——人读字段编译为文件指引、机器字段还原 token 运行期解析
    • 宿主 IntentRunner + 合成目录:AskHITL/ExecuteTool/WriteArtifact/CreateCard/codeorch 脚本宿主(限额 50/1MB/600/1800s 同款)/judgeStep 移植(无法解析=不通过 fail-closed;评审预算耗尽=步骤失败)
    • RunCompiled 驱动:槽位 HITL 收齐 → 编译 → squad 引擎(compiledPlanner,动态工作流强制计划确认)→ 步进循环 → critic 终判 → legacy 同款 outcome 汇总
    • P4 语义:插件脚本免确认、模型脚本必须确认、runtime.workflowScripts 默认关、动态 ≤8 步禁 script、声明式 ≤20 步
  • 嵌套 deps/agent-squad pin 06934bc → 633e853(StepSpec.Brief,Squad #46)
  • legacy 执行器本 WP 不动(WP2 退役切换)

Evidence

  • wfcompile conformance:demo.brief 形状/P4 上限/demo.brief E2E(critic 失败→重试→通过、drops、工件取步骤引用、卡、免计划确认、黑板 out_length 进任务书)/critic 触顶 fail-closed/demo.script E2E(真 codeorch 宿主、免确认、四回调)/开关关失败/模型脚本双确认(SELF 本地)
  • backend 全套 go test ./... 绿(SELF);PR HEAD CI 权威(GATE)

Refs

  • Q3 计划:Dev 仓 modules/documents docs/proposals/2026-10-07-agent-stack-q2q3-plans.md WP1
  • Dev 任务卡:.task/feature-agent-stack-q3.md
## Why Q3 WP1:core.WorkflowDef 编译为 squad 图执行(P4 上限与 DeniedTools 在编译入口强制),为 WP2 退役 legacy SpawnSubagent 压缩执行器铺路。 ## What - **internal/wfcompile**(新包): - 编译器:六类步骤映射(prompt→角色步 Brief;hitl/tool/artifact/card/script→宿主 intent 步 wf.*;critic→wf.critic 评审步 + evaluator-optimizer Loop,预算=maxRetries+1);{{input}}/{{slots.*}} 编译期渲染;{{steps.X.output}} 哨兵保护——人读字段编译为文件指引、机器字段还原 token 运行期解析 - 宿主 IntentRunner + 合成目录:AskHITL/ExecuteTool/WriteArtifact/CreateCard/codeorch 脚本宿主(限额 50/1MB/600/1800s 同款)/judgeStep 移植(无法解析=不通过 fail-closed;评审预算耗尽=步骤失败) - RunCompiled 驱动:槽位 HITL 收齐 → 编译 → squad 引擎(compiledPlanner,动态工作流强制计划确认)→ 步进循环 → critic 终判 → legacy 同款 outcome 汇总 - P4 语义:插件脚本免确认、模型脚本必须确认、runtime.workflowScripts 默认关、动态 ≤8 步禁 script、声明式 ≤20 步 - 嵌套 deps/agent-squad pin 06934bc → 633e853(StepSpec.Brief,Squad #46) - legacy 执行器本 WP 不动(WP2 退役切换) ## Evidence - wfcompile conformance:demo.brief 形状/P4 上限/demo.brief E2E(critic 失败→重试→通过、drops、工件取步骤引用、卡、免计划确认、黑板 out_length 进任务书)/critic 触顶 fail-closed/demo.script E2E(真 codeorch 宿主、免确认、四回调)/开关关失败/模型脚本双确认(SELF 本地) - backend 全套 go test ./... 绿(SELF);PR HEAD CI 权威(GATE) ## Refs - Q3 计划:Dev 仓 modules/documents docs/proposals/2026-10-07-agent-stack-q2q3-plans.md WP1 - Dev 任务卡:.task/feature-agent-stack-q3.md
weichen added 1 commit 2026-10-08 02:36:40 +00:00
Add the WorkflowDef-to-squad compiler with host intent steps (Q3 WP1)
ci / vet-and-test (pull_request) Successful in 44s
017c96baa5
Why: Q3 WP1 requires core.WorkflowDef workflows to run as compiled squad
graphs (P4 limits and DeniedTools enforced at the compile entry) so the
legacy SpawnSubagent-compression executor can be retired in WP2.

Evidence: internal/wfcompile conformance (zero model, zero network; script
step runs the real codeorch host like the legacy tests): demo.brief shape
(hitl/prompt+critic/artifact/card mapping, evaluator-optimizer loop budget
= maxRetries+1, needs chain), P4 limits (dynamic >8 rejected, dynamic
script rejected, DeniedTools, critic >3, workflow retries >6), demo.brief
E2E (critic fail->retry->pass, drops record, artifact from step-ref file,
card, hitl sequence without plan confirmation for registered workflows,
BB out_length visible in the draft task brief), critic exhaustion fails
closed, demo.script E2E (plugin script exempt from confirmation, wf.tool/
ask/artifact/step callbacks), workflowScripts off fails, model script
double confirmation with reject paths. Full backend suite green (SELF);
CI authoritative (GATE).

Impact: new package internal/wfcompile (compiler + host IntentRunner +
RunCompiled driver); nested deps/agent-squad 06934bc -> 633e853 (StepSpec
.Brief). No existing backend behavior changes (legacy executor untouched
until WP2).

Refs: Q3 plan WP1 (2026-10-07-agent-stack-q2q3-plans.md); task card
.task/feature-agent-stack-q3.md
weichen merged commit a1aba1527a into main 2026-10-08 02:38:39 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Backend#99