python-yama 0.10.2__tar.gz → 0.10.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. {python_yama-0.10.2 → python_yama-0.10.3}/PKG-INFO +22 -2
  2. {python_yama-0.10.2 → python_yama-0.10.3}/README.md +21 -1
  3. {python_yama-0.10.2 → python_yama-0.10.3}/README.zh-CN.md +21 -1
  4. {python_yama-0.10.2 → python_yama-0.10.3}/docs/agent-skill-test-framework-design.md +64 -21
  5. {python_yama-0.10.2 → python_yama-0.10.3}/docs/case-schema-reference.md +58 -22
  6. {python_yama-0.10.2 → python_yama-0.10.3}/skills/eval-plugin-with-yama/SKILL.md +17 -4
  7. {python_yama-0.10.2 → python_yama-0.10.3}/skills/eval-plugin-with-yama/references/case-schema.md +35 -8
  8. {python_yama-0.10.2 → python_yama-0.10.3}/skills/eval-plugin-with-yama/references/debugging.md +35 -9
  9. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_cli.py +25 -8
  10. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_framework.py +137 -2
  11. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_judge_llm.py +709 -28
  12. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_openai_llm.py +29 -4
  13. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_report.py +115 -0
  14. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_thread_case.py +13 -52
  15. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_workspace.py +144 -0
  16. {python_yama-0.10.2 → python_yama-0.10.3}/yama/cli.py +21 -2
  17. {python_yama-0.10.2 → python_yama-0.10.3}/yama/judge_llm.py +424 -68
  18. python_yama-0.10.3/yama/judge_routing.py +112 -0
  19. {python_yama-0.10.2 → python_yama-0.10.3}/yama/llm.py +4 -0
  20. {python_yama-0.10.2 → python_yama-0.10.3}/yama/models.py +3 -0
  21. {python_yama-0.10.2 → python_yama-0.10.3}/yama/openai_llm.py +28 -9
  22. {python_yama-0.10.2 → python_yama-0.10.3}/yama/report.py +129 -7
  23. {python_yama-0.10.2 → python_yama-0.10.3}/yama/runner.py +21 -7
  24. {python_yama-0.10.2 → python_yama-0.10.3}/yama/thread_case.py +1 -36
  25. {python_yama-0.10.2 → python_yama-0.10.3}/yama/workspace.py +51 -0
  26. python_yama-0.10.2/docs/superpowers/plans/2026-08-07-judge-model-resolution.md +0 -382
  27. python_yama-0.10.2/docs/superpowers/plans/2026-08-07-local-judge-default-model-retry.md +0 -348
  28. python_yama-0.10.2/docs/superpowers/plans/2026-08-07-openai-timeout-retry-reporting.md +0 -881
  29. python_yama-0.10.2/docs/superpowers/specs/2026-08-04-judge-model-object-design.md +0 -131
  30. python_yama-0.10.2/docs/superpowers/specs/2026-08-04-openai-adapter-safety-design.md +0 -108
  31. python_yama-0.10.2/docs/superpowers/specs/2026-08-07-judge-model-resolution-design.md +0 -143
  32. python_yama-0.10.2/docs/superpowers/specs/2026-08-07-local-judge-default-model-retry-design.md +0 -124
  33. python_yama-0.10.2/docs/superpowers/specs/2026-08-07-openai-timeout-retry-reporting-design.md +0 -260
  34. {python_yama-0.10.2 → python_yama-0.10.3}/.github/workflows/publish.yml +0 -0
  35. {python_yama-0.10.2 → python_yama-0.10.3}/.gitignore +0 -0
  36. {python_yama-0.10.2 → python_yama-0.10.3}/CLAUDE.md +0 -0
  37. {python_yama-0.10.2 → python_yama-0.10.3}/LICENSE +0 -0
  38. {python_yama-0.10.2 → python_yama-0.10.3}/docs/yama-intro.html +0 -0
  39. {python_yama-0.10.2 → python_yama-0.10.3}/pyproject.toml +0 -0
  40. {python_yama-0.10.2 → python_yama-0.10.3}/skills/eval-plugin-with-yama/references/install-upgrade.md +0 -0
  41. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_assertions.py +0 -0
  42. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_cli_shim.py +0 -0
  43. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_dashboard.py +0 -0
  44. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_llm.py +0 -0
  45. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_main_entrypoint.py +0 -0
  46. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_mocks.py +0 -0
  47. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_pr.py +0 -0
  48. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_preview.py +0 -0
  49. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_public_api.py +0 -0
  50. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_report_bundle.py +0 -0
  51. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_report_upload.py +0 -0
  52. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_run_plan.py +0 -0
  53. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_runner.py +0 -0
  54. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_skill_loader.py +0 -0
  55. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_skill_tool.py +0 -0
  56. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_tool_loader.py +0 -0
  57. {python_yama-0.10.2 → python_yama-0.10.3}/tests/test_usage.py +0 -0
  58. {python_yama-0.10.2 → python_yama-0.10.3}/uv.lock +0 -0
  59. {python_yama-0.10.2 → python_yama-0.10.3}/yama/__init__.py +0 -0
  60. {python_yama-0.10.2 → python_yama-0.10.3}/yama/__main__.py +0 -0
  61. {python_yama-0.10.2 → python_yama-0.10.3}/yama/assertions.py +0 -0
  62. {python_yama-0.10.2 → python_yama-0.10.3}/yama/dashboard.py +0 -0
  63. {python_yama-0.10.2 → python_yama-0.10.3}/yama/loaders/__init__.py +0 -0
  64. {python_yama-0.10.2 → python_yama-0.10.3}/yama/loaders/case.py +0 -0
  65. {python_yama-0.10.2 → python_yama-0.10.3}/yama/loaders/common.py +0 -0
  66. {python_yama-0.10.2 → python_yama-0.10.3}/yama/loaders/skill_loader.py +0 -0
  67. {python_yama-0.10.2 → python_yama-0.10.3}/yama/loaders/tool_loader.py +0 -0
  68. {python_yama-0.10.2 → python_yama-0.10.3}/yama/mocks.py +0 -0
  69. {python_yama-0.10.2 → python_yama-0.10.3}/yama/pr.py +0 -0
  70. {python_yama-0.10.2 → python_yama-0.10.3}/yama/preview.py +0 -0
  71. {python_yama-0.10.2 → python_yama-0.10.3}/yama/report_bundle.py +0 -0
  72. {python_yama-0.10.2 → python_yama-0.10.3}/yama/report_upload.py +0 -0
  73. {python_yama-0.10.2 → python_yama-0.10.3}/yama/tools/__init__.py +0 -0
  74. {python_yama-0.10.2 → python_yama-0.10.3}/yama/tools/base.py +0 -0
  75. {python_yama-0.10.2 → python_yama-0.10.3}/yama/tools/bash/__init__.py +0 -0
  76. {python_yama-0.10.2 → python_yama-0.10.3}/yama/tools/bash/_cli_shim.py +0 -0
  77. {python_yama-0.10.2 → python_yama-0.10.3}/yama/tools/bash/bash.py +0 -0
  78. {python_yama-0.10.2 → python_yama-0.10.3}/yama/tools/bash/fs.py +0 -0
  79. {python_yama-0.10.2 → python_yama-0.10.3}/yama/tools/skill/__init__.py +0 -0
  80. {python_yama-0.10.2 → python_yama-0.10.3}/yama/tools/skill/skill.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-yama
