feat(dag): tiered dag.jsonc defaults, pause-first replan protocol, domain playbooks - #130
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
《DAG 工作流 BUG/缺陷 复盘与修复》任务 1-3:取消/重规划时序空窗修复、独立 dag.jsonc 配置、可产品化编排领域拓展。
复盘结论(任务 1)
promptSvc.cancel → Runner.cancel → Fiber.interrupt → AbortController → streamText 断流,毫秒级生效,"无法真实取消"不成立。变更
1. pause-first 重规划协议(零运行时风险)
tool/workflow.ts:control 缺参错误改为含用法示例并提示 pause-first;replan 缺 fragment 错误提示先 pause;replan 撞 terminal 时附带补救指引(start 新工作流 / extend);pause 输出说明 running 节点处置方式(fragment restart/cancel)。orchestration-policy.md:新增 Replan Protocol (pause-first) 章节——收到取消/重规划意图 → 立即control(pause)(毫秒级、无需 fragment)→ 组装 fragment →control(replan)(paused 下有效)→control(resume)。workflow.md:control 参考与 Redirect 场景同步 pause-first。2. 独立 dag.jsonc 配置(2 级模型分层 + 思考深度)
src/dag/config.ts(DagConfig):加载优先级项目 .opencode/dag.jsonc|.json > 全局 <config dir>/dag.jsonc|.json;两者都不存在时在全局 opencode 配置同级目录生成带注释的默认dag.jsonc(懒加载,随调度轮次生效,遵循OPENCODE_CONFIG_DIR重定向)。advanced(高级智能)负责关键节点(required: true或 review 类 worker),standard(普通智能)负责普通干活节点;只配一档时作为统一默认。spawn.ts模型解析链:node.model → node_defaults.model → agent.model → dag.jsonc 分层 → parent.model(不破坏 agents 角色文件已 pin 的模型)。thinking_depth(low/medium/high/max)通过现成PromptInput.variant接缝下发,模型未定义该 variant 时自动 no-op。3. 编排领域拓展(产品化 playbook)
orchestration-domains.md并拼入WorkflowContent:max_node_replan_attempts/max_total_nodes熔断。验证
packages/core、packages/opencodetypecheck(tsgo --noEmit)通过。packages/opencodeDAG 测试 242/242 通过(含新增 dag-config 10 例)。packages/corecommand 测试 13/13 通过(含新增 pause-first 与 domains 断言)。