[eval] uwf-eval run 执行阶段 thread not found — 0.3.0 兼容性问题 #134

Open
opened 2026-06-06 03:38:44 +00:00 by xiaonuo · 0 comments
Owner

环境

  • @united-workforce/eval: 0.1.3
  • @united-workforce/cli: 0.3.0
  • @united-workforce/agent-hermes: 0.1.3
  • Node: v22.22.3

复现

# 在 task 目录中运行
uwf-eval run . --count 1

报错

uwf thread exec failed: agent command failed (uwf-hermes): 
context: thread not found in threads.yaml: 06F9NZPPNT074FAV99RDFKM1G0

分析

uwf-eval 的 execute 阶段做了以下操作:

  1. mkdtemp 创建临时目录 /tmp/uwf-eval-xxx
  2. cp fixture/ → workDir 复制 workflow 文件
  3. uwf thread start debate.yaml -p "..." --cwd /tmp/uwf-eval-xxx成功创建 thread
  4. uwf thread exec <thread-id> --agent uwf-hermes -c 10失败:thread not found

关键代码(packages/eval/src/runner/execute.ts):

// 两个命令都用 workDir 作为 cwd
const startOut = runUwf(
  ["thread", "start", input.workflow, "-p", input.prompt, "--cwd", input.workDir],
  input.workDir,
);

runUwf(
  ["thread", "exec", threadId, "--agent", input.agent, "-c", String(input.maxSteps)],
  input.workDir,
);

疑似根因

uwf thread start--cwd /tmp/uwf-eval-xxx 下创建了 thread,thread 元数据可能被写入了工作目录下的 threads.yaml(而非全局 ~/.ocas/)。

uwf thread exec 调用的 uwf-hermes adapter 无法找到该 thread —— 可能是 hermes adapter 没有在正确的 cwd 下查找 threads.yaml,或者 0.3.0 的 thread 存储路径发生了变化。

验证:手动执行相同命令

# 手动复制 fixture
cp debate.yaml /tmp/test-eval/
cd /tmp/test-eval

# thread start 成功
uwf thread start debate.yaml -p "test" --cwd /tmp/test-eval
# → {"workflow":"2AXS6WFCNNTC2","thread":"06F9NZMR1T8H7ZVZQ67QCZ4098"}

# thread exec 也成功(手动 cd 到目录)
uwf thread exec 06F9NZMR1T8H7ZVZQ67QCZ4098 -c 1
# → 成功执行

手动执行正常,说明问题可能出在 execFileSync 的 cwd 传递或 hermes adapter 的启动上下文。

建议

  1. 确认 uwf thread start --cwd 是否正确写入 threads.yaml
  2. 确认 uwf thread exec 是否在 runUwf 的 cwd 下正确查找 thread
  3. 考虑 eval 是否需要额外的 UWF_HOME 环境变量来隔离存储
## 环境 - `@united-workforce/eval`: 0.1.3 - `@united-workforce/cli`: 0.3.0 - `@united-workforce/agent-hermes`: 0.1.3 - Node: v22.22.3 ## 复现 ```bash # 在 task 目录中运行 uwf-eval run . --count 1 ``` ## 报错 ``` uwf thread exec failed: agent command failed (uwf-hermes): context: thread not found in threads.yaml: 06F9NZPPNT074FAV99RDFKM1G0 ``` ## 分析 `uwf-eval` 的 execute 阶段做了以下操作: 1. `mkdtemp` 创建临时目录 `/tmp/uwf-eval-xxx` 2. `cp fixture/ → workDir` 复制 workflow 文件 3. `uwf thread start debate.yaml -p "..." --cwd /tmp/uwf-eval-xxx` → **成功创建 thread** 4. `uwf thread exec <thread-id> --agent uwf-hermes -c 10` → **失败:thread not found** 关键代码(`packages/eval/src/runner/execute.ts`): ```typescript // 两个命令都用 workDir 作为 cwd const startOut = runUwf( ["thread", "start", input.workflow, "-p", input.prompt, "--cwd", input.workDir], input.workDir, ); runUwf( ["thread", "exec", threadId, "--agent", input.agent, "-c", String(input.maxSteps)], input.workDir, ); ``` ## 疑似根因 `uwf thread start` 在 `--cwd /tmp/uwf-eval-xxx` 下创建了 thread,thread 元数据可能被写入了工作目录下的 `threads.yaml`(而非全局 `~/.ocas/`)。 但 `uwf thread exec` 调用的 `uwf-hermes` adapter 无法找到该 thread —— 可能是 hermes adapter 没有在正确的 cwd 下查找 `threads.yaml`,或者 0.3.0 的 thread 存储路径发生了变化。 ## 验证:手动执行相同命令 ```bash # 手动复制 fixture cp debate.yaml /tmp/test-eval/ cd /tmp/test-eval # thread start 成功 uwf thread start debate.yaml -p "test" --cwd /tmp/test-eval # → {"workflow":"2AXS6WFCNNTC2","thread":"06F9NZMR1T8H7ZVZQ67QCZ4098"} # thread exec 也成功(手动 cd 到目录) uwf thread exec 06F9NZMR1T8H7ZVZQ67QCZ4098 -c 1 # → 成功执行 ``` 手动执行正常,说明问题可能出在 `execFileSync` 的 cwd 传递或 hermes adapter 的启动上下文。 ## 建议 1. 确认 `uwf thread start --cwd` 是否正确写入 `threads.yaml` 2. 确认 `uwf thread exec` 是否在 `runUwf` 的 cwd 下正确查找 thread 3. 考虑 eval 是否需要额外的 `UWF_HOME` 环境变量来隔离存储
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/united-workforce#134