3
- Version: 0.10.2
3
+ Version: 0.10.3
4
4
  Summary: A reproducible evaluation runner for tool-using Agent skills
5
5
  Project-URL: Repository, https://github.com/world-sim-dev/yama
6
6
  Project-URL: Issues, https://github.com/world-sim-dev/yama/issues
@@ -46,7 +46,27 @@ Instead of prefixing every command, you can put credentials in a `.env` file: on
46
46
 
47
47
  ### Judge routing
48
48
 
49
- Evaluated Agent calls always use the configured OpenAI-compatible API. In an ordinary non-CI run, an LLM Judge instead prefers a local agent selected from its resolved `judge.model.name`: OpenAI/GPT/o-family names use Codex, and Claude/Anthropic names use Claude Code; all other names use the API. Any local failure (including a missing command) emits one sanitized warning on stderr so `--json` stdout remains valid JSON and retries the API with the original, complete model object. CI and `pr-run` are API-only. Local agents receive the model name and a compatible `reasoning_effort`, but never temperature, credentials, or endpoint settings.
49
+ Evaluated Agent calls always use the configured OpenAI-compatible API. In an ordinary non-CI run, Judge routing recognizes OpenAI/GPT/o-family names as Codex, Claude/Anthropic names as Claude Code, and Grok/xAI names as Cursor. An exact per-agent map may translate an API model name to a local CLI model slug; without a mapping, a recognized family uses that Agent's default model. Other families become local-first only through an exact mapping. A local-first chain is always `primary Agent -> original Judge API -> end` and never enters the fallback Agent.
50
+
51
+ ```toml
52
+ [defaults.judge.local.models.codex]
53
+ "openai/gpt-5.4" = "gpt-5.4-high"
54
+
55
+ [defaults.judge.local.models.claude]
56
+ "anthropic/claude-opus-4.1" = "claude-opus-4-1"
57
+
58
+ [defaults.judge.local.models.cursor]
59
+ "x-ai/grok-4" = "grok-4-fast"
60
+ "kimi.k3" = "kimi-k3"
61
+
62
+ [defaults.judge.local.agent]
63
+ name = "claude" # "claude", "codex", or "cursor"
64
+ model = "claude-sonnet-4-5"
65
+ ```
66
+
67
+ An unmapped, unrecognized model is API-first. Only after its original API exhausts retryable failures may `[defaults.judge.local.agent]` run as the terminal fallback: configured local model, then the same Agent's default only when that model slug is explicitly rejected, then end. There is no fallback-model API call. The HTML report shows the complete Judge attempt chain, including mapped/default/fallback source, retries, failures, and the effective local model when the Agent reports it.
68
+
69
+ CI and `pr-run` are API-only. Local agents receive the mapped model slug when present and a compatible `reasoning_effort`, but never temperature, credentials, or endpoint settings. Cursor Judge passes `--trust` only for its per-attempt empty temporary workspace so non-interactive execution cannot stop at Workspace Trust; it still omits `--force`/`--yolo`, and Yama does not edit Cursor's global trust configuration. Evaluated Agent API attempts default to a 180-second transport timeout; Judge API attempts and local Judge processes default to 120 seconds. The whole-Step timeout remains independently configured by `execution.timeout_seconds_per_step` (default 300 seconds).
50
70
 
51
71
  ## Writing a Case
52
72
 
@@ -19,7 +19,27 @@ Instead of prefixing every command, you can put credentials in a `.env` file: on
19
19
 
20
20
  ### Judge routing
21
21
 
22
- Evaluated Agent calls always use the configured OpenAI-compatible API. In an ordinary non-CI run, an LLM Judge instead prefers a local agent selected from its resolved `judge.model.name`: OpenAI/GPT/o-family names use Codex, and Claude/Anthropic names use Claude Code; all other names use the API. Any local failure (including a missing command) emits one sanitized warning on stderr so `--json` stdout remains valid JSON and retries the API with the original, complete model object. CI and `pr-run` are API-only. Local agents receive the model name and a compatible `reasoning_effort`, but never temperature, credentials, or endpoint settings.
22
+ Evaluated Agent calls always use the configured OpenAI-compatible API. In an ordinary non-CI run, Judge routing recognizes OpenAI/GPT/o-family names as Codex, Claude/Anthropic names as Claude Code, and Grok/xAI names as Cursor. An exact per-agent map may translate an API model name to a local CLI model slug; without a mapping, a recognized family uses that Agent's default model. Other families become local-first only through an exact mapping. A local-first chain is always `primary Agent -> original Judge API -> end` and never enters the fallback Agent.
23
+
24
+ ```toml
25
+ [defaults.judge.local.models.codex]
26
+ "openai/gpt-5.4" = "gpt-5.4-high"
27
+
28
+ [defaults.judge.local.models.claude]
29
+ "anthropic/claude-opus-4.1" = "claude-opus-4-1"
30
+
31
+ [defaults.judge.local.models.cursor]
32
+ "x-ai/grok-4" = "grok-4-fast"
33
+ "kimi.k3" = "kimi-k3"
34
+
35
+ [defaults.judge.local.agent]
36
+ name = "claude" # "claude", "codex", or "cursor"
37
+ model = "claude-sonnet-4-5"
38
+ ```
39
+
40
+ An unmapped, unrecognized model is API-first. Only after its original API exhausts retryable failures may `[defaults.judge.local.agent]` run as the terminal fallback: configured local model, then the same Agent's default only when that model slug is explicitly rejected, then end. There is no fallback-model API call. The HTML report shows the complete Judge attempt chain, including mapped/default/fallback source, retries, failures, and the effective local model when the Agent reports it.
41
+
42
+ CI and `pr-run` are API-only. Local agents receive the mapped model slug when present and a compatible `reasoning_effort`, but never temperature, credentials, or endpoint settings. Cursor Judge passes `--trust` only for its per-attempt empty temporary workspace so non-interactive execution cannot stop at Workspace Trust; it still omits `--force`/`--yolo`, and Yama does not edit Cursor's global trust configuration. Evaluated Agent API attempts default to a 180-second transport timeout; Judge API attempts and local Judge processes default to 120 seconds. The whole-Step timeout remains independently configured by `execution.timeout_seconds_per_step` (default 300 seconds).
23
43
 
24
44
  ## Writing a Case
25
45
 
@@ -19,7 +19,27 @@ YAMA_LLM_API_KEY=... uv run --project yama yama --plugin dingding-simple
19
19
 
20
20
  ### Judge 路由
21
21
 
