Feat/queen convergence #23

Merged
xiaohei merged 12 commits from feat/queen-convergence into main 2026-06-21 17:47:44 +00:00
12 Commits
Author SHA1 Message Date
gongzhiyongandClaude Opus 4.8 770adcd8d7 fix(agent): 分解提示词改为蜂群模式 — 按文件归属的代码改动,非过程步骤
CI / guardrails (push) Successful in 8s
CI / tests (push) Successful in 1m1s
CI / guardrails (pull_request) Successful in 13s
CI / tests (pull_request) Successful in 41s
根因:旧提示词"task planning assistant + actionable subtasks + estimated_time"诱导
模型产出人类项目计划式步骤(探索/跑测试/移动文件/复审),而执行端只能"输出完整文件
内容"→ 这些步骤必然失败 → 0 patch。

新提示词按去中心化蜂群运作约束重写:仓库已在本地 base_commit、agent 唯一产物=完整
文件内容、子任务并行自选无共享 FS、产物按路径合并。要求:每个子任务=按文件归属的具体
代码改动(互斥,避免并行覆盖)、最小改动(可单文件就一个)、明确 FORBIDDEN 过程/元步骤。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 01:39:41 +08:00
gongzhiyongandClaude Opus 4.8 3c05fa9ee1 fix(launcher): agent pod imagePullPolicy=Always(同 tag 重建生效)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 01:09:30 +08:00
gongzhiyongandClaude Opus 4.8 b53e32be78 fix(agent): 约束 jina 工具用法,不关闭搜索
- jina 工具砍到 allowlist(默认 search_web,read_url),21→2;其余工具不暴露,
  减少 prompt 膨胀与误用(env JINA_TOOL_ALLOWLIST 可调)。
- prompt 加 workspace/tool 边界:本地 base_commit 代码是唯一真源,本地读改;
  web 搜索/read_url 仅用于外部知识(库文档/语言特性/报错查证),严禁取本仓源码
  (web 版本≠本地 base_commit,会污染 patch);read_url 不接受 file:// 本地路径。

搜索作为模型验证/补能手段保留,仅约束调用边界。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 01:01:36 +08:00
gongzhiyongandClaude Opus 4.8 fb1eeeebfa fix(swebench): 真实仓 patch 捕获 + agent 稳定性
#1 稳定性:HEARTBEAT_TIMEOUT 30→120(可配 AGENT_HEARTBEAT_TIMEOUT)——真实仓 clone/长
模型调用不再误杀 agent。
#2 正确性/忠实度:
- 透传 GIT_BASE_COMMIT;agent clone 改为浅 fetch+checkout 该 commit(在正确基线上读/改,
  且大仓也快);emit_patch 持久化 base_commit + _git_diff 对 SHA 走浅 fetch。
- agent 读文件预算可配并调大(AGENT_CTX_MAX_FILES=40/BYTES=40000),LLM 看到完整文件,
  避免全量重写截断 → diff 失真。launcher 透传这些 env 给 agent pod。

import + runtime-contract/result-aggregator/security-boundary 测试全绿。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 00:25:38 +08:00
gongzhiyongandClaude Opus 4.8 74f5ce2f97 feat(launcher): 弹性 agent 池 — 按需扩缩取代固定预起
agent_autoscale_loop(ENABLE_AGENT_AUTOSCALING):初始只起 AGENT_LAUNCH_MIN_POOL 个,
按每个 run 的 PENDING 任务积压超过空闲 agent 时 top-up,上限 MAX_POOL/per-user cap。
plan_launch_specs 加 count_override/id_start 支持非碰撞增补。trivial run 用少量 agent,
重 run 自动扩展。fail-soft,backend=none 时 no-op。

manifest:MIN/POOL 16→2 + ENABLE_AGENT_AUTOSCALING=1(初始小、按需长)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 22:08:55 +08:00
gongzhiyongandClaude Opus 4.8 98fb0d2bdb feat(sandbox): Daytona 云沙箱后端 — 代码执行移出 Pod(SANDBOX_BACKEND=daytona)
§8.1 提到的"专用 sandbox worker"路径:模型生成代码在 Daytona 隔离沙箱执行,不在
本 Pod 跑;只上传生成文件 + sandbox_runner.py,绝不传 env/secret。复用 _runner.py
保证 SandboxResult 一致。fail-soft:Daytona/传输出错回退 Pod 内 subprocess。
双门控(ENABLE_QUALITY_EVAL+HEICODE_SANDBOX_ISOLATED)不变,不削弱 fail-closed。

