Selaa lähdekoodia

fix(agent): 阻止 Research67 失败后的自动补做

Research67 子任务失败后,父级模型仍可能继续调用工具或基于残留产物补写结果,破坏失败现场和用户决定权。本提交把原样转述并立即停止限定为该系列代理的执行边界。

- 为 research-67-* 代理注入任务返回后原样转述并停止的合成提示
- 明确禁止父级模型在失败后继续研究或调用其他工具
- 收紧 pipeline 门面失败回复,只报告事实并等待用户决定
- 保持其他代理的既有任务提示和执行行为不变
- 验证:packages/opencode 执行 bun typecheck 通过
Jinchen Zhang 1 viikko sitten
vanhempi
commit
dc28e55550

+ 1 - 0
.opencode/agent/research-67-pipeline.md

@@ -25,5 +25,6 @@ tools:
 - 立即原样返回真实错误、run_id、workspace_path 和已有产物信息。
 - 失败严禁重跑。不得再次调用 agentpaas_run,不得拆分任务,不得改调其他 subagent 自行补做。
 - 只能等待用户检查并给出明确的新指令;不得把“建议重试”解释为已获准重试。
+- 失败回复不得提出“基于已有产物继续完成报告”等补做建议,只能给出失败事实和等待用户决定的提示。
 
 > 注:Research67 Lite 当前使用 pipeline,不调用 orchestrator;agentpaas_run 会按 agent_name 动态解析当前 Agent ID。

+ 5 - 1
packages/opencode/src/session/prompt.ts

@@ -974,6 +974,9 @@ const layer = Layer.effect(
         if (part.type === "agent") {
           const perm = Permission.evaluate("task", part.name, ag.permission)
           const hint = perm.action === "deny" ? " . Invoked by user; guaranteed to exist." : ""
+          const relay = part.name.startsWith("research-67-")
+            ? " After the task tool returns, faithfully relay its result and stop. Do not call another tool or continue the research yourself, especially after a reported failure."
+            : ""
           return [
             { ...part, messageID: info.id, sessionID: input.sessionID },
             {
@@ -984,7 +987,8 @@ const layer = Layer.effect(
               text:
                 " Use the above message and context to generate a prompt and call the task tool with subagent: " +
                 part.name +
-                hint,
+                hint +
+                relay,
             },
           ]
         }