22
- 被评测 Agent 的调用始终使用配置好的 OpenAI-compatible API。普通非 CI 运行中,LLM Judge 会按解析后的 `judge.model.name` 优先选择本地 Agent:OpenAI/GPT/o 系列使用 Codex,Claude/Anthropic 系列使用 Claude Code,其他模型仍走 API。任何本地失败(包括找不到命令)都会在 stderr 输出一行脱敏警告,再携带原始、完整的 model 对象重试 API,因此 `--json` 的 stdout 始终保持合法 JSON。CI 和 `pr-run` 均只走 API。本地 Agent 只接收模型名和兼容的 `reasoning_effort`,不会接收 temperature、凭据或 endpoint 设置。
22
+ 被评测 Agent 的调用始终使用配置好的 OpenAI-compatible API。普通非 CI 运行中,Judge 路由把 OpenAI/GPT/o 系列交给 Codex、Claude/Anthropic 系列交给 Claude Code、Grok/xAI 系列交给 Cursor。每个 Agent 都可用精确映射把 API 模型名翻译成本地 CLI 模型 slug;已识别系列未配置映射时直接使用对应 Agent 的默认模型。其他系列只有精确映射命中后才会变为 local-first。local-first 链固定为“主 Agent → 原始 Judge API → 结束”,不会再进入 fallback Agent。
23
+
24
+ ```toml
25
+ [defaults.judge.local.models.codex]
26
+ "openai/gpt-5.4" = "gpt-5.4-high"
27
+
28
+ [defaults.judge.local.models.claude]
29
+ "anthropic/claude-opus-4.1" = "claude-opus-4-1"
30
+
31
+ [defaults.judge.local.models.cursor]
32
+ "x-ai/grok-4" = "grok-4-fast"
33
+ "kimi.k3" = "kimi-k3"
34
+
35
+ [defaults.judge.local.agent]
36
+ name = "claude" # 支持 "claude"、"codex" 或 "cursor"
37
+ model = "claude-sonnet-4-5"
38
+ ```
39
+
40
+ 未映射且未识别的模型走 API-first。只有原始 API 的可重试错误耗尽后,才会启用 `[defaults.judge.local.agent]` 作为终止型兜底:“配置的本地模型 → 仅在该 slug 被明确拒绝时使用同一 Agent 默认模型 → 结束”。不再调用 fallback-model API。HTML 报告会展示完整 Judge 尝试链,包括映射/默认/兜底来源、重试、失败原因,以及本地 Agent 能上报时的实际模型。
41
+
42
+ CI 和 `pr-run` 均只走 API。本地 Agent 只接收命中的本地模型 slug 和兼容的 `reasoning_effort`,不会接收 temperature、凭据或 endpoint 设置。Cursor Judge 只为当前单次调用的空临时 Workspace 传入 `--trust`,避免非交互执行停在 Workspace Trust;仍不使用 `--force`/`--yolo`,Yama 也不会修改 Cursor 的全局信任配置。被评测 Agent 的 API 单次请求默认超时为 180 秒;Judge API 单次请求和本地 Judge 进程默认超时均为 120 秒。整条 Step 的超时仍由 `execution.timeout_seconds_per_step` 独立控制,默认 300 秒。
23
43
 
24
44
  ## 编写一个 Case
25
45
 
@@ -349,6 +349,22 @@ timeout_seconds_per_step = 300
349
349
  max_tool_rounds_per_step = 10
350
350
  repeat = 1
351
351
 
352
+ # 可选:API 模型名到本地 Agent 模型 slug 的精确映射
353
+ [defaults.judge.local.models.codex]
354
+ "openai/gpt-5.4" = "gpt-5.4-high"
355
+
356
+ [defaults.judge.local.models.claude]
357
+ "anthropic/claude-opus-4.1" = "claude-opus-4-1"
358
+
359
+ [defaults.judge.local.models.cursor]
360
+ "x-ai/grok-4" = "grok-4-fast"
361
+ "kimi.k3" = "kimi-k3"
362
+
363
+ # 可选:仅用于 API-first Judge 重试耗尽后的终止型本地兜底
364
+ [defaults.judge.local.agent]
365
+ name = "claude" # "claude"、"codex" 或 "cursor"
366
+ model = "claude-sonnet-4-5"
367
+
352
368
  [plugins."dingding-simple"]
353
369
  path = "dingding-simple"
354
370
 
@@ -400,6 +416,12 @@ timeout_seconds_per_step = 60
400
416
  < Case 自己顶层的 model: / execution: 字段
401
417
  ```
402
418
 
419
+ `defaults.judge.local` 不参与 Case 的 `model`/`execution` 合并。`models` 是独立的精确、
420
+ 大小写敏感 API→本地模型映射;一个 API 名只能属于一个 Agent,内置系列不能跨 Agent
421
+ 映射。`agent` 是 API-first 重试耗尽后的可选终止型本地兜底;`name` 只能是 `claude`、
422
+ `codex` 或 `cursor`,`model` 必须是非空本地模型 slug。字段层级、冲突或取值不合法会在
423
+ 加载 `yama.toml` 时直接报 `ConfigurationError`。具体触发条件与调用顺序见 12.2 节。
424
+
403
425
  **不存在** CLI 对 `model`/`execution`/超时参数的覆盖层——CLI 能覆盖的运行期配置只有
404
426
  `--result-dir`(产物根目录)、`--concurrency`(Case 级并发上限)和
405
427
  `--run-concurrency`(命令级 run 总上限);后两者都是纯调度参数,不改变 Case 文件。
@@ -1188,7 +1210,7 @@ Runner 把例如 `__evals__/cases/image-led-mv.yaml` 的相对路径规范化为
1188
1210
  ```yaml
1189
1211
  model:
1190
1212
  name: grok.4.5
1191
- timeout: 60
1213
+ timeout: 180
1192
1214
  max_retries: 2
1193
1215
  ```
1194
1216
 
@@ -1197,15 +1219,16 @@ model:
1197
1219
  ```yaml
1198
1220
  model:
1199
1221
  name: grok.4.5 # 必填,原样传给 chat.completions.create(model=...)
