fix(intelligent-eval): trigger worker/planner with isolated session
All checks were successful
CI / test (push) Successful in 4m0s
All checks were successful
CI / test (push) Successful in 4m0s
t480 排查:评估 cd636d71 一直'等待 OpenClaw 创建会话',scan loop 每 60s 触发 worker,但 worker 被触发后 0 次工具调用、直接幻觉输出'评估 pending_approval' (实际 executing),任务永不认领。 根因:openclaw agent --agent main 复用 main 持久 session,多次触发累积上下文 缓存(~12 万 token)后 LLM 不再执行 worker skill 的 API 步骤。 验证:独立 --session-id 触发 worker → 正常取任务、建会话、close。 修复:worker/planner 触发命令加 --session-id(每次唯一 agenteval-worker-*/planner-*), 避免 main session 污染;timeout 300→600(独立 session 首次加载 skill 更慢)。 测试:触发断言含 --session-id,901 passed
This commit is contained in:
parent
71d38ebef6
commit
5de46d514a
@ -2,6 +2,7 @@
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import time
|
||||
from contextlib import asynccontextmanager
|
||||
from pathlib import Path
|
||||
|
||||
@ -213,13 +214,18 @@ async def _trigger_intelligent_worker() -> bool:
|
||||
"agent",
|
||||
"--agent",
|
||||
"main",
|
||||
# 必须用独立 session:`--agent main` 复用 main 持久 session,多次触发
|
||||
# 累积上下文缓存(~12 万 token)后 LLM 不再执行 worker skill 的 API
|
||||
# 步骤,直接幻觉输出(如"评估 pending_approval")而不取任务建会话。
|
||||
"--session-id",
|
||||
f"agenteval-worker-{int(time.time())}",
|
||||
"-m",
|
||||
worker_msg,
|
||||
"--json",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=300,
|
||||
timeout=600,
|
||||
)
|
||||
_logger.info("Worker 触发完成 exit=%s", proc.returncode)
|
||||
if proc.returncode != 0:
|
||||
@ -264,13 +270,16 @@ async def _trigger_intelligent_planner() -> bool:
|
||||
"agent",
|
||||
"--agent",
|
||||
"main",
|
||||
# 同 worker:独立 session 避免 main 持久 session 上下文缓存污染
|
||||
"--session-id",
|
||||
f"agenteval-planner-{int(time.time())}",
|
||||
"-m",
|
||||
planner_msg,
|
||||
"--json",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=300,
|
||||
timeout=600,
|
||||
)
|
||||
_logger.info("Planner 触发完成 exit=%s", proc.returncode)
|
||||
if proc.returncode != 0:
|
||||
|
||||
@ -79,6 +79,9 @@ def test_trigger_worker_calls_docker_exec(monkeypatch):
|
||||
assert "docker" in joined and "openclaw" in joined
|
||||
assert "agenteval-intelligent-worker" in joined
|
||||
assert "--agent" in joined and "main" in joined
|
||||
# 独立 session:避免 main 持久 session 上下文缓存污染导致 worker 幻觉不执行
|
||||
assert "--session-id" in joined
|
||||
assert "agenteval-worker-" in joined
|
||||
|
||||
|
||||
def test_trigger_worker_msg_has_execute_semantics(monkeypatch):
|
||||
@ -154,6 +157,9 @@ def test_trigger_planner_calls_docker_exec(monkeypatch):
|
||||
joined = " ".join(calls[0])
|
||||
assert "docker" in joined and "openclaw" in joined
|
||||
assert "agenteval-intelligent-planner" in joined
|
||||
# 独立 session(同 worker 防上下文缓存污染)
|
||||
assert "--session-id" in joined
|
||||
assert "agenteval-planner-" in joined
|
||||
assert "立即完成当前任务" in joined
|
||||
assert "不要等待下一节拍" in joined
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user