xiaohei and Claude Opus 4.8
435f720cfb
fix(agent): 注入目标文件完整原文 + 强令最小改动(修整文件重写噪声)
...
CI / guardrails (push) Successful in 5s
CI / guardrails (pull_request) Successful in 7s
CI / tests (push) Successful in 48s
CI / tests (pull_request) Successful in 41s
根因:agent 无本地读文件工具,只拿到 workspace 的截断采样,被要求"输出完整文件"
时只能凭残缺采样+自身知识重构整个文件 → 丢行/重排/改注释/版权头 → 巨噪声 diff,
要么 apply 不上,要么 apply 了破坏无关测试(SWE-bench Pro 两臂 0/10 的主因)。
修法:
- _load_exact_target_files():从子任务描述正则提取目标文件路径,注入其**完整未截断**
的磁盘原文(上限6文件/各120KB,超限留给采样)。
- 执行 prompt 新增 "EXACT CURRENT CONTENT" 段 + 强令:返回内容必须是该原文逐字节保留、
仅施加任务所需最小编辑,禁止 reformat/reorder/rename/clean-up 无关行。
- 强化原 full-file 输出说明。
目的:让 diff 只含必要行,救回 NodeBB 296/300、ansible 171/175 这类"差几个测试"的近失题。
契约测试全绿(runtime-contract/merge-smoke/workflow-e2e/contract-freeze)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 09:47:35 +00:00
xiaohei
85e6ea6dfb
Merge pull request 'fix: 关 qwen 思考模式(消除 reasoning 回退) + 修 bounce 死锁 (BUG-A/BUG-B)' ( #26 ) from fix/qwen-thinking-and-bounce-deadlock into main
...
CI / guardrails (push) Successful in 5s
CI / tests (push) Successful in 48s
Reviewed-on: #26
2026-06-22 05:55:05 +00:00
xiaohei and Claude Opus 4.8
cdb17a0d73
fix(agent+orchestrator): 关 qwen 思考模式出干净 JSON + 修 bounce 死锁
...
CI / guardrails (push) Successful in 6s
CI / tests (push) Successful in 45s
CI / guardrails (pull_request) Successful in 8s
CI / tests (pull_request) Successful in 43s
BUG-A: qwen3.7-max 默认思考模式,重 impl 子任务把预算花在 reasoning_content
上不出最终 content JSON → json.loads("") 失败。task_executor._complete 两处
chat.completions.create 注入 extra_body={"enable_thinking": False}(env
AGENT_ENABLE_THINKING=1 可opt-in)。对齐 Qwen 官方结构化输出用法。
BUG-B: bounce 仅重开含 impl 文件的任务;impl 失败(0文件)+test成功时
reopens=0 → run 永远 running 空转。加兜底:reopens==0 时重开 FAILED 任务
(受 MAX_REVIEW_CYCLES 约束);仍无可重开则 accept_no_rework 走正常收敛终结。
契约测试全绿(runtime-contract/merge-smoke/workflow-e2e/contract-freeze)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 05:44:00 +00:00
xiaohei
b0831645cf
Merge pull request 'Feat/queen convergence' ( #24 ) from feat/queen-convergence into main
...
CI / guardrails (push) Successful in 6s
CI / tests (push) Successful in 41s
Reviewed-on: #24
2026-06-21 20:00:36 +00:00
gongzhiyong and Claude Opus 4.8
c4c2116122
fix(agent): content 为空时回退 reasoning_content(修思考模型空响应)
...
CI / guardrails (push) Successful in 6s
CI / tests (push) Successful in 44s
CI / guardrails (pull_request) Successful in 5s
CI / tests (pull_request) Successful in 39s
qwen3.7-max 思考模型常返回空 message.content、答案在 reasoning_content。原代码只读
content → 拿到 "" → json.loads("") → "Expecting value: line 1 column 1 (char 0)" → 任务失败。
新增 _message_text():content → reasoning_content(attr 或 OpenAI SDK model_extra)回退,
_complete 两个返回点都用它。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-22 03:39:06 +08:00
gongzhiyong and Claude Opus 4.8
c5595cf344
fix(agent): 执行 max_tokens 4000→65535 + 明确全仓已本地 clone(修两个执行 bug)
...
CI / guardrails (push) Successful in 4s
CI / tests (push) Successful in 41s
#1 全量重写文件的 files JSON 远超 4000 token → JSON 中途截断("Unterminated string")
→ 任务失败。提到 qwen3.7-max 输出上限 65535,env AGENT_EXEC_MAX_TOKENS 可调。
#2 prompt 明确:完整仓库已 clone 在 {workspace_dir}(base_commit),上面列出的文件只是
片段,绝不能因没列出就当文件/目录缺失(之前 LLM 误判 qutebrowser/utils 不存在 → 联网)。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-22 03:19:19 +08:00
xiaohei
5cd266ae17
Merge pull request 'Feat/queen convergence' ( #23 ) from feat/queen-convergence into main
...
CI / guardrails (push) Successful in 7s
CI / tests (push) Successful in 46s
Reviewed-on: #23
2026-06-21 17:47:43 +00:00
gongzhiyong and Claude 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
gongzhiyong and Claude 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
gongzhiyong and Claude 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
gongzhiyong and Claude 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
gongzhiyong and Claude 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
gongzhiyong and Claude 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
gongzhiyong and Claude 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
gongzhiyong and Claude 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
gongzhiyong and Claude 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
xiaohei
fadca8f4fc
Merge pull request '蜂后收敛闭环 P0+M2-M4(防抢run/选最优/质量门打回/失败隔离)' ( #19 ) from feat/queen-convergence into main
...
CI / tests (push) Successful in 39s
CI / guardrails (push) Failing after 13m24s
Reviewed-on: #19
2026-06-19 13:57:12 +00:00
gongzhiyong and Claude Opus 4.8
2672a3d4b6
feat(orchestrator): SC-7 蜂后落 main — git push 最优产物( #16 )
...
CI / guardrails (pull_request) Successful in 11s
CI / tests (pull_request) Failing after 11m52s
CI / tests (push) Failing after 11m53s
CI / guardrails (push) Failing after 11m53s
让蜂后选最优后把产物合并到产物仓 main,run 交付一份连贯产物而非 N 个碎片分支:
- create 存 git grant 引用(repo_url + secret_ref,均非明文)到 run.metadata;凭据不存
- queen.promote_to_main:从 secret_ref 现取凭据 → clone base_branch → 写最优产物 → commit → push;
_auth_url 嵌入并 URL-encode 凭据(不入日志);best-effort 不破坏终态
- main.py 终态:winner → promote_to_main → deliverable.promoted_to_main{branch,commit_sha}
- Dockerfile.orchestrator 加 git CLI
- test-queen 扩展(auth_url 编码 + no_git_grant 分支),14 检查全过;全套契约通过
注:真实 git push e2e 需重建 orchestrator 镜像 + 部署 + gitea 产物仓验证(后续);
当前纯代码 + 单元测完成。凭据经 secret_ref 现取、不存 run、不入日志(组织规则#8)。
影响:仅 orchestrator 终态聚合;不涉及 Manager 契约/计费/发布链路。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-19 21:38:43 +08:00
gongzhiyong and Claude Opus 4.8
0c3af0425d
docs: 蜂后收敛闭环(SC-3/4) — convergence-protocol §7 + rework-plan P-后续
...
CI / tests (push) Successful in 39s
CI / guardrails (push) Failing after 10m54s
CI / tests (pull_request) Failing after 14m26s
CI / guardrails (pull_request) Failing after 14m26s
记录已实现的蜂后闭环(M2-M4+P0)现状与诚实差距,标注剩余(SC-7 落main/SC-8 authoritative/M5 北极星)。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-19 19:40:41 +08:00
gongzhiyong and Claude Opus 4.8
7314662f97
feat(orchestrator): M4 失败隔离 + P-guard 确认(SC-11/12)
...
SC-12 失败隔离:单 task 失败不再拖垮整个 run。
- refresh_swarm_run_status:next_status 仅在"有失败且无任何完成产物"时 failed;
有完成工作则走 completed,交蜂后/convergence 判定(失败仍由 termination_reason 反映)。
- 解决那次 LLM 网关 404 致单 task 失败 → 整 run FAILED 的单点问题。
SC-11 P-guard:guard.diagnose 已由 assess_swarm_health 在派发循环接入(探索确认,零改动);
检测无 Agent/无模型/依赖死锁/预算耗尽/种子不可分解。
全套测试通过:runtime-contract / merge-smoke / workflow-e2e / contract-freeze
+ task-competition / queen / run-isolation。
影响:仅 orchestrator 终态判定;Manager status 映射不变(failed/completed)。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-19 19:25:43 +08:00
gongzhiyong and Claude Opus 4.8
50bc8b019f
feat(orchestrator): M3 蜂后质量门打回 — 质量驱动迭代(SC-9)
...
把收敛从"任务完成即停"升级为"质量驱动":
- queen.should_bounce(纯函数):最优候选已评分且 < 阈值且未触顶 → 打回;无阈值/未评分/达标/触顶 → 接受(诚实,不在算不出的分上打回,组织规则#9)
- queen_quality_gate(接入 refresh_swarm_run_status,在 cross_review 之后/状态提交之前):
评分不达标 → reopen_task 回灌 impl 任务 + review_cycles++ → run 保持 RUNNING 迭代;
达标/触顶 → 继续终态,winner 标到 deliverable
- _queen_threshold:QUEEN_ACCEPTANCE_THRESHOLD(env / run.metadata),默认 None=禁用,
保持现有完成语义不变(可由 operator 启用)
- 717 复用门已聚合的 run.metadata[queen],不重复聚合
测试 scripts/test-queen.py 扩展 should_bounce(5 检查),共 11 检查全过。
注:SC-8 convergence 全 authoritative(BLOCKED→override run.status)动 Manager 终态语义,
需契约评审,列为后续;质量驱动收敛的核心已由 queen_quality_gate 实现。
SC-10 P_rework 计入评审重开属度量层(E),后续。
影响:仅 orchestrator 终态/重开路径;门默认禁用,不改 Manager 契约/完成语义。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-19 19:16:42 +08:00
gongzhiyong and Claude Opus 4.8
c2413b5edd
feat(orchestrator): M2 蜂后结果聚合 — best-of-N 选最优(SC-5/6/7)
...
新增 orchestrator/queen.py(蜂后:不执行/不分配,只仲裁最终结果):
- collect_candidates:各 completed task 的 impl 产物为候选(复用 quality.collect_generated_files)
- score_candidates:用 swarm 共享 test 跑各候选 impl 评分(复用 sandbox.run_tests;
fail-closed:未确认隔离则不评分,unscored!=0,组织规则#9)
- select_best:纯函数,测试通过率最高者胜(best-of-N — 单模型没有的涌现杠杆)
- aggregate_run:终态收集→评分→选最优,best-effort 不破坏终态路径
接入 main.py completed 分支:winner 标到 deliverable.selected,verdict 存 run.metadata[queen]。
测试 scripts/test-queen.py(6 检查全过)。
注:SC-7 的 git push 最优到产物仓 main 待端到端阶段(需 orchestrator git CLI + 凭据持久化);
当前先标记 winner(SWE-bench 语境产物是 patch,选最优即够)。
影响:仅 orchestrator 终态聚合;不涉及 Manager 契约/计费/发布链路。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-19 19:00:15 +08:00
gongzhiyong and Claude Opus 4.8
c257e7e562
feat(orchestrator): P0 run 边界隔离 — 蜂后防跨 run 抢夺(agent_swarm#8)
...
run-boundary isolation:agent 只能竞争/认领属于自己 run 的 task,杜绝跨 run 抢夺
(A run 的 agent 抢 B run 的 task → 计费错账/结果污染)。
- 新增 extract_swarm_from_agent / _agent_belongs_to_run(复用 -agent- 前缀)
- swarm_dispatch:候选过滤为本 run 的 task
- handle_task_bid/yield/takeover:拒绝跨 run 请求(cross_run_denied)
- 测试 scripts/test-run-isolation.py(7 检查全过)
影响:仅 orchestrator 派发/竞争路径;不涉及 Manager 契约/计费字段/发布链路。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-19 18:42:39 +08:00
local
715e7c2fc8
docs: 新增 LOCAL_DEPLOY.md(换机构建+部署完整步骤,无密钥)
CI / tests (push) Successful in 46s
CI / guardrails (push) Failing after 12m41s
2026-06-17 13:32:55 +08:00
local
169e82ce02
docs(CLAUDE.md): 追加本地测试&交接段(部署/底座/密钥清单[无值]/状态/换机续接)
CI / tests (push) Failing after 14m36s
CI / guardrails (push) Failing after 14m37s
2026-06-17 13:06:01 +08:00
local
4d77b9263e
chore: 本地测试快照( #7 自底向上分解 + _parse_task 健壮化 + handoff 透传 + 本地部署清单)
...
CI / tests (push) Failing after 12m5s
CI / guardrails (push) Failing after 12m6s
仅供导出到 xiaohei/Agentswarm 的本地测试镜像快照,非主仓 PR。
2026-06-17 12:58:28 +08:00
Fasthei and Claude Opus 4.8
f9df550ac9
fix(agent/#75): 落地 agent 侧自底向上分解( #7 task_proposal)+ _parse_task 健壮化
...
修 #75:蜂群单任务铺不到多 agent。两层根因 + 对应修复(均经本地 k8s 端到端验证):
1) 真实 agent 执行器从未实现 #7「自主分解提案」(autonomous-task-generation.md §4 标为
「后续」;此前只有 stub_agent 演示)。编排器侧 handle_task_proposal 早已就绪,缺 agent 侧出口。
- agent/main.py: 新增 propose_task()(发 WS task_proposal,字段对齐 handle_task_proposal);
execute_task 传入 proposal_callback;control_messages 接受 task_proposal_ack。
- agent/task_executor.py: 新增 _maybe_propose_subtasks() —— 执行顶层种子时用 _parse_task 拆分,
把每个子任务经 proposal_callback 提案入池(由编排器 review→create_task→其他 agent 自选)。
仅顶层种子提案(parent 为空、source 非 agent_proposed/dynamic_handoff),子任务不再递归提案,无环。
env ENABLE_AUTONOMOUS_PROPOSALS(默认 on)可关。
2) _parse_task 又脆又静默退化为单任务(原 max_tokens=2000 截断 + 严格 json.loads + except 兜底):
- max_tokens 可配 AGENT_PLAN_MAX_TOKENS(默认 65536;注:qwen3.7-max 网关上限即 65536,>之 400);
- 新增 _coerce_subtasks 宽容解析(裸数组 / ``` 围栏 / {"subtasks":[...]} / 从文本抠 [...]);
- 解析失败重试 1 次再退化;成功打 INFO "Decomposed into N",退化打明确 WARNING(可观测)。
派发:提案子任务 required_capabilities 置空(像种子,任意空闲 agent 可自选)。否则 LLM 给的具体能力
不是固定能力池子集 → can_agent_run_task 永远拒 → 子任务卡 PENDING(本地实测到的死锁)。能力提示保留在
agent_role(不门控派发);能力感知路由(把子任务能力映射到能力池)作为后续增强,见 #75。
本地验证(Docker Desktop k8s,qwen3.7-max,池16):两次 run 复现「种子→拆 6/8 子任务→派给 6/8 个不同
agent 并行执行」,此前恒为单 agent。
测试(本地全过):test-runtime-contract / test-contract-freeze / test-merge-smoke / test-workflow-e2e /
test-autonomous-tasks / test-agent-launcher / test-convergence。
影响:仅 agent/(执行单元);不动 Manager↔Swarm 冻结契约 / 计费 / 审计 / 编排器接口。
Refs #75
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-17 02:14:18 +08:00
zsbgnw12 and GitHub
35109e5882
Merge pull request #74 from xmindlab-heicode/fix/swarm-73-empty-repo-worktree
...
fix(agent/git): 空仓自动播种基线提交,结果可 push 回仓 (#73 )
2026-06-16 22:37:26 +08:00
Fasthei and Claude Opus 4.8
c38b5fd80d
fix(agent/git): seed baseline commit for empty repos so results push back ( #73 )
...
Binding an empty repo (no commits) made `git clone` land an unborn HEAD with no
`origin/main`. `add_task_worktree` / `create_result_branch` then fell back to
base_ref=HEAD, and `git worktree add ... HEAD` failed with "invalid reference:
HEAD". The agent silently degraded to "executing on repo root without git push",
so the result branch never reached the remote.
Fix: after clone (and after refreshing an existing checkout), detect an empty
repo via `git rev-parse --verify HEAD` and plant one empty baseline commit on the
configured base branch. Worktree/branch creation and push then work normally and
the result branch is created on the (previously empty) remote.
Adds scripts/test-git-empty-repo.py covering the empty-repo path; existing
scripts/test-git-workflow.py still passes (no regression). Verified end-to-end
against a real empty GitHub repo: result branch pushed successfully.
Impact: Swarm agent git layer only (agent/git_operations.py). No change to
Manager<->Swarm contract, callbacks, billing, secret_ref, or audit.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-16 22:35:27 +08:00
Fasthei and GitHub
5cf3b88c09
Merge pull request #72 from xmindlab-heicode/fix/70-relanded
...
fix(swarm/#70): 超时透传+提默认 / 时间线降噪 / 失败reason准确(重新落到 main + 修 main 红测试)
2026-06-16 18:31:24 +08:00
Fasthei and Claude Opus 4.8
1edf73aba4
fix(swarm/#70): 任务超时透传+提默认 / 事件时间线降噪 / 失败 termination_reason 准确
...
真机端到端实测(#70 )暴露三问题,本 PR 全部修复(仅 agent + orchestrator,不跨仓):
问题1【阻断】单任务超时只有 60s,生成类任务必挂
- agent/main.py: TASK_TIMEOUT_SECONDS 默认 60→300(仅对外部/独立启动 agent 生效)。
- agent_launcher.py: 新增 DEFAULT_TASK_TIMEOUT_SECONDS=300、_budget_duration_seconds、
resolve_task_timeout(base=env 默认 300,与 run budget.duration_seconds 取较小);
plan_launch_specs 把 TASK_TIMEOUT_SECONDS 透传进每个 agent env(非敏感,inline,
k8s 不进 Secret)。
问题2【体验】事件时间线全是内部噪音(纯附加,未碰冻结契约)
- swarm_runtime.py: is_client_visible(=event_type∈FROZEN_CLIENT_EVENT_TYPES,单一真源);
emit_event 给 envelope 加 metadata.client_visible 布尔 + 关键客户端事件回填可选
payload.message(人话进度,仅取已有字段,不伪造)。task.heartbeat/retried/
deployment.status_changed/timeline/budget 标 client_visible=false,仍持久化+回调
但客户端据此过滤出时间线。冻结事件集/类型/sequence/artifact 形状一字未动。
- event-schema.md: 文档化两个附加字段 + 新增 §6.1,明确未解冻。
问题3【正确性】失败/超时 termination_reason 仍报 "tasks_completed"
- convergence.py: 新增 TIMEOUT/MAX_RETRIES_EXCEEDED/TASK_FAILED;classify_failure_reason
按 timeout→max_retries→task_failed 取最具体(仅凭真实 per-task 信号);FAILED 分支
再不会返回 tasks_completed(该 reason 仅用于成功),budget/rounds 仅在通用失败时才覆盖。
- task_queue.py: fail_task 永久失败时把 reason 落到 task.result({"success":false,"error":reason}),
不覆盖已有结果,供 convergence 读取。
- main.py: compute_convergence_report 快照补 retry_count/max_retries。
测试:新增 test_resolve_task_timeout、扩 test-convergence(failed_timeout/max_retries/
generic + "FAILED 永不报 tasks_completed"不变量)。本地全过:test-agent-launcher /
test-convergence / test-runtime-contract / test-contract-freeze / test-merge-smoke /
test-workflow-e2e / test-security-boundary。
影响:agent + orchestrator + 文档;不动 Manager↔Swarm 冻结契约字段(问题2 纯附加)。
栈在 #64(agent_swarm git 注入)之上,#64 合并后本 PR base 自动转 main。
Closes #70
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-16 18:29:39 +08:00
Fasthei and GitHub
bcb4abfdf5
Merge pull request #69 from xmindlab-heicode/fix/orphan-agent-lifecycle
...
fix(swarm): 孤儿 agent 终态回收 + 重试退避 + 任务错误上浮
2026-06-16 15:44:06 +08:00
zsbgnw12 and GitHub
bdddef2c23
Merge branch 'main' into fix/orphan-agent-lifecycle
2026-06-16 12:07:27 +08:00
gongzhiyong and Claude Opus 4.8
26a40c7770
fix(agent): failure reason leads with model's diagnosis, not the task prompt
...
之前聚合用 "<任务描述前80字>: <error>",失败 reason 被整段 prompt 污染,
真正的"看到什么/缺什么"被挤到后面。改为以模型 summary 为主、附上 distinct error,
reason 直接就是诊断本身(例:"No source files found...; only README/jsonl present.
(Required files like src/database/redis/main.js are missing.)")。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-16 05:23:04 +08:00
gongzhiyong and Claude Opus 4.8
62d6fdf78c
fix(agent): per-task git worktree so concurrent tasks each get an isolated repo copy
...
取代上一版 Option B(执行器共用仓库根 + 串行 1 任务)。每个任务从本 agent 自己的 clone
切出独立 git worktree(完整仓库内容 + 独立分支/索引),执行器在其中读写真实源码,
任务级 GitOperations 在该 worktree 提交/推送结果分支,完成后回收 worktree。
- 单 agent 可并发多任务(MAX_CONCURRENT_TASKS 恢复 4),互不共用 checkout/index
- worktree 置于仓外 /tmp/agent-worktrees(AGENT_WORKTREE_BASE 可配),主 checkout 不受污染
- _git_admin_lock 仅串行 worktree add/remove 等共享 .git plumbing,任务执行仍并行
- 跨 agent 隔离不变:每个 agent 仍各自 clone 一份(各自 pod)
- 根治 "Empty workspace: no files detected"(worktree 自带仓库文件,已端到端验证)
GitOperations 新增 add_task_worktree / remove_task_worktree。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-16 05:01:25 +08:00
gongzhiyong and Claude Opus 4.8
6152235c96
fix(agent): execute against cloned repo root, not empty per-task subdir
...
每个 SWE 任务都因 "Empty workspace: no files detected" 失败:仓库 clone 到 /workspace,
但 TaskExecutor 用的是空的 /workspace/.agent_tasks/<task_id> 子目录(从未播种仓库内容),
模型看不到任何源码 → 正确地拒绝执行。
Option B(架构裁定 2026-06-16):TaskExecutor.workspace_dir 改为仓库根 self.workspace_dir,
context.workspace_dir 同步。git(workspace_git 同根)即可 commit/push 真实改动。
MAX_CONCURRENT_TASKS 默认 1:单一 /workspace git checkout 非并发安全,蜂群并行靠多 agent。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-16 04:52:40 +08:00
gongzhiyong and Claude Opus 4.8
b394ce99d5
fix(swarm): reap orphan agents on terminal run + retry backoff + surface task errors
...
孤儿 agent 事故修复(2026-06-15 swarm-69e470561bd7-seed 跨 workspace 执行)。
不改去中心化认领逻辑(swarm_dispatch 不动),仅治理 agent pod 生命周期与可观测性:
- B1 终态回收: refresh_swarm_run_status 终态后 best-effort stop_launched 回收 pod+secret
(此前仅 Manager stop 才回收,自然完成/失败的 run agent 残留 → 孤儿留在共享池抢别的 swarm 任务)
- B2 防驱逐: agent pod 加 karpenter.sh/do-not-disrupt(AGENT_POD_ALLOW_DISRUPTION=1 可关)
- stop_launched: backend=kubernetes 时按标签删,不再被内存集合 _k8s_swarms 门控(跨重启可靠)
- C 重试退避: Task.next_retry_at + fail_task 指数退避 5→30→180s(cap 300, TASK_RETRY_BACKOFF_*),
is_task_ready 门控;TASK_MAX_RETRIES 可配
- D 错误上浮: task_executor 失败时聚合 subtask error 到顶层 error(根治通用 "Task failed"),
_execute_subtask 打印 LLM 响应片段
- 配额硬上限 16: _clamp_user_cap
契约测试全过: runtime-contract / merge-smoke / workflow-e2e / contract-freeze /
max-agents-per-user / security-boundary。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-16 04:33:01 +08:00
gongzhiyong and Claude Opus 4.8
f9f1d9a6d5
fix: 注入 GIT_REPO_URL,让 agent 克隆绑定仓库到 workspace(修复任务因空 workspace 必败)
...
根因(实测复现): agent 启动未注入 GIT_REPO_URL → 从不 clone → /workspace 为空 →
任何"读/改仓库代码"的任务被 LLM 以 "no source files to analyze or repair" 判 failed。
对照: 简单建文件任务在空 workspace 下仍 success,证明执行管线/模型/解析/落盘均正常。
公开库只需 GIT_REPO_URL(无凭据)。
- agent_launcher.git_launch_env(body): 从 resource_grants[].metadata.repo_url 提取仓库,
注入 GIT_REPO_URL(+GIT_PROVIDER/GIT_DEFAULT_BRANCH/GIT_BASE_BRANCH)。纯函数,无 I/O。
- plan_launch_specs(git_env=...): 合并进每个 agent 的 env。
- launch_swarm_agents: 解析并传入 git_env; 记 agent_launch.repo_bound 诊断字段。
- 私有库凭据(GIT_TOKEN 经 grant secret_ref + 入 k8s Secret)留作干净后续。
- tests: test-agent-launcher 新增 test_git_launch_env + plan_specs 的 git_env 合并断言。
Refs #66
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-16 01:41:06 +08:00
gongzhiyong and Claude Opus 4.8
4309eac2ce
fix( #66 ): 退役 _manager_provided_agents 逃生门 + pod 数[3,16]上下限 + 消费 metadata.max_agents_per_user
...
去中心化是唯一行为(对齐 runtime-contract §3.3): 所有蜂群统一播种单一目标任务 + Swarm 自己拉 agent 池;
orchestration_plan.agents 不再控制拉起/任务创建, 退化为无害元数据。修复"任务建了但无 agent 认领、永久 pending"。
- main.py: 删除 _manager_provided_agents 两处分支(任务创建改无条件播种、拉起永远执行) + 函数退役
- agent_launcher.py: launch_count clamp 到 [AGENT_LAUNCH_MIN_POOL=3, AGENT_LAUNCH_MAX_POOL=16]
- main.py: max_agents_per_user(body) 消费 metadata.max_agents_per_user(HM 下发; >0 优先, 否则 env)
- main.py: WS 注册兜底按 agent 所属 run 的 metadata cap 反查(fail-soft 回退 env), 与拉起口径一致
- docs/integration/runtime-contract.md §3.3: 同步架构师裁定口径(2026-06-15)
- tests: test-agent-launcher / test-max-agents-per-user / test-merge-smoke 同步断言
Refs #66
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-16 00:19:14 +08:00
zsbgnw12 and GitHub
02f940f219
Merge pull request #64 from xmindlab-heicode/fix/63-launcher-inject-git-grant
...
fix(launcher/#63): 拉起 agent 注入 git 绑定(GIT_REPO_URL + azkv 凭据)— 修 HM #92
2026-06-15 13:08:47 +08:00
Fasthei and Claude Opus 4.8
efa865cac4
fix(launcher/#63): 拉起 agent 注入 git 绑定(GIT_REPO_URL + azkv 凭据)— 修 HM #92
...
现象(HM #92):蜂群"需绑定 git 仓库才能使用",但 agent 实际拿不到仓库。
根因:HM 已在 swarm create 的 resource_grants 下发 git 绑定(resource_type=git +
metadata.repo_url + secret_ref=azkv://),但 swarm 拉起侧只把 grant 用于校验/脱敏/审批,
launcher 从不消费它 → 被拉起 agent 的 env 没有 GIT_REPO_URL/凭据 → 无法 clone。
(agent 侧 agent/main.py + agent/git_operations.py 早已读取这些 env,缺的纯是注入。)
修复(仅 launcher 注入,比照模型 key 的服务端解析路径):
- 新增 resolve_git_grant(body):从 resource_grants(含 per-agent)取首个 git grant,
repo_url(metadata) → GIT_REPO_URL(非密文 inline);secret_ref(azkv) 服务端解析 →
GIT_USERNAME/GIT_PASSWORD。复用 azkv 读取(workload identity;dev/CI 用
HEICODE_SECRET_<name>)。有 repo 无凭据仍注入 GIT_REPO_URL(公有仓可 clone;私有仓
报错,不伪造)。
- plan_launch_specs 增加 git_env 合并;create 路径解析并透传。
- k8s 后端:GIT_PASSWORD 与模型 key 同走 per-swarm Secret 的 secretKeyRef,绝不内联
PodSpec;GIT_REPO_URL/GIT_USERNAME 为非密文 inline。SENSITIVE_ENV_KEYS 统一管控。
- git KV secret 值约定 JSON {"git_username","git_password"}(接受 git_token/token 形式
+ 裸 token),待 HM #92 对齐。
git 凭据不入 create 请求体/回调/日志/argv(_reject_plaintext_secrets 已覆盖
resource_grants)。
文档:runtime-contract §3.3 env 表 + 约束、security-boundary §6 增 git 绑定解析口径。
测试:scripts/test-agent-launcher.py 增 resolve_git_grant/凭据提取/k8s git secret 用例。
影响:仅 agent_swarm(Swarm/Agent + 密钥/secret_ref + 文档);不改 Manager/客户端/release/
契约状态机/计费/审计字段。HM 侧 binding_id(B 路径)解析另在 HM #92 处理,与本 PR 无关。
验收:
python scripts/test-runtime-contract.py
python scripts/test-contract-freeze.py
REDIS_FAKE=1 python scripts/test-key-injection-contract.py
python scripts/test-security-boundary.py
python scripts/test-agent-launcher.py
python scripts/test-git-workflow.py
python scripts/test-merge-smoke.py
python scripts/test-workflow-e2e.py
(全部通过)
Refs HM #92 , Closes #63
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-15 12:17:51 +08:00
Fasthei and GitHub
719fe80b98
Merge pull request #61 from xmindlab-heicode/fix/56-k8s-deploy-artifacts
...
docs+feat(benchmark): 环境变量清单 & 默认启用 Cosmos+Blob 导出
2026-06-15 00:29:19 +08:00
gongzhiyong and Claude Sonnet 4.6
ffe9277050
feat(benchmark): 默认启用 Cosmos + Blob 导出
...
BENCHMARK_EXPORT_TARGET 默认值从 none 改为 cosmos,blob,
每次真实 run 终态自动落库。凭据未配置时降级 noop + warning,不影响主路径。
同步更新 ENV_VARS.md 默认值说明。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-06-15 00:20:26 +08:00
Fasthei and GitHub
9beecf982b
Merge pull request #60 from xmindlab-heicode/fix/56-k8s-deploy-artifacts
...
docs: 新增全量环境变量清单 ENV_VARS.md
2026-06-15 00:14:22 +08:00
gongzhiyong and Claude Sonnet 4.6
521a227e58
docs: 新增全量环境变量清单 ENV_VARS.md
...
整理 agent/、orchestrator/、benchmark/、scripts/、k8s/ 下所有环境变量,
共 65+ 项,含安全敏感标注、解析优先级链和三套最小可运行配置示例。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-06-15 00:13:20 +08:00
zsbgnw12 and GitHub
d6f7f5ea6a
Merge pull request #59 from xmindlab-heicode/fix/56-k8s-deploy-artifacts
...
fix(#56 ): 补齐 k8s 部署产物(kubectl / RBAC secrets / Deployment 拉起 env + workload-identity)
2026-06-14 20:17:42 +08:00
gongzhiyong and Claude Opus 4.8
aa4679f610
fix( #56 ): 补齐 k8s 部署产物 —— 编排器镜像装 kubectl、RBAC 加 secrets、Deployment 接拉起 env + workload-identity label
...
让 k8s 拉起链路在仓内"可部署即可用"(此前线上实测全缺):
- Dockerfile.orchestrator:装 `kubectl`(pin AKS 1.34;linux/amd64)。launcher 靠 shell
`kubectl apply/delete` 建/删 agent Pod + 每-swarm key Secret,镜像无 kubectl 则 k8s 后端必失败。
- k8s/rbac/orchestrator-role.yaml:加 `secrets`(create/delete/list/get)——否则建不了模型 key
Secret、agent keyless。并注明 Role 命名空间须与 AGENT_POD_NAMESPACE 一致。
- k8s/orchestrator-deployment.yaml:
- pod 模板加 `azure.workload.identity/use: "true"`(AKS webhook 注入 token,配合已注解的
SA + UAMI 读 heicode-vault)。
- 接入拉起 env:`AGENT_LAUNCH_BACKEND=kubernetes`、`AGENT_POD_IMAGE=heicode.azurecr.io/swarm-agent:latest`、
`AGENT_POD_NAMESPACE=swarm-system`(同 RBAC ns)、`ORCHESTRATOR_PUBLIC_URL=ws://orchestrator-service...:8000`、
`AGENT_OPENAI_API_BASE=https://code.heicode.cc/v1 `、`SECRET_RESOLVER=azkv`。
- image 指向 ACR(`heicode.azurecr.io/swarm-orchestrator`,tag 部署时 pin)。
校验:两个 manifest YAML 解析通过(label/env/secrets 均在);test-agent-launcher / test-swarm-guard /
test-contract-freeze 全绿。无明文密钥。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-14 19:39:10 +08:00