1200
- timeout: 60 # 有效 SDK transport timeout(秒)
1222
+ timeout: 180 # 被测 Agent 的有效 SDK transport timeout(秒)
1201
1223
  ```
1202
1224
 
1203
1225
  `stream` 固定传 `False`,因为 runner 以一次完整 assistant message 驱动 Tool Loop,
1204
1226
  没有流式增量解析链路。`provider` 字段和 `YAMA_MODEL_PROVIDER` 不再参与默认真实调用;
1205
1227
  若仍直接实例化 legacy `LiteLLMClient`,它保留旧的 LiteLLM 路由行为,但 CLI 不再使用它。
1206
1228
  默认 OpenAI-compatible Client 由 Yama 管理 timeout 与 retry:`model.timeout` 是正数
1207
- (默认 60 秒,boolean 非法)的 SDK transport timeout;每个 Provider attempt 还由
1208
- `asyncio.wait_for(..., timeout=timeout + 10)` 施加绝对 deadline。`model.max_retries`
1229
+ (被测 Agent 默认 180 秒、Judge API 默认 120 秒,boolean 非法)的 SDK transport
1230
+ timeout;每个 Provider attempt 还由
1231
+ `asyncio.wait_for(..., timeout=timeout + 5)` 施加绝对 deadline。`model.max_retries`
1209
1232
  是初始 attempt 之后的非负整数重试数(默认 2,boolean 非法),由 Yama 消费并从
1210
1233
  `chat.completions.create` 参数中移除。Yama 创建的 `AsyncOpenAI` 始终使用
1211
1234
  `max_retries=0`,避免 SDK retry 与 Yama retry 叠加。
@@ -1239,7 +1262,7 @@ Yama 重试自己的 deadline `TimeoutError`、SDK timeout/connection error、HT
1239
1262
  "messages": [],
1240
1263
  "tools": [],
1241
1264
  "stream": false,
1242
- "timeout": 60.0
1265
+ "timeout": 180.0
1243
1266
  }
1244
1267
  },
1245
1268
  "resolved_provider": { "name": "openai-compatible", "model": "grok.4.5" },
@@ -1698,9 +1721,11 @@ execution:
1698
1721
  (`RunResult.status = "error"`,`RunResult.passed = False`,`RunResult.error`
1699
1722
  记录异常信息),run 直接终止,不会再跑后续 Step。这个 300 秒总预算覆盖该 Step 的
1700
1723
  全部 Provider attempts、retry delay、Tool 执行与后续 Tool Loop 请求,不会按 attempt
1701
- 或 Tool round 重置。在默认 60 秒 transport timeout 与两次 retry 下,单次一直不返回的
1702
- completion chain 最多为 `70 * 3 + 1 + 2 = 213` 秒,仍给同一个 Step 的其他工作留下
1703
- 87 秒;Judge 调用仍在这个 candidate-Step `wait_for` 之外。`LLMError`(Provider
1724
+ 或 Tool round 重置。被测 Agent 的默认 transport timeout 是 180 秒,每个 attempt 的
1725
+ 绝对 deadline 是 185 秒;若包含 retry 的完整 completion chain 超过 300 秒,整 Step
1726
+ deadline 会先
1727
+ 取消当前请求,而不是为所有 attempts 额外扩张总预算。Judge 调用仍在这个
1728
+ candidate-Step `wait_for` 之外。`LLMError`(Provider
1704
1729
  请求失败、接口异常、脚本回放耗尽等)同样归为 run/case 的 `error` 状态,而不是
1705
1730
  hard check/Judge 失败。
1706
1731
  这与下面 `max_tool_rounds_per_step` 超限的处理方式(仅本 Step 记为失败、run 继续
@@ -2598,14 +2623,28 @@ def check(
2598
2623
 
2599
2624
  Judge 只评价无法可靠写成确定性规则的质量维度。执行逻辑固定如下:
2600
2625
 
2601
- 调用路径与被测 Agent 相互独立:被测 Agent 始终走 API。普通非 CI 运行的 Judge
2602
- 本地优先——解析后的 OpenAI/GPT/o 系列名交给 Codex,Claude/Anthropic 系列名交给
2603
- Claude Code,未匹配模型直接走 API。若本地进程明确报告指定模型不存在或不可用,
2604
- Yama 会警告并省略 `--model`,使用该 Agent 配置的默认模型重试一次;其他本地错误或
2605
- 这次重试失败时,再用原始完整 model 对象回退 API。CI 和 `yama pr-run` 的 Judge 只走
2606
- API。本地 Agent 两次尝试只接收兼容的 `reasoning_effort`,不接收 `temperature`。
2607
- Agent 默认模型可能因机器或时间而变化,所以 `temperature: 0` 只对 API Judge 提供
2608
- 稳定作用,不能保证本地 Judge 可复现。
2626
+ 调用路径与被测 Agent 相互独立:被测 Agent 始终走 API。普通非 CI 运行的 Judge 按
2627
+ 解析后的模型分两条互斥路径:
2628
+
2629
+ 1. `judge.model.name` 可路由到本地 Agent 时,OpenAI/GPT/o 系列交给 Codex,
2630
+ Claude/Anthropic 系列交给 Claude Code,Grok/xAI 系列交给 Cursor。精确映射命中时把
2631
+ 映射值作为本地 `--model`;内置系列未映射时直接使用 Agent 默认模型。其他系列只有
2632
+ 精确映射命中后才成为 local-first。映射 slug 被明确拒绝时省略 `--model` 重试同一
2633
+ Agent 默认模型;其他本地错误或默认模型失败时,使用原始完整 Judge model 对象回退
2634
+ API。链固定为“主 Agent → 原始 API → 结束”,不进入 `defaults.judge.local.agent`。
2635
+ 2. `judge.model.name` 未命中内置系列或映射时,先用原始完整 Judge model 对象调用 API。
2636
+ 只有可重试错误在 `max_retries` 后仍失败,且 Workspace 显式配置了
2637
+ `defaults.judge.local.agent`,才继续尝试配置的本地 Agent 与模型。仅当该模型名被本地
2638
+ Agent 明确拒绝时,省略 `--model` 使用该 Agent 默认模型重试;本地执行、输出协议校验
2639
+ 或默认模型仍失败时直接结束,不再调用 fallback-model API。不可重试的原始 API 错误
2640
+ 直接抛出;未配置 `defaults.judge.local.agent` 时不启用这条链。
2641
+
2642
+ CI 和 `yama pr-run` 的 Judge 只走 API。本地 Agent 尝试只接收兼容的
2643
+ `reasoning_effort`,不接收 `temperature`。Agent 默认模型可能因机器或时间而变化,所以
2644
+ `temperature: 0` 只对 API Judge 提供稳定作用,不能保证本地 Judge 可复现。被测 Agent
2645
+ 的 API 单次 attempt 默认 transport timeout 为 180 秒;Judge API 单次 attempt 与本地
2646
+ Judge 进程默认 timeout 均为 120 秒;`execution.timeout_seconds_per_step` 仍是独立的整
2647
+ Step deadline,默认 300 秒。
2609
2648
 
2610
2649
  本地 Codex/Claude 适配器不会直接发送 API 使用的 tuple Judge Schema,而是深拷贝后
2611
2650
  转换为两者严格模式都接受的子集:`dimensions` 使用对象型 `items`,`name` 使用字符串
@@ -2615,6 +2654,11 @@ Agent 默认模型可能因机器或时间而变化,所以 `temperature: 0`
2615
2654
  `sqlite_home` 覆盖隔离 SQLite 运行状态;`CODEX_HOME`、认证和默认模型选择不变,临时
2616
2655
  目录在调用结束后删除。非零进程退出同时保留带标签的 stdout 与 stderr,再经过既有的
2617
2656
  单行、长度限制和敏感信息脱敏后打印,避免 stderr warning 隐藏 stdout 的真实错误。
2657
+ Cursor 适配器使用 `agent --trust -p --output-format stream-json`(兼容旧命令名
2658
+ `cursor-agent`);`--trust` 只跳过本次隔离空临时目录的 Workspace Trust 交互,不带
2659
+ `--force`/`--yolo`,也不修改 Cursor 全局信任配置。每个 local/API 逻辑尝试都会写入
2660
+ `StepResult.judge_execution`;HTML 按序显示模型来源、重试、失败和 Agent 上报的实际模型。
2661
+ Claude Code/Cursor 可从 init 事件显示默认实际模型;Codex 默认模型未上报时明确标注。
2618
2662
 
2619
2663
  在调用前,`_resolve_judge_model()` 按三条互斥分支选择模型:省略 `judge.model` 时,
2620
2664
  深拷贝完整的 Case `model`(包括每个已配置请求选项);字符串 `judge.model` 是独立的、
@@ -3113,11 +3157,10 @@ CAPTCHA 也不会误报。其他非 2xx、curl 非零退出、curl 不存在、
3113
3157
  - 当前 step id 来自 `dsl.workflow.steps`,优先第一条 `status == "in_progress"`,否则取
3114
3158
  第一条非 `completed`/`skipped`;若全部完成/跳过、没有 DSL、或步骤缺少 id,则不填充
3115
3159
  step。
3116
- - 最近一条非纯 `<system-reminder>...</system-reminder>` 的用户消息成为
3117
- `steps[0].user`,`context.messages` 截断到这条消息之前,避免运行 Case 时重复发送同一
3118
- 用户回合。
3119
- - 如果该用户消息下一条就是纯 `<system-reminder>` 用户消息,则写入
3120
- `steps[0].message_inject`,`position: after_user_message`。
3160
+ - request 中最后一条 `role == "user"` 的消息成为 `steps[0].user`,即使它是纯
3161
+ `<system-reminder>...</system-reminder>`;`context.messages` 截断到这条消息之前,
3162
+ 避免运行 Case 时重复发送同一用户回合。`from-thread` 不为这次切分自动生成
3163
+ `message_inject`。
3121
3164
  - 从该用户消息之后的 assistant tool calls 和选中 record 的 response message 中收集
3122
3165
  Tool 名,按首次出现顺序聚合调用次数,生成带 `times: <count>` 和 `tag: must_pass`
3123
3166
  的 `tool_called` hard checks。
@@ -62,14 +62,14 @@ Case 级模型配置,与 Tool Loop 中驱动被测 Agent 的模型完全对应
62
62
  | `reasoning_effort` | string | 否 | 无 | 透传给 endpoint 的推理强度选项。 |
63
63
  | `temperature` | number | 否 | `0` | 透传给 endpoint 的采样温度。 |
64
64
  | `base_url` / `api_base` | string | 否 | 私有默认 endpoint | 自定义 OpenAI-compatible Endpoint;两个字段同义,Case 配置优先于 `YAMA_LLM_BASE_URL`。 |
65
- | `timeout` | 正数(不能是 boolean) | 否 | `60` | 单次 Provider attempt 的 OpenAI SDK transport timeout(秒)。Yama 还会以 `timeout + 10` 秒包住该 await,作为绝对 deadline。 |
65
+ | `timeout` | 正数(不能是 boolean) | 否 | `180` | 被测 Agent 单次 Provider attempt 的 OpenAI SDK transport timeout(秒)。Yama 还会以 `timeout + 5` 秒包住该 await,作为绝对 deadline。Judge API 的默认值为 `120`。 |
66
66
  | `max_retries` | 非负整数(不能是 boolean) | 否 | `2` | 初始 attempt 之后允许的重试次数,由 Yama 消费;`0` 禁用重试,且该字段不会传给 Provider。 |
67
67
  | 其他模型选项 | 任意 JSON 值 | 否 | 无 | 除 `name`、endpoint/client 配置、`stream`、`timeout` 和 `max_retries` 外,非 `null` 选项透传给 `chat.completions.create`。 |
68
68
 
69
69
  ```yaml