依赖:加 daytona==0.189.0;为满足其 otel floor 把 otel 1.24→1.42、instrumentation
0.45b0→0.63b1、pydantic 2.9.2→2.13.4(与 agent 对齐)。import + runtime-contract/
security-boundary/result-aggregator 测试在新依赖下验证全绿。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 21:14:07 +08:00
gongzhiyong 5c1ff0ef58 feat(agent): 任务执行加结构化日志(LLM推理/tool调用query与返回/产出)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 099f270cc2a092a4eae7e5d06d99c4d7e076465e)
2026-06-21 20:45:56 +08:00
gongzhiyong e263dae115 feat(agent): Jina 搜索改用标准 MCP SDK 接入
- agent/task_executor.py: Jina 搜索从手搓 httpx 改为官方 mcp SDK
  (streamablehttp_client + ClientSession);工具经 OpenAI function-calling 暴露给模型
- agent/requirements.txt: +mcp==1.28.0;pydantic 2.9.2->2.13.4(mcp 要求 >=2.11)
- orchestrator/agent_launcher.py: JINA_API_KEY 经 per-swarm Secret 透传给 agent pod
  (SENSITIVE_ENV_KEYS),不内联 PodSpec
- k8s/orchestrator-local.yaml: 本地部署清单(默认 in-pod 沙箱评估开关 + JINA_API_KEY)

沙箱保持默认 in-pod 方案,未引入 OpenSandbox。
影响范围: agent_swarm(agent/orchestrator) + Agent(新增 Jina MCP 工具)。
密钥经 k8s Secret 注入无明文。不影响 Manager 契约/计费/审计/发布链路。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit deb984ac38)
2026-06-21 20:45:56 +08:00
gongzhiyongandClaude Opus 4.8 167adfcb56 fix(deploy): heicode-test 上云修复 — ACR 名/Redis 明文/plan token/聚合阈值/git grant
- launcher 透传 AGENT_PLAN_MAX_TOKENS 给 agent pod(避网关 >32768 → 400 断 fan-out)
- manifest: ACR heicodeest→heicodetest、AGGREGATE_ACCEPTANCE_THRESHOLD=70、
  HEICODE_SECRET_swe_git_1 走 secretKeyRef(SWE-bench clone 凭据)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 20:45:56 +08:00
gongzhiyong 2e7da834c6 Set test orchestrator images to heicodeest ACR 2026-06-20 23:50:47 +08:00
gongzhiyongandClaude Opus 4.8 1288fd19d7 feat(swarm): 协作聚合收敛取代蜂后选优 + sandbox 用 pytest 验证
CI / tests (push) Failing after 15m3s
CI / guardrails (push) Failing after 15m3s
按 juejin 协作聚合模型重构收敛(取代 best-of-N 选优):
- 删蜂后选优(queen.py/test-queen.py)
- 新增聚合节点 result_aggregator.py:共享池收集→同文件 LLM/AST 整合→沙箱验证→单次落 main
- 质量驱动闭环:不达标打回迭代(AGGREGATE_ACCEPTANCE_THRESHOLD + MAX_REVIEW_CYCLES)
- agent 停 git 工作分支,产出走 task.result.files 共享池(AGENT_GIT_PUSH_ENABLED 默认 false)
- sandbox_runner 改用 pytest(原生支持 pytest 风格 class),修 stdlib runner 收集失败
- 文档同步重写为协作聚合模型

本地验证:产物仓单分支 main + 三函数完整 + pytest 12/12 pass_rate=100 一次达标。
影响:Swarm 收敛/聚合层;Manager/客户端契约不变(artifact字段/sequence/状态机;契约测试全过)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 22:03:00 +08:00
gongzhiyongandClaude Opus 4.8 28a6c618ab feat(benchmark): SC-10 P_rework 计入评审重开(#10)
CI / tests (push) Failing after 11m18s
CI / guardrails (push) Failing after 11m19s
修正 P_rework 已知低估:此前 ReworkCount 仅由 retry_count>0 派生,漏了 cross_review/queen
质量门的重开(reopen_task 不增 retry_count——是质量决策非失败)。
- cross_review + queen_quality_gate 重开时累计 run.metadata["rework_reopens"]
- run_collector:rework_count = retry 派生 + rework_reopens

测试 test-benchmark-collector/metrics 通过。影响:仅 benchmark 度量(P_rework 更准),不改运行路径。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 22:51:49 +08:00