feat: §17 ToolchainHandler 强约束实现(Step 1-4)
Step 1: 基础设施 - prompt_composer.py: PromptContext 新增 action_type + action_steps 字段 - spawner.py: handler 路径提取 action_type/action_steps 传入 PromptContext - db.py: comments CHECK 约束加入 action_report Step 2: ToolchainHandler 强化 - ToolchainContextSection: 加 steps 渲染 + action_hint(按 action_type) - ToolchainApiSection: 改为 action_report 提交指引 + Gitea 协作指引 - ToolchainConstraintsSection: 5 条强约束 + Red Flags 防self-rationalization - verify_completion: action_report → output → comment 三层 fallback - review_merged 始终通过(纯通知) - infrastructure_failure 始终通过(防递归) - 修复 LENGTH(content) → LENGTH(body) bug - on_failure 三分路: 业务→Gitea PR comment / 系统→Gitea Issue / 基础设施→toolchain task Step 3: toolchain_routes 改造 - 新增 _toolchain_db_path() + _send_toolchain_task() - 所有 8 个 handler 改为 _send_toolchain_task - _send_mail 保留但不再被 toolchain handler 调用 - _send_deploy_failure_mail → _send_deploy_failure_task Step 4: 测试 - 29 个单元测试全部通过 - 全量 456 passed, 3 skipped, 0 failures
This commit is contained in:
@@ -286,10 +286,15 @@ class AgentSpawner:
|
||||
# 从 must_haves 解析 mail 元数据(from / performative)
|
||||
from_agent = ""
|
||||
mail_type = ""
|
||||
action_type = ""
|
||||
action_steps = []
|
||||
try:
|
||||
meta = json.loads(must_haves) if must_haves else {}
|
||||
from_agent = meta.get("from", "")
|
||||
mail_type = meta.get("performative", meta.get("type", ""))
|
||||
# toolchain 字段提取
|
||||
action_type = meta.get("action_type", "")
|
||||
action_steps = meta.get("steps", [])
|
||||
except Exception:
|
||||
pass
|
||||
ctx = PromptContext(
|
||||
@@ -298,6 +303,7 @@ class AgentSpawner:
|
||||
agent_id=agent_id, role=spawn_type,
|
||||
spawn_type=spawn_type,
|
||||
from_agent=from_agent, mail_type=mail_type,
|
||||
action_type=action_type, action_steps=action_steps,
|
||||
)
|
||||
return handler.build_prompt(ctx)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user