70
70
  model:
71
71
  name: grok.4.5
72
- timeout: 60
72
+ timeout: 180
73
73
  max_retries: 2
74
74
  ```
75
75
 
@@ -87,31 +87,66 @@ timeout/connection error,以及 HTTP `408`、`409`、`429` 和所有 `5xx`;
87
87
  `LiteLLMClient` 的代码生效,不参与 CLI 默认真实调用。
88
88
 
89
89
  被评测 Agent 的 Tool Loop 无条件使用以上 OpenAI-compatible API;本地路由只属于
90
- `steps[].assert.judge` 的独立 Judge 调用。普通非 CI 的 Judge 使用解析后的
91
- `judge.model.name` 决定路由:`gpt-4.1`、`gpt.4.1`、`gpt_4.1` 等 `gpt`/`chatgpt`
92
- 变体以及 `o1`/`o3`/`o4` 及其 `-`/`.`/`_` 变体走 Codex;`claude` 及其
93
- `-`/`.`/`_` 变体走 Claude Code。`openai/<name>` 和 `anthropic/<name>` 也分别走
94
- Codex、Claude Code,并且**仅在本地 CLI 调用时**去掉该前缀;例如
95
- `openrouter/gpt-4.1` 不匹配,仍按 API 模型名原样调用。其他模型名同样直接走 API。
90
+ `steps[].assert.judge` 的独立 Judge 调用。API 的单次 attempt 默认 timeout 是 120 秒;
91
+ 本地 Judge 进程未显式设置 `model.timeout` 时也默认等待 120 秒。两者都不改变独立的整
92
+ Step deadline:`execution.timeout_seconds_per_step` 默认仍为 300 秒。
93
+
94
+ 普通非 CI 的 Judge 使用解析后的 `judge.model.name` 决定路由:OpenAI/GPT/o 系列走
95
+ Codex,Claude/Anthropic 系列走 Claude Code,Grok/xAI 系列走 Cursor。识别系列没有
96
+ 精确映射时直接使用对应 Agent 的默认模型(不传 `--model`),不会把 API 名机械去前缀后
97
+ 当作本地模型名。其他系列(例如 `kimi.k3`)只有命中下面的精确、大小写敏感映射时才走
98
+ 本地;`openrouter/gpt-4.1` 等未命中模型保持 API-first。
99
+
100
+ ```toml
101
+ [defaults.judge.local.models.codex]
102
+ "openai/gpt-5.4" = "gpt-5.4-high"
103
+
104
+ [defaults.judge.local.models.claude]
105
+ "anthropic/claude-opus-4.1" = "claude-opus-4-1"
106
+
107
+ [defaults.judge.local.models.cursor]
108
+ "x-ai/grok-4" = "grok-4-fast"
109
+ "kimi.k3" = "kimi-k3"
110
+ ```
111
+
112
+ 一个 API 模型名最多出现在一个 Agent map;内置系列也只能映射到其固定 Agent。未知
113
+ Agent、跨 Agent 重复、跨系列映射、空值和首尾空白都会在 Workspace 加载时报告配置错误。
96
114
 
97
115
  每次本地 Judge 均在新建的隔离目录中以无会话、只读的受限调用执行,并要求严格的结构化
98
116
  输出;Yama 会再次校验其 JSON 和每个 Judge 维度的协议。可选 usage 只有在本地 Agent
99
- 实际返回有效 token 计数时才写入,Yama 不会编造 usage。本地调用只传入解析后的模型名和
117
+ 实际返回有效 token 计数时才写入,Yama 不会编造 usage。本地调用只传入映射命中的模型 slug 和
100
118
  该 CLI 支持的 `reasoning_effort`;不会传入 `temperature`、凭据、`base_url`/`api_base`
101
- 或其他 endpoint 设置。若本地进程明确报告指定模型不存在或不可用,Yama 会写一条已脱敏
102
- 警告,并省略 `--model` 使用该 Agent 配置的默认模型重试一次;默认模型可能因机器或时间
103
- 不同而变化,因此这条兼容路径不保证模型级可复现性。其他本地错误,或默认模型重试失败,
104
- 都会再写一条对应警告,然后用**未改写的完整原始 model 对象**调用 API;因此 `--json`
105
- 的 stdout 仍为有效 JSON。两次本地尝试沿用相同的 timeout 和兼容
106
- `reasoning_effort`。
107
-
108
- Codex 与 Claude Code 只接收一份本地兼容的 Judge Schema 副本:数组使用对象型
119
+ 或其他 endpoint 设置。若映射模型被本地进程明确报告为不存在或不可用,Yama 会写一条
120
+ 已脱敏警告,并省略 `--model` 使用同一 Agent 的默认模型重试一次。识别系列本来就是默认
121
+ 模型起步,因此不会重复一次相同的默认尝试。其他本地错误或默认模型重试失败时,用**未
122
+ 改写的完整原始 model 对象**调用 API。该 local-first 链到此结束,不会进入 Workspace
123
+ fallback Agent。
124
+
125
+ 对于 `openrouter/gpt-4.1` 等不能路由到本地 Agent 的模型,原始 API 只有在可重试错误
126
+ 耗尽 `max_retries` 后,才可能启用以下可选 Workspace 兜底;不可重试错误会直接抛出:
127
+
128
+ ```toml
129
+ [defaults.judge.local.agent]
130
+ name = "claude" # 支持 "claude"、"codex" 或 "cursor"
131
+ model = "claude-sonnet-4-5"
132
+ ```
133
+
134
+ 配置存在时,Yama 先以指定 Agent 和模型执行本地 Judge;仅当模型名被明确拒绝时,省略
135
+ `--model` 使用该 Agent 默认模型重试。任一本地执行或协议校验失败都直接结束;不会再用
136
+ 配置模型名调用 API。整个配置表缺失时不会启用这条行为;`name` 不是 `claude`/`codex`/
137
+ `cursor`、`model` 为空或层级不是 TOML table 时,加载 Workspace 即报配置错误。
138
+
139
+ Codex 与 Claude Code 接收一份本地兼容的 Judge Schema 副本:数组使用对象型
109
140
  `items`,维度名使用字符串 `enum`;API 路径保持原有调用方式,不受这项本地转换影响。本地返回后,Yama
110
141
  继续按原始 Schema 校验维度数量、名称、顺序和字段,因此转换不会放宽最终评分协议。
111
142
  Codex 还会把 SQLite 运行状态写入本次隔离目录下的 `codex-state`,而不是
112
143
  `~/.codex/state_5.sqlite`;这不改变 `CODEX_HOME` 中的配置、认证或默认模型,目录在调用
113
144
  结束后删除。若本地进程失败,Yama 会同时保留 stdout 与 stderr 的已脱敏、有界摘要,
114
145
  避免 stderr 启动 warning 掩盖 stdout 中的真实结构化错误,然后按既有规则回退 API。
146
+ Cursor 使用无交互 `agent` 命令(兼容旧名 `cursor-agent`),只为本次隔离空临时目录传入
147
+ `--trust` 以跳过 Workspace Trust 交互,不带 `--force`/`--yolo`,也不修改 Cursor 全局
148
+ 信任配置。HTML 报告与序列化结果按顺序保留完整 Judge 尝试链;Claude Code/Cursor 会从
149
+ 初始化事件显示实际模型,Codex 默认模型未上报时明确显示“model not reported”。
115
150
 
116
151
  当以下任一 CI 标记的值不是 false-like 值时,本地 Judge 完全禁用:`CI`、
117
152
  `GITHUB_ACTIONS`、`GITLAB_CI`、`BUILDKITE`、`TF_BUILD`、`JENKINS_URL`。空字符串、
@@ -985,11 +1020,12 @@ judge:
985
1020
  其他选项。想完整复用 Case 模型时应省略 `judge.model`。违反这些约束会在调用 Judge LLM
986
1021
  前抛出 `AssertionConfigurationError`。
987
1022
 
988
- 上述本地优先规则仅适用于普通非 CI 的 Judge;它不改变 `judge.model` 的选择、同级
989
- `judge.temperature` 覆盖或 API 请求语义。特别是,`temperature` 仍是 API Judge 请求字段,
990
- 但本地 Codex/Claude Judge 不支持、也不会接收它;只有两者均兼容的
991
- `reasoning_effort` 会被转发。指定模型被本地 Agent 明确拒绝时,Yama 会省略
992
- `--model` 使用 Agent 默认模型重试一次;API 回退仍使用原始 Judge 模型配置。
1023
+ 上述本地优先与可选 Workspace 兜底规则仅适用于普通非 CI 的 Judge;它们不改变
1024
+ `judge.model` 的选择、同级 `judge.temperature` 覆盖或原始 API 请求语义。特别是,
1025
+ `temperature` 仍是 API Judge 请求字段,但本地 Agent 不接收它;兼容时才会转发
1026
+ `reasoning_effort`。Case Judge 模型本身可路由到本地 Agent 时,API 回退仍使用原始完整
1027
+ Judge 模型配置;API-first 路径启用 Workspace fallback Agent 后,本地失败即终止,不再
1028
+ 调用 fallback-model API。
993
1029
 
994
1030
  `dimensions` 每项:
995
1031
 
@@ -210,10 +210,9 @@ config/alias/版本路径和来源 record/commit 告诉用户。
210
210
  - `description` 写成当前 workflow step id + 原始 `--record-id`。
211
211
  - step id 来自 `dsl.workflow.steps`:优先 `status == "in_progress"`;否则取第一条非
212
212
  `completed`/`skipped`;全部结束则不填充 step。
213
- - `steps[0].user` 来自 request 里最近一条非纯 `<system-reminder>` 的用户消息;
214
- `context.messages` 会截断到这条 user 之前,避免重复发送同一轮用户输入。
215
- - 如果这条 user 下一条就是纯 `<system-reminder>...</system-reminder>` 用户消息,则放进
216
- `steps[0].message_inject`,`position: after_user_message`。
213
+ - `steps[0].user` 来自 request 里最后一条 `role == "user"` 的消息,即使它是纯
214
+ `<system-reminder>...</system-reminder>`;`context.messages` 会截断到这条 user 之前,
215
+ 避免重复发送同一轮用户输入。`from-thread` 不为这次切分自动生成 `message_inject`。
217
216
  - 从这条 user 之后的 assistant tool calls 和选中 record 的 response message 里收集
218
217
  Tool 名并统计调用次数,生成带 `times: <count>` 和 `tag: must_pass` 的 `tool_called`
219
218
  hard checks。
@@ -264,6 +263,20 @@ yama --preview --json # 向 stdout 打印逐 Case 的 JSON 预览
264
263
  yama dashboard # 默认 http://127.0.0.1:8765/
265
264
  ```
266
265
 
266
+ 普通非 CI 运行中,被测 Agent 始终走 API;Judge 的 GPT/o、Claude、Grok 系列分别本地
267
+ 优先使用 Codex、Claude Code、Cursor。内置系列未配置精确映射时直接使用对应 Agent 默认
268
+ 模型;其他模型(如 `kimi.k3`)只有命中 `[defaults.judge.local.models.<agent>]` 的精确
269
+ API→本地 slug 映射才会 local-first。该链固定为“主 Agent → 原始 Judge API → 结束”。
270
+ API-first 只有可重试错误耗尽且配置 `[defaults.judge.local.agent]`(`name` 支持
271
+ `claude`/`codex`/`cursor`)时才尝试 fallback Agent;本地模型被拒绝可再试 Agent 默认,
272
+ 任一本地失败后直接结束,不再调用 fallback-model API。CI/`pr-run` 始终 API-only,HTML
273
+ 会展示完整 Judge 尝试链和 Agent 能上报的实际模型。
274
+ Cursor Judge 只为每次隔离空临时目录传入 `--trust` 以跳过 Workspace Trust 交互,仍不
275
+ 使用 `--force`/`--yolo`,也不修改 Cursor 全局信任配置。
276
+ 被测 Agent 的 API 单次 attempt 默认超时为 180 秒;Judge API 单次 attempt 与本地
277
+ Judge 默认超时均为 120 秒,整 Step 默认超时仍为 300 秒。
278
+ 完整配置和边界见 [references/case-schema.md](references/case-schema.md)。
279
+
267
280
  多个 Case 默认并行执行(最多同时 10 个,`--concurrency N` 调整)。Case 内由
268
281
  `execution.repeat` 展开的 run 也默认并行:省略 `execution.repeat_concurrency` 时使用
269
282
  展开后的总 run 数,所有 Case 再共享 `--run-concurrency N`(默认 32)的全局上限;
@@ -44,6 +44,7 @@ model:
44
44
  name: grok.4.5 # 原样传给 chat.completions.create(model=...)
45
45
  reasoning_effort: medium
46
46
  temperature: 0
47
+ timeout: 180 # 可选;被测 Agent 单次 API attempt 默认 180 秒
47
48
  base_url: https://... # 可选,与 api_base 二选一;也可用 YAMA_LLM_BASE_URL
48
49
  ```
49
50
 
@@ -468,14 +469,40 @@ judge:
468
469
  model:
469
470
  reasoning_effort: high # invalid: explicit object model requires name
470
471
  ```
471
- - 被测 Agent 调用始终走 API。普通非 CI 运行的 Judge 会把解析后的 OpenAI/GPT/o
472
- 系列名交给 Codex、Claude/Anthropic 系列名交给 Claude Code;未匹配模型走 API。
473
- CI 和 `yama pr-run` 的 Judge 只走 API。
474
- - 普通运行中,若本地 Agent 明确报告指定模型不存在或不可用,Yama 会向 stderr 警告,
475
- 并省略 `--model` 使用 Agent 默认模型重试一次;该默认值可能因机器或时间而变化。
476
- 其他本地错误或默认模型重试失败时,Yama 仍以原始完整 model 对象回退 API。本地
477
- Agent 两次尝试只接收模型名(第二次省略)和兼容的 `reasoning_effort`,不透传
478
- `temperature`;因而 `temperature: 0` 的稳定作用仅限 API Judge。
472
+ - 被测 Agent 调用始终走 API。被测 Agent 的 API 单次 attempt 默认 timeout 为 180 秒;
473
+ Judge API 单次 attempt 与本地 Judge 进程默认 timeout 均为 120 秒;整 Step timeout 仍由
474
+ `execution.timeout_seconds_per_step` 独立控制,默认 300 秒。
475
+ - 普通非 CI 运行的 Judge 会把 OpenAI/GPT/o 系列交给 Codex、Claude/Anthropic 系列交给
476
+ Claude Code、Grok/xAI 系列交给 Cursor。内置系列未配置精确映射时直接用对应 Agent
477
+ 默认模型;其他模型只有命中 `[defaults.judge.local.models.<agent>]` 的大小写敏感精确
478
+ API→本地 slug 映射时才走本地。CI 和 `yama pr-run` 的 Judge 只走 API。
479
+ - 映射 slug 被本地 Agent 明确拒绝时,Yama 会向 stderr 警告并省略 `--model`,使用同一
480
+ Agent 默认模型重试一次;内置系列本来就从默认模型开始,不重复尝试。其他本地错误或
481
+ 默认模型失败时,以原始完整 model 对象回退 API。本地 Agent 不接收 `temperature`;
482
+ `temperature: 0` 的稳定作用仅限 API Judge。local-first 固定为“主 Agent → 原始 API →
483
+ 结束”,不会进入 Workspace fallback Agent。
484
+ - 对未命中内置系列或映射的 Case Judge 模型,只有原始 API 因可重试错误耗尽
485
+ `max_retries`,且 `yama.toml` 配置了下面的完整 table 时才启用额外兜底;未配置或
486
+ 原始 API 错误不可重试时不兜底:
487
+
488
+ ```toml
489
+ [defaults.judge.local.models.cursor]
490
+ "x-ai/grok-4" = "grok-4-fast"
491
+ "kimi.k3" = "kimi-k3"
492
+
493
+ [defaults.judge.local.agent]
494
+ name = "claude" # "claude"、"codex" 或 "cursor"
495
+ model = "claude-sonnet-4-5"
496
+ ```
497
+
498
+ 顺序是:配置的本地 Agent + 模型 → 仅在模型名被明确拒绝时省略 `--model` 使用同一
499
+ Agent 默认模型 → 结束。任一本地失败后不再调用 fallback-model API。`name` 非
500
+ `claude`/`codex`/`cursor`、映射冲突、`model` 为空或 table 层级错误会在 Workspace
501
+ 加载时直接报配置错误。
502
+ - HTML 报告会按顺序展示完整 Judge 尝试链、映射/默认/兜底来源、API retry 和脱敏失败;
503
+ Claude Code/Cursor 会显示 init 事件上报的实际模型,Codex 默认未上报时明确标注。
504
+ - Cursor Judge 只为当前隔离空临时目录传入 `--trust` 以跳过 Workspace Trust 交互;不带
505
+ `--force`/`--yolo`,也不修改 Cursor 全局信任配置。
479
506
  - `judge.model` 只接受非空字符串或对象;字符串必须非空,显式对象必须包含自己的
480
507
  非空字符串 `name`,否则会在 LLM 调用前报 `AssertionConfigurationError`。
481
508
  - 每维原始分 1..5,规范化 `(score-1)/4` 后按 weight 加权平均得 `overall`(0..1)。
@@ -108,7 +108,7 @@ CI 若开启 `yama pr-run --report --upload-report --commit-id <sha>`,上传
108
108
  | --- | --- | --- |
109
109
  | `tool has no mock handler: <name>` | 模型调用了未声明的 Tool,`error_kind=framework` | 若该调用合理:补 `context.tools` + `mocks.tools`;若不合理:这本身就是发现的缺陷,改 Prompt/Skill 或用 `tool_not_called` 显式断言并调整 Case 设计 |
110
110
  | `mock response sequence exhausted: <name>` | `respond.sequence` 条目数少于实际调用次数,`error_kind=framework` | 补足 sequence 条目,或换 `handler` 按 `context.state` 计数动态返回 |
111
- | `asyncio.TimeoutError` / 超时相关 | 单 Step 超过 `timeout_seconds_per_step`(默认 120s),`status=error`。注意:**超时终止整条 run**,与 max_tool_rounds 只失败当前 Step 不同 | 模型陷入长循环?先看 `requests/` 里最后几轮在干什么;确属正常慢则调大 `execution.timeout_seconds_per_step` |
111
+ | `asyncio.TimeoutError` / 超时相关 | 单 Step 超过 `timeout_seconds_per_step`(默认 300s),`status=error`。注意:**超时终止整条 run**,与 max_tool_rounds 只失败当前 Step 不同 | 模型陷入长循环?先看 `requests/` 里最后几轮在干什么;确属正常慢则调大 `execution.timeout_seconds_per_step` |
112
112
  | Handler 的 Python traceback(`MockImplementationError`) | Mock/Checker 自身抛了未预期异常,或返回值/state 不可 JSON 序列化,`error_kind=framework` | 修 Handler 代码;业务错误应改用 `raise ToolMockError(...)`,那才是模型可见的正常路径 |
113
113
  | `requests/request-00N.json` 带 `error` 字段 | LLM 请求失败(认证、路由、限流),`status=error` | 检查必需的 `YAMA_LLM_API_KEY`、`YAMA_LLM_BASE_URL` 或 Case 的 `model.base_url`,以及 `model.name` 是否是 endpoint 支持的模型名;默认 adapter 不读取 `OPENAI_API_KEY` |
114
114
 
@@ -186,9 +186,12 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
186
186
  级附加门槛。
187
187
  - 读 `reason`/`evidence` 判断是回复真的不好,还是 `criteria` 写得含糊让 Judge 理解
188
188
  偏了——criteria 应描述可观察的判分标准,而不是抽象形容词。
189
- - 被测 Agent 调用始终走 API。普通非 CI 运行的 Judge 才会本地优先:解析后的
190
- OpenAI/GPT/o 系列名交给 Codex,Claude/Anthropic 系列名交给 Claude Code,未匹配
191
- 的模型直接走 API;CI 和 `yama pr-run` 的 Judge 也只走 API。
189
+ - 被测 Agent 调用始终走 API。普通非 CI 运行的 Judge 才会本地优先:OpenAI/GPT/o
190
+ 系列交给 Codex,Claude/Anthropic 系列交给 Claude Code,Grok/xAI 系列交给 Cursor;
191
+ 内置系列无精确映射时直接用 Agent 默认模型,其他模型只有精确映射命中才走本地。CI
192
+ 和 `yama pr-run` 的 Judge 只走 API。被测 Agent 的 API 单次
193
+ attempt 默认 timeout 为 180 秒;Judge API 单次 attempt 与本地 Judge 进程默认均为
194
+ 120 秒,整 Step timeout 仍独立默认为 300 秒。
192
195
  - Judge 模型配置报错或与预期不同时,先确认所有权:省略 `judge.model` 才会深拷贝
193
196
  完整的 Case `model`(含全部请求选项);`judge.model: gpt-5` 是独立的仅含 `name`
194
197
  简写;显式对象必须自行提供非空字符串 `name`,且绝不继承 Case 模型的名称或其他
@@ -203,17 +206,40 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
203
206
 
204
207
  旧版同级 `judge.temperature` 会覆盖选中模型的 `temperature`;两处都省略时,Yama
205
208
  不会补充 temperature 值(does not synthesize a temperature value)。
206
- - 普通运行中,如果本地进程明确报告指定模型不存在或不可用,Yama 会先警告并省略
207
- `--model`,使用 Codex/Claude Code 配置的默认模型重试一次。默认模型可能因机器或
208
- 时间而变化;其他本地错误或这次重试失败时,Yama 用原始完整 model 对象回退 API。
209
+ - 普通运行中,精确映射的本地 slug 被明确报告为不存在或不可用时,Yama 会先警告并省略
210
+ `--model`,使用同一 Agent 默认模型重试一次。内置系列本来就从默认模型开始,不会重复
211
+ 一次相同尝试。默认模型可能因机器或时间而变化;其他本地错误或这次重试失败时,Yama
212
+ 用原始完整 model 对象回退 API。
209
213
  本地两次尝试只使用兼容的 `reasoning_effort`,不接收 `temperature`;因此 Judge
210
214
  波动大时仍应用 `execution.repeat` 观察 `pass_rate`,`temperature: 0` 只能稳定 API
211
- Judge,不能保证本地 Judge 可复现。
215
+ Judge,不能保证本地 Judge 可复现。Case Judge 模型已走这条本地优先路径时,不会再
216
+ 使用 Workspace 配置的额外兜底。
217
+ - 未命中内置系列或精确映射的 Case Judge 模型,只有原始 API 因可重试错误耗尽
218
+ `max_retries` 后才检查 `yama.toml` 的可选 `[defaults.judge.local.agent]`。未配置、
219
+ 原始错误不可重试或 CI/`pr-run` 环境都不兜底。配置示例:
220
+
221
+ ```toml
222
+ [defaults.judge.local.models.cursor]
223
+ "x-ai/grok-4" = "grok-4-fast"
224
+ "kimi.k3" = "kimi-k3"
225
+
226
+ [defaults.judge.local.agent]
227
+ name = "claude" # "claude"、"codex" 或 "cursor"
228
+ model = "claude-sonnet-4-5"
229
+ ```
230
+
231
+ 触发后依次使用配置的本地 Agent + 模型;仅在模型名被明确拒绝时省略 `--model` 使用
232
+ 同一 Agent 默认模型;本地仍失败就直接结束,不再调用 fallback-model API。若观察不到
233
+ 预期兜底,先检查错误是否确实可重试、重试是否已经耗尽、配置 table 是否存在,以及
234
+ `name`/`model` 是否有效。
212
235
  - 本地 Codex/Claude 会收到兼容其严格模式的 Judge Schema 副本,返回后仍由 Yama 按原始
213
236
  Schema 严格检查维度数量、名称和顺序。Codex 的 SQLite 状态放在本次 Judge 临时目录,
214
237
  不写 `~/.codex/state_5.sqlite`,也不改变 `CODEX_HOME` 中的认证与默认模型。若仍失败,
215
238
  警告会同时摘要 stdout 和 stderr;其中 `invalid_json_schema`、模型拒绝等真实错误通常在
216
- stdout,插件启动 warning 通常在 stderr。随后仍用原始完整 model 对象回退 API。
239
+ stdout,插件启动 warning 通常在 stderr。Cursor 使用 `agent`(兼容 `cursor-agent`)的
240
+ stream-json 模式,只为本次隔离空临时目录传入 `--trust` 以跳过 Workspace Trust 交互,
241
+ 不带 `--force`/`--yolo`,也不修改 Cursor 全局信任配置。HTML 的 Judge attempts 会显示完整调用链、retry、
242
+ 映射/默认来源及可获得的实际模型;Codex 默认模型未上报时会明确标注。
217
243
  - `AssertionConfigurationError: judge returned invalid JSON: ...` 表示 Judge 违反了输出协议,
218
244
  常见表现是用 `「」`、`“”` 或单引号给 `reason`/`evidence` 定界。Judge 的系统提示词已
219
245
  明确要求所有 key 和字符串值使用 ASCII 双引号;错误仍出现时应保留原始输出用于定位,