python-yama 0.10.3__tar.gz → 0.10.4__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 (72) hide show
  1. {python_yama-0.10.3 → python_yama-0.10.4}/PKG-INFO +4 -4
  2. {python_yama-0.10.3 → python_yama-0.10.4}/README.md +3 -3
  3. {python_yama-0.10.3 → python_yama-0.10.4}/README.zh-CN.md +3 -3
  4. {python_yama-0.10.3 → python_yama-0.10.4}/docs/agent-skill-test-framework-design.md +9 -8
  5. {python_yama-0.10.3 → python_yama-0.10.4}/docs/case-schema-reference.md +14 -14
  6. {python_yama-0.10.3 → python_yama-0.10.4}/skills/eval-plugin-with-yama/SKILL.md +6 -5
  7. {python_yama-0.10.3 → python_yama-0.10.4}/skills/eval-plugin-with-yama/references/case-schema.md +10 -9
  8. {python_yama-0.10.3 → python_yama-0.10.4}/skills/eval-plugin-with-yama/references/debugging.md +11 -10
  9. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_judge_llm.py +179 -42
  10. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_report.py +4 -4
  11. {python_yama-0.10.3 → python_yama-0.10.4}/yama/judge_llm.py +15 -5
  12. {python_yama-0.10.3 → python_yama-0.10.4}/yama/judge_routing.py +4 -1
  13. {python_yama-0.10.3 → python_yama-0.10.4}/yama/report.py +1 -0
  14. {python_yama-0.10.3 → python_yama-0.10.4}/.github/workflows/publish.yml +0 -0
  15. {python_yama-0.10.3 → python_yama-0.10.4}/.gitignore +0 -0
  16. {python_yama-0.10.3 → python_yama-0.10.4}/CLAUDE.md +0 -0
  17. {python_yama-0.10.3 → python_yama-0.10.4}/LICENSE +0 -0
  18. {python_yama-0.10.3 → python_yama-0.10.4}/docs/yama-intro.html +0 -0
  19. {python_yama-0.10.3 → python_yama-0.10.4}/pyproject.toml +0 -0
  20. {python_yama-0.10.3 → python_yama-0.10.4}/skills/eval-plugin-with-yama/references/install-upgrade.md +0 -0
  21. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_assertions.py +0 -0
  22. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_cli.py +0 -0
  23. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_cli_shim.py +0 -0
  24. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_dashboard.py +0 -0
  25. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_framework.py +0 -0
  26. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_llm.py +0 -0
  27. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_main_entrypoint.py +0 -0
  28. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_mocks.py +0 -0
  29. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_openai_llm.py +0 -0
  30. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_pr.py +0 -0
  31. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_preview.py +0 -0
  32. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_public_api.py +0 -0
  33. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_report_bundle.py +0 -0
  34. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_report_upload.py +0 -0
  35. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_run_plan.py +0 -0
  36. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_runner.py +0 -0
  37. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_skill_loader.py +0 -0
  38. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_skill_tool.py +0 -0
  39. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_thread_case.py +0 -0
  40. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_tool_loader.py +0 -0
  41. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_usage.py +0 -0
  42. {python_yama-0.10.3 → python_yama-0.10.4}/tests/test_workspace.py +0 -0
  43. {python_yama-0.10.3 → python_yama-0.10.4}/uv.lock +0 -0
  44. {python_yama-0.10.3 → python_yama-0.10.4}/yama/__init__.py +0 -0
  45. {python_yama-0.10.3 → python_yama-0.10.4}/yama/__main__.py +0 -0
  46. {python_yama-0.10.3 → python_yama-0.10.4}/yama/assertions.py +0 -0
  47. {python_yama-0.10.3 → python_yama-0.10.4}/yama/cli.py +0 -0
  48. {python_yama-0.10.3 → python_yama-0.10.4}/yama/dashboard.py +0 -0
  49. {python_yama-0.10.3 → python_yama-0.10.4}/yama/llm.py +0 -0
  50. {python_yama-0.10.3 → python_yama-0.10.4}/yama/loaders/__init__.py +0 -0
  51. {python_yama-0.10.3 → python_yama-0.10.4}/yama/loaders/case.py +0 -0
  52. {python_yama-0.10.3 → python_yama-0.10.4}/yama/loaders/common.py +0 -0
  53. {python_yama-0.10.3 → python_yama-0.10.4}/yama/loaders/skill_loader.py +0 -0
  54. {python_yama-0.10.3 → python_yama-0.10.4}/yama/loaders/tool_loader.py +0 -0
  55. {python_yama-0.10.3 → python_yama-0.10.4}/yama/mocks.py +0 -0
  56. {python_yama-0.10.3 → python_yama-0.10.4}/yama/models.py +0 -0
  57. {python_yama-0.10.3 → python_yama-0.10.4}/yama/openai_llm.py +0 -0
  58. {python_yama-0.10.3 → python_yama-0.10.4}/yama/pr.py +0 -0
  59. {python_yama-0.10.3 → python_yama-0.10.4}/yama/preview.py +0 -0
  60. {python_yama-0.10.3 → python_yama-0.10.4}/yama/report_bundle.py +0 -0
  61. {python_yama-0.10.3 → python_yama-0.10.4}/yama/report_upload.py +0 -0
  62. {python_yama-0.10.3 → python_yama-0.10.4}/yama/runner.py +0 -0
  63. {python_yama-0.10.3 → python_yama-0.10.4}/yama/thread_case.py +0 -0
  64. {python_yama-0.10.3 → python_yama-0.10.4}/yama/tools/__init__.py +0 -0
  65. {python_yama-0.10.3 → python_yama-0.10.4}/yama/tools/base.py +0 -0
  66. {python_yama-0.10.3 → python_yama-0.10.4}/yama/tools/bash/__init__.py +0 -0
  67. {python_yama-0.10.3 → python_yama-0.10.4}/yama/tools/bash/_cli_shim.py +0 -0
  68. {python_yama-0.10.3 → python_yama-0.10.4}/yama/tools/bash/bash.py +0 -0
  69. {python_yama-0.10.3 → python_yama-0.10.4}/yama/tools/bash/fs.py +0 -0
  70. {python_yama-0.10.3 → python_yama-0.10.4}/yama/tools/skill/__init__.py +0 -0
  71. {python_yama-0.10.3 → python_yama-0.10.4}/yama/tools/skill/skill.py +0 -0
  72. {python_yama-0.10.3 → python_yama-0.10.4}/yama/workspace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-yama
3
- Version: 0.10.3
3
+ Version: 0.10.4
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,7 @@ 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, 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.
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, every recognized family first passes the original Judge model name to its local Agent. If any local attempt that explicitly names a model fails, Yama retries the same Agent with its default model; if that default attempt also fails, Yama calls the original Judge API. Other families become local-first only through an exact mapping. This local-first chain never enters the fallback Agent.
50
50
 
51
51
  ```toml
52
52
  [defaults.judge.local.models.codex]
@@ -64,9 +64,9 @@ name = "claude" # "claude", "codex", or "cursor"
64
64
  model = "claude-sonnet-4-5"
65
65
  ```
66
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.
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 whenever that named-model attempt fails, then end. There is no fallback-model API call. External cancellation always stops the chain immediately. The HTML report shows the complete Judge attempt chain, including mapped/configured/default/fallback source, retries, failures, and the effective local model when the Agent reports it.
68
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).
69
+ CI and `pr-run` are API-only. Local agents receive the mapped model slug or original Judge model name 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).
70
70
 
71
71
  ## Writing a Case
72
72
 
@@ -19,7 +19,7 @@ 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, 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.
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, every recognized family first passes the original Judge model name to its local Agent. If any local attempt that explicitly names a model fails, Yama retries the same Agent with its default model; if that default attempt also fails, Yama calls the original Judge API. Other families become local-first only through an exact mapping. This local-first chain never enters the fallback Agent.
23
23
 
24
24
  ```toml
25
25
  [defaults.judge.local.models.codex]
@@ -37,9 +37,9 @@ name = "claude" # "claude", "codex", or "cursor"
37
37
  model = "claude-sonnet-4-5"
38
38
  ```
39
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.
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 whenever that named-model attempt fails, then end. There is no fallback-model API call. External cancellation always stops the chain immediately. The HTML report shows the complete Judge attempt chain, including mapped/configured/default/fallback source, retries, failures, and the effective local model when the Agent reports it.
41
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).
42
+ CI and `pr-run` are API-only. Local agents receive the mapped model slug or original Judge model name 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).
43
43
 
44
44
  ## Writing a Case
45
45
 
@@ -19,7 +19,7 @@ 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 运行中,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。
22
+ 被评测 Agent 的调用始终使用配置好的 OpenAI-compatible API。普通非 CI 运行中,Judge 路由把 OpenAI/GPT/o 系列交给 Codex、Claude/Anthropic 系列交给 Claude Code、Grok/xAI 系列交给 Cursor。每个 Agent 都可用精确映射把 API 模型名翻译成本地 CLI 模型 slug;未配置映射时,三个已识别系列都会先把原始 Judge 模型名传给对应本地 Agent。凡是显式携带模型名的本地尝试发生任何错误,Yama 都会改用同一 Agent 的默认模型重试;默认模型仍失败后才调用原始 Judge API。其他系列只有精确映射命中后才会变为 local-first,该链不会再进入 fallback Agent。
23
23
 
24
24
  ```toml
25
25
  [defaults.judge.local.models.codex]
@@ -37,9 +37,9 @@ name = "claude" # 支持 "claude"、"codex" 或 "cursor"
37
37
  model = "claude-sonnet-4-5"
38
38
  ```
39
39
 
40
- 未映射且未识别的模型走 API-first。只有原始 API 的可重试错误耗尽后,才会启用 `[defaults.judge.local.agent]` 作为终止型兜底:“配置的本地模型 → 仅在该 slug 被明确拒绝时使用同一 Agent 默认模型 → 结束”。不再调用 fallback-model API。HTML 报告会展示完整 Judge 尝试链,包括映射/默认/兜底来源、重试、失败原因,以及本地 Agent 能上报时的实际模型。
40
+ 未映射且未识别的模型走 API-first。只有原始 API 的可重试错误耗尽后,才会启用 `[defaults.judge.local.agent]` 作为终止型兜底:“配置的本地模型 → 该次尝试发生任何错误时使用同一 Agent 默认模型 → 结束”。不再调用 fallback-model API;外部取消始终立即终止整条链。HTML 报告会展示完整 Judge 尝试链,包括映射/原始配置/默认/兜底来源、重试、失败原因,以及本地 Agent 能上报时的实际模型。
41
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 秒。
42
+ CI 和 `pr-run` 均只走 API。本地 Agent 只接收命中的本地模型 slug 或原始 Judge 模型名,以及兼容的 `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 秒。
43
43
 
44
44
  ## 编写一个 Case
45
45
 
@@ -2628,18 +2628,19 @@ Judge 只评价无法可靠写成确定性规则的质量维度。执行逻辑
2628
2628
 
2629
2629
  1. `judge.model.name` 可路由到本地 Agent 时,OpenAI/GPT/o 系列交给 Codex,
2630
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`。
2631
+ 映射值作为本地 `--model`。未映射时三个已识别系列都先把原始 Judge 模型名作为
2632
+ `--model`。其他系列只有精确映射命中后才成为 local-first。凡显式携带映射 slug 或原始
2633
+ 模型名的本地尝试发生错误,都省略 `--model` 重试同一 Agent 默认模型;默认模型失败时,
2634
+ 使用原始完整 Judge model 对象回退 API。链最终以原始 API 兜底,不进入
2635
+ `defaults.judge.local.agent`。
2635
2636
  2. `judge.model.name` 未命中内置系列或映射时,先用原始完整 Judge model 对象调用 API。
2636
2637
  只有可重试错误在 `max_retries` 后仍失败,且 Workspace 显式配置了
2637
- `defaults.judge.local.agent`,才继续尝试配置的本地 Agent 与模型。仅当该模型名被本地
2638
- Agent 明确拒绝时,省略 `--model` 使用该 Agent 默认模型重试;本地执行、输出协议校验
2639
- 或默认模型仍失败时直接结束,不再调用 fallback-model API。不可重试的原始 API 错误
2638
+ `defaults.judge.local.agent`,才继续尝试配置的本地 Agent 与模型。该显式模型尝试发生
2639
+ 任何错误时,省略 `--model` 使用该 Agent 默认模型重试;默认模型仍失败时直接结束,
2640
+ 不再调用 fallback-model API。不可重试的原始 API 错误
2640
2641
  直接抛出;未配置 `defaults.judge.local.agent` 时不启用这条链。
2641
2642
 
2642
- CI 和 `yama pr-run` 的 Judge 只走 API。本地 Agent 尝试只接收兼容的
2643
+ 外部取消不会触发默认模型或 API 回退。CI 和 `yama pr-run` 的 Judge 只走 API。本地 Agent 尝试只接收兼容的
2643
2644
  `reasoning_effort`,不接收 `temperature`。Agent 默认模型可能因机器或时间而变化,所以
2644
2645
  `temperature: 0` 只对 API Judge 提供稳定作用,不能保证本地 Judge 可复现。被测 Agent
2645
2646
  的 API 单次 attempt 默认 transport timeout 为 180 秒;Judge API 单次 attempt 与本地
@@ -92,10 +92,11 @@ timeout/connection error,以及 HTTP `408`、`409`、`429` 和所有 `5xx`;
92
92
  Step deadline:`execution.timeout_seconds_per_step` 默认仍为 300 秒。
93
93
 
94
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。
95
+ Codex,Claude/Anthropic 系列走 Claude Code,Grok/xAI 系列走 Cursor。没有精确映射时,
96
+ 三个已识别系列都会先把原始 Judge 模型名原样作为 `--model`。该显式模型尝试发生任何错误
97
+ 时,都会省略 `--model` 使用对应 Agent 的默认模型重试。其他系列(例如 `kimi.k3`)只有命中下面的精确、
98
+ 大小写敏感映射时才走本地;
99
+ `openrouter/gpt-4.1` 等未命中模型保持 API-first。
99
100
 
100
101
  ```toml
101
102
  [defaults.judge.local.models.codex]
@@ -114,13 +115,12 @@ Agent、跨 Agent 重复、跨系列映射、空值和首尾空白都会在 Work
114
115
 
115
116
  每次本地 Judge 均在新建的隔离目录中以无会话、只读的受限调用执行,并要求严格的结构化
116
117
  输出;Yama 会再次校验其 JSON 和每个 Judge 维度的协议。可选 usage 只有在本地 Agent
117
- 实际返回有效 token 计数时才写入,Yama 不会编造 usage。本地调用只传入映射命中的模型 slug 和
118
- 该 CLI 支持的 `reasoning_effort`;不会传入 `temperature`、凭据、`base_url`/`api_base`
119
- 或其他 endpoint 设置。若映射模型被本地进程明确报告为不存在或不可用,Yama 会写一条
120
- 已脱敏警告,并省略 `--model` 使用同一 Agent 的默认模型重试一次。识别系列本来就是默认
121
- 模型起步,因此不会重复一次相同的默认尝试。其他本地错误或默认模型重试失败时,用**未
122
- 改写的完整原始 model 对象**调用 API。该 local-first 链到此结束,不会进入 Workspace
123
- fallback Agent。
118
+ 实际返回有效 token 计数时才写入,Yama 不会编造 usage。本地调用只传入映射命中的模型 slug、
119
+ 无映射时的原始 Judge 模型名和该 CLI 支持的 `reasoning_effort`;不会传入 `temperature`、
120
+ 凭据、`base_url`/`api_base` 或其他 endpoint 设置。映射模型或原始模型名的本地尝试发生
121
+ 任何错误时,Yama 都会写一条已脱敏警告,并省略 `--model` 使用同一 Agent 的默认模型重试
122
+ 一次。默认模型重试失败时,用**未改写的完整原始 model 对象**调用 API。该
123
+ local-first 链到此结束,不会进入 Workspace fallback Agent。
124
124
 
125
125
  对于 `openrouter/gpt-4.1` 等不能路由到本地 Agent 的模型,原始 API 只有在可重试错误
126
126
  耗尽 `max_retries` 后,才可能启用以下可选 Workspace 兜底;不可重试错误会直接抛出:
@@ -131,9 +131,9 @@ name = "claude" # 支持 "claude"、"codex" 或 "cursor"
131
131
  model = "claude-sonnet-4-5"
132
132
  ```
133
133
 
134
- 配置存在时,Yama 先以指定 Agent 和模型执行本地 Judge;仅当模型名被明确拒绝时,省略
135
- `--model` 使用该 Agent 默认模型重试。任一本地执行或协议校验失败都直接结束;不会再用
136
- 配置模型名调用 API。整个配置表缺失时不会启用这条行为;`name` 不是 `claude`/`codex`/
134
+ 配置存在时,Yama 先以指定 Agent 和模型执行本地 Judge;该次尝试发生任何错误时,省略
135
+ `--model` 使用该 Agent 默认模型重试。默认模型仍失败时直接结束,不会再用配置模型名调用
136
+ API。外部取消立即终止,不触发重试。整个配置表缺失时不会启用这条行为;`name` 不是 `claude`/`codex`/
137
137
  `cursor`、`model` 为空或层级不是 TOML table 时,加载 Workspace 即报配置错误。
138
138
 
139
139
  Codex 与 Claude Code 接收一份本地兼容的 Judge Schema 副本:数组使用对象型
@@ -264,12 +264,13 @@ yama dashboard # 默认 http://127.0.0.1:8765/
264
264
  ```
265
265
 
266
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 → 结束”。
267
+ 优先使用 Codex、Claude Code、Cursor。未配置精确映射时,三个 Agent 都先使用原始 Judge
268
+ 模型名;凡显式模型尝试发生任何错误,都再试对应 Agent 默认模型。
269
+ 其他模型(如 `kimi.k3`)只有命中 `[defaults.judge.local.models.<agent>]` 的精确 API→本地
270
+ slug 映射才会 local-first。该链最终以原始 Judge API 兜底。
270
271
  API-first 只有可重试错误耗尽且配置 `[defaults.judge.local.agent]`(`name` 支持
271
- `claude`/`codex`/`cursor`)时才尝试 fallback Agent;本地模型被拒绝可再试 Agent 默认,
272
- 任一本地失败后直接结束,不再调用 fallback-model API。CI/`pr-run` 始终 API-only,HTML
272
+ `claude`/`codex`/`cursor`)时才尝试 fallback Agent;显式本地模型失败后再试 Agent 默认,
273
+ 默认模型仍失败后直接结束,不再调用 fallback-model API。外部取消始终立即终止。CI/`pr-run` 始终 API-only,HTML
273
274
  会展示完整 Judge 尝试链和 Agent 能上报的实际模型。
274
275
  Cursor Judge 只为每次隔离空临时目录传入 `--trust` 以跳过 Workspace Trust 交互,仍不
275
276
  使用 `--force`/`--yolo`,也不修改 Cursor 全局信任配置。
@@ -473,12 +473,13 @@ judge:
473
473
  Judge API 单次 attempt 与本地 Judge 进程默认 timeout 均为 120 秒;整 Step timeout 仍由
474
474
  `execution.timeout_seconds_per_step` 独立控制,默认 300 秒。
475
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`;
476
+ Claude Code、Grok/xAI 系列交给 Cursor。未配置精确映射时三个 Agent 都先使用原始
477
+ Judge 模型名。其他模型只有命中
478
+ `[defaults.judge.local.models.<agent>]` 的大小写敏感精确 API→本地 slug 映射时才走本地。
479
+ CI 和 `yama pr-run` 的 Judge 只走 API。
480
+ - 映射 slug 或原始模型名的本地尝试发生任何错误时,Yama 都会向 stderr 警告并省略
481
+ `--model`,使用同一 Agent 默认模型重试一次。默认模型失败时,以原始完整 model 对象回退
482
+ API;外部取消立即终止,不触发重试。本地 Agent 不接收 `temperature`;
482
483
  `temperature: 0` 的稳定作用仅限 API Judge。local-first 固定为“主 Agent → 原始 API →
483
484
  结束”,不会进入 Workspace fallback Agent。
484
485
  - 对未命中内置系列或映射的 Case Judge 模型,只有原始 API 因可重试错误耗尽
@@ -495,11 +496,11 @@ judge:
495
496
  model = "claude-sonnet-4-5"
496
497
  ```
497
498
 
498
- 顺序是:配置的本地 Agent + 模型 → 仅在模型名被明确拒绝时省略 `--model` 使用同一
499
- Agent 默认模型 → 结束。任一本地失败后不再调用 fallback-model API。`name` 非
499
+ 顺序是:配置的本地 Agent + 模型 → 该次尝试发生任何错误时省略 `--model` 使用同一
500
+ Agent 默认模型 → 结束。默认模型失败后不再调用 fallback-model API。`name` 非
500
501
  `claude`/`codex`/`cursor`、映射冲突、`model` 为空或 table 层级错误会在 Workspace
501
502
  加载时直接报配置错误。
502
- - HTML 报告会按顺序展示完整 Judge 尝试链、映射/默认/兜底来源、API retry 和脱敏失败;
503
+ - HTML 报告会按顺序展示完整 Judge 尝试链、映射/原始配置/默认/兜底来源、API retry 和脱敏失败;
503
504
  Claude Code/Cursor 会显示 init 事件上报的实际模型,Codex 默认未上报时明确标注。
504
505
  - Cursor Judge 只为当前隔离空临时目录传入 `--trust` 以跳过 Workspace Trust 交互;不带
505
506
  `--force`/`--yolo`,也不修改 Cursor 全局信任配置。
@@ -188,8 +188,8 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
188
188
  偏了——criteria 应描述可观察的判分标准,而不是抽象形容词。
189
189
  - 被测 Agent 调用始终走 API。普通非 CI 运行的 Judge 才会本地优先:OpenAI/GPT/o
190
190
  系列交给 Codex,Claude/Anthropic 系列交给 Claude Code,Grok/xAI 系列交给 Cursor;
191
- 内置系列无精确映射时直接用 Agent 默认模型,其他模型只有精确映射命中才走本地。CI
192
- 和 `yama pr-run` 的 Judge 只走 API。被测 Agent 的 API 单次
191
+ 无精确映射时三个 Agent 都先用原始 Judge 模型名,
192
+ 其他模型只有精确映射命中才走本地。CI 和 `yama pr-run` 的 Judge 只走 API。被测 Agent 的 API 单次
193
193
  attempt 默认 timeout 为 180 秒;Judge API 单次 attempt 与本地 Judge 进程默认均为
194
194
  120 秒,整 Step timeout 仍独立默认为 300 秒。
195
195
  - Judge 模型配置报错或与预期不同时,先确认所有权:省略 `judge.model` 才会深拷贝
@@ -206,10 +206,10 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
206
206
 
207
207
  旧版同级 `judge.temperature` 会覆盖选中模型的 `temperature`;两处都省略时,Yama
208
208
  不会补充 temperature 值(does not synthesize a temperature value)。
209
- - 普通运行中,精确映射的本地 slug 被明确报告为不存在或不可用时,Yama 会先警告并省略
210
- `--model`,使用同一 Agent 默认模型重试一次。内置系列本来就从默认模型开始,不会重复
211
- 一次相同尝试。默认模型可能因机器或时间而变化;其他本地错误或这次重试失败时,Yama
212
- 用原始完整 model 对象回退 API。
209
+ - 普通运行中,精确映射的本地 slug 或原始 Judge 模型名的本地尝试发生任何错误时,Yama
210
+ 都会先警告并省略 `--model`,使用同一 Agent 默认模型重试一次。这个决定不依赖 Agent
211
+ 错误文案;例如 `Cannot use this model: grok.4.5`、超时或输出校验失败都会重试。默认模型
212
+ 可能因机器或时间而变化;这次重试失败时,Yama 用原始完整 model 对象回退 API。
213
213
  本地两次尝试只使用兼容的 `reasoning_effort`,不接收 `temperature`;因此 Judge
214
214
  波动大时仍应用 `execution.repeat` 观察 `pass_rate`,`temperature: 0` 只能稳定 API
215
215
  Judge,不能保证本地 Judge 可复现。Case Judge 模型已走这条本地优先路径时,不会再
@@ -228,8 +228,8 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
228
228
  model = "claude-sonnet-4-5"
229
229
  ```
230
230
 
231
- 触发后依次使用配置的本地 Agent + 模型;仅在模型名被明确拒绝时省略 `--model` 使用
232
- 同一 Agent 默认模型;本地仍失败就直接结束,不再调用 fallback-model API。若观察不到
231
+ 触发后依次使用配置的本地 Agent + 模型;该次尝试发生任何错误时省略 `--model` 使用
232
+ 同一 Agent 默认模型;默认模型仍失败就直接结束,不再调用 fallback-model API。若观察不到
233
233
  预期兜底,先检查错误是否确实可重试、重试是否已经耗尽、配置 table 是否存在,以及
234
234
  `name`/`model` 是否有效。
235
235
  - 本地 Codex/Claude 会收到兼容其严格模式的 Judge Schema 副本,返回后仍由 Yama 按原始
@@ -238,8 +238,9 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
238
238
  警告会同时摘要 stdout 和 stderr;其中 `invalid_json_schema`、模型拒绝等真实错误通常在
239
239
  stdout,插件启动 warning 通常在 stderr。Cursor 使用 `agent`(兼容 `cursor-agent`)的
240
240
  stream-json 模式,只为本次隔离空临时目录传入 `--trust` 以跳过 Workspace Trust 交互,
241
- 不带 `--force`/`--yolo`,也不修改 Cursor 全局信任配置。HTML 的 Judge attempts 会显示完整调用链、retry、
242
- 映射/默认来源及可获得的实际模型;Codex 默认模型未上报时会明确标注。
241
+ 不带 `--force`/`--yolo`,也不修改 Cursor 全局信任配置。HTML 的 Judge attempts 会显示
242
+ 完整调用链、retry、映射/原始配置/默认来源及可获得的实际模型;Codex 默认模型未上报时
243
+ 会明确标注。
243
244
  - `AssertionConfigurationError: judge returned invalid JSON: ...` 表示 Judge 违反了输出协议,
244
245
  常见表现是用 `「」`、`“”` 或单引号给 `reason`/`evidence` 定界。Judge 的系统提示词已
245
246
  明确要求所有 key 和字符串值使用 ASCII 双引号;错误仍出现时应保留原始输出用于定位,
@@ -878,6 +878,7 @@ class LocalFirstJudgeClientTests(unittest.IsolatedAsyncioTestCase):
878
878
  "unknown model: 'gpt.4.1'",
879
879
  'invalid model: "gpt.4.1"',
880
880
  "model gpt.4.1 is currently unavailable",
881
+ "Cannot use this model: gpt.4.1",
881
882
  ]
882
883
  for detail in accepted:
883
884
  with self.subTest(detail=detail):
@@ -1146,23 +1147,30 @@ class LocalFirstJudgeClientTests(unittest.IsolatedAsyncioTestCase):
1146
1147
  self.assertEqual(response.content, VALID_JUDGE_JSON)
1147
1148
  resolver.assert_not_called()
1148
1149
 
1149
- async def test_builtin_default_uses_one_cursor_attempt_and_legacy_alias(
1150
+ async def test_unmapped_cursor_model_rejection_retries_agent_default(
1150
1151
  self,
1151
1152
  ) -> None:
1152
1153
  resolver_calls = []
1154
+ route_models = []
1153
1155
 
1154
1156
  def resolve(command):
1155
1157
  resolver_calls.append(command)
1156
1158
  return "/bin/cursor-agent" if command == "cursor-agent" else None
1157
1159
 
1158
- local = AsyncMock(
1159
- return_value=LLMResponse(
1160
+ async def local(executable, route, **kwargs):
1161
+ route_models.append(route.model)
1162
+ if route.model is not None:
1163
+ raise LocalJudgeError(
1164
+ "process_exit", "Cannot use this model: grok.4.5"
1165
+ )
1166
+ return LLMResponse(
1160
1167
  content=VALID_JUDGE_JSON,
1161
1168
  metadata={"effective_model": "Grok 4.5"},
1162
1169
  )
1163
- )
1170
+
1171
+ api = RecordingClient(VALID_JUDGE_JSON)
1164
1172
  client = LocalFirstJudgeLLMClient(
1165
- RecordingClient(VALID_JUDGE_JSON),
1173
+ api,
1166
1174
  executable_resolver=resolve,
1167
1175
  local_callers={"cursor": local},
1168
1176
  warning_stream=io.StringIO(),
@@ -1175,13 +1183,27 @@ class LocalFirstJudgeClientTests(unittest.IsolatedAsyncioTestCase):
1175
1183
  output_schema=JUDGE_SCHEMA,
1176
1184
  )
1177
1185
 
1178
- self.assertEqual(resolver_calls, ["agent", "cursor-agent"])
1179
- self.assertEqual(local.await_count, 1)
1186
+ self.assertEqual(
1187
+ resolver_calls,
1188
+ ["agent", "cursor-agent", "agent", "cursor-agent"],
1189
+ )
1190
+ self.assertEqual(route_models, ["grok.4.5", None])
1191
+ self.assertEqual(api.calls, [])
1180
1192
  self.assertEqual(
1181
1193
  client.last_judge_execution,
1182
1194
  {
1183
1195
  "configured_model": "grok.4.5",
1184
1196
  "attempts": [
1197
+ {
1198
+ "transport": "local",
1199
+ "agent": "cursor",
1200
+ "requested_model": "grok.4.5",
1201
+ "effective_model": None,
1202
+ "model_source": "configured_model",
1203
+ "status": "failed",
1204
+ "failure_stage": "model_unavailable",
1205
+ "error": "Cannot use this model: grok.4.5",
1206
+ },
1185
1207
  {
1186
1208
  "transport": "local",
1187
1209
  "agent": "cursor",
@@ -1194,7 +1216,112 @@ class LocalFirstJudgeClientTests(unittest.IsolatedAsyncioTestCase):
1194
1216
  },
1195
1217
  )
1196
1218
 
1197
- async def test_local_failures_warn_once_and_fall_back_to_api(self) -> None:
1219
+ async def test_unmapped_codex_and_claude_any_failure_retries_default(
1220
+ self,
1221
+ ) -> None:
1222
+ cases = [
1223
+ (
1224
+ "codex",
1225
+ "openai/gpt.5.4",
1226
+ LocalJudgeError("timeout", "configured model timed out"),
1227
+ ),
1228
+ (
1229
+ "claude",
1230
+ "anthropic/claude-opus-5",
1231
+ RuntimeError("configured model failed unexpectedly"),
1232
+ ),
1233
+ ]
1234
+ for agent, model_name, configured_error in cases:
1235
+ with self.subTest(agent=agent, model_name=model_name):
1236
+ api = RecordingClient(VALID_JUDGE_JSON)
1237
+ route_models = []
1238
+
1239
+ async def local(executable, route, **kwargs):
1240
+ route_models.append(route.model)
1241
+ if route.model is not None:
1242
+ raise configured_error
1243
+ return LLMResponse(content=VALID_JUDGE_JSON)
1244
+
1245
+ client = LocalFirstJudgeLLMClient(
1246
+ api,
1247
+ executable_resolver=lambda command: f"/bin/{command}",
1248
+ local_callers={agent: local},
1249
+ warning_stream=io.StringIO(),
1250
+ )
1251
+
1252
+ response = await client.complete_structured(
1253
+ messages=JUDGE_MESSAGES,
1254
+ tools=[],
1255
+ model={"name": model_name},
1256
+ output_schema=JUDGE_SCHEMA,
1257
+ )
1258
+
1259
+ self.assertEqual(response.content, VALID_JUDGE_JSON)
1260
+ self.assertEqual(route_models, [model_name, None])
1261
+ self.assertEqual(api.calls, [])
1262
+ self.assertEqual(
1263
+ [
1264
+ (
1265
+ attempt["model_source"],
1266
+ attempt["requested_model"],
1267
+ attempt["status"],
1268
+ )
1269
+ for attempt in client.last_judge_execution["attempts"]
1270
+ ],
1271
+ [
1272
+ ("configured_model", model_name, "failed"),
1273
+ ("agent_default", None, "success"),
1274
+ ],
1275
+ )
1276
+
1277
+ async def test_unmapped_cursor_default_failure_uses_original_api(
1278
+ self,
1279
+ ) -> None:
1280
+ api = RecordingClient(VALID_JUDGE_JSON)
1281
+ route_models = []
1282
+
1283
+ async def local(executable, route, **kwargs):
1284
+ route_models.append(route.model)
1285
+ if route.model is not None:
1286
+ raise LocalJudgeError(
1287
+ "process_exit", "model grok.4.6 does not exist"
1288
+ )
1289
+ raise LocalJudgeError("timeout", "Cursor default timed out")
1290
+
1291
+ client = LocalFirstJudgeLLMClient(
1292
+ api,
1293
+ executable_resolver=lambda command: f"/bin/{command}",
1294
+ local_callers={"cursor": local},
1295
+ warning_stream=io.StringIO(),
1296
+ )
1297
+ model = {"name": "grok.4.6", "temperature": 0.2}
1298
+
1299
+ response = await client.complete_structured(
1300
+ messages=JUDGE_MESSAGES,
1301
+ tools=[],
1302
+ model=model,
1303
+ output_schema=JUDGE_SCHEMA,
1304
+ )
1305
+
1306
+ self.assertEqual(response.content, VALID_JUDGE_JSON)
1307
+ self.assertEqual(route_models, ["grok.4.6", None])
1308
+ self.assertEqual(len(api.calls), 1)
1309
+ self.assertEqual(api.calls[0]["model"], model)
1310
+ self.assertEqual(
1311
+ [
1312
+ (attempt["transport"], attempt["model_source"], attempt["status"])
1313
+ for attempt in client.last_judge_execution["attempts"]
1314
+ ],
1315
+ [
1316
+ ("local", "configured_model", "failed"),
1317
+ ("local", "agent_default", "failed"),
1318
+ ("api", "original_api", "success"),
1319
+ ],
1320
+ )
1321
+
1322
+ async def test_named_local_failures_retry_default_then_fall_back_to_api(
1323
+ self,
1324
+ ) -> None:
1198
1325
  stages = [
1199
1326
  "launch",
1200
1327
  "process_exit",
@@ -1208,8 +1335,10 @@ class LocalFirstJudgeClientTests(unittest.IsolatedAsyncioTestCase):
1208
1335
  with self.subTest(stage=stage):
1209
1336
  api = RecordingClient(VALID_JUDGE_JSON)
1210
1337
  warning = io.StringIO()
1338
+ route_models = []
1211
1339
 
1212
- async def fail(*args, _stage=stage, **kwargs):
1340
+ async def fail(executable, route, _stage=stage, **kwargs):
1341
+ route_models.append(route.model)
1213
1342
  raise LocalJudgeError(_stage, "controlled local failure")
1214
1343
 
1215
1344
  client = LocalFirstJudgeLLMClient(
@@ -1227,15 +1356,17 @@ class LocalFirstJudgeClientTests(unittest.IsolatedAsyncioTestCase):
1227
1356
  )
1228
1357
 
1229
1358
  self.assertEqual(response.content, VALID_JUDGE_JSON)
1359
+ self.assertEqual(route_models, [model["name"], None])
1230
1360
  self.assertEqual(len(api.calls), 1)
1231
1361
  self.assertEqual(api.calls[0]["model"], model)
1232
1362
  lines = warning.getvalue().splitlines()
1233
- self.assertEqual(len(lines), 1)
1234
- self.assertIn("agent=codex", lines[0])
1235
- self.assertIn("model=openai/gpt.4.1", lines[0])
1236
- self.assertIn(f"stage={stage}", lines[0])
1237
- self.assertIn("falling back to API", lines[0])
1238
- self.assertIn("controlled local failure", lines[0])
1363
+ self.assertEqual(len(lines), 2)
1364
+ self.assertIn("retrying agent default", lines[0])
1365
+ self.assertIn("agent=codex", lines[1])
1366
+ self.assertIn("model=openai/gpt.4.1", lines[1])
1367
+ self.assertIn(f"stage={stage}", lines[1])
1368
+ self.assertIn("falling back to API", lines[1])
1369
+ self.assertIn("controlled local failure", lines[1])
1239
1370
 
1240
1371
  async def test_wrong_dimension_order_falls_back_as_schema_failure(self) -> None:
1241
1372
  schema = _judge_output_schema([{"name": "clarity"}, {"name": "accuracy"}])
@@ -1436,10 +1567,11 @@ class LocalFirstJudgeClientTests(unittest.IsolatedAsyncioTestCase):
1436
1567
  )
1437
1568
 
1438
1569
  value = warning.getvalue()
1439
- self.assertEqual(len(value.splitlines()), 1)
1440
- self.assertLess(len(value), 600)
1441
- self.assertIn("process failed", value)
1442
- self.assertIn("<redacted>", value)
1570
+ lines = value.splitlines()
1571
+ self.assertEqual(len(lines), 2)
1572
+ self.assertTrue(all(len(line) < 600 for line in lines))
1573
+ self.assertIn("process failed", lines[1])
1574
+ self.assertIn("<redacted>", lines[1])
1443
1575
  self.assertNotIn("secret-value", value)
1444
1576
  self.assertNotIn("credential-value", value)
1445
1577
  self.assertNotIn("https://private-agent.example/v1", value)
@@ -1526,8 +1658,9 @@ class LocalFirstJudgeClientTests(unittest.IsolatedAsyncioTestCase):
1526
1658
  )
1527
1659
 
1528
1660
  value = warning.getvalue()
1529
- self.assertEqual(len(value.splitlines()), 1)
1530
- self.assertLess(len(value), 600)
1661
+ lines = value.splitlines()
1662
+ self.assertEqual(len(lines), 2)
1663
+ self.assertTrue(all(len(line) < 600 for line in lines))
1531
1664
  self.assertIn("falling back to API", value)
1532
1665
  self.assertIn("agent=codex", value)
1533
1666
  self.assertIn("stage=availability", value)
@@ -1735,7 +1868,7 @@ class ConfiguredFallbackRoutingTests(unittest.IsolatedAsyncioTestCase):
1735
1868
 
1736
1869
  resolver.assert_not_called()
1737
1870
 
1738
- async def test_configured_model_rejection_retries_agent_default(self) -> None:
1871
+ async def test_configured_model_failure_retries_agent_default(self) -> None:
1739
1872
  api = SequencedClient(
1740
1873
  [LLMRetryExhaustedError("deepseek exhausted")],
1741
1874
  retry_counts=[4],
@@ -1745,7 +1878,7 @@ class ConfiguredFallbackRoutingTests(unittest.IsolatedAsyncioTestCase):
1745
1878
  async def local(executable, route, **kwargs):
1746
1879
  route_models.append(route.model)
1747
1880
  if route.model is not None:
1748
- raise LocalJudgeError("process_exit", "unknown model gpt-5")
1881
+ raise LocalJudgeError("timeout", "configured model timed out")
1749
1882
  return LLMResponse(content=VALID_JUDGE_JSON)
1750
1883
 
1751
1884
  client = LocalFirstJudgeLLMClient(
@@ -1803,12 +1936,13 @@ class ConfiguredFallbackRoutingTests(unittest.IsolatedAsyncioTestCase):
1803
1936
  [call["model"] for call in api.calls],
1804
1937
  [{"name": "deepseek-v3", "temperature": 0.8}],
1805
1938
  )
1806
- self.assertEqual(route_models, ["gpt-5"])
1939
+ self.assertEqual(route_models, ["gpt-5", None])
1807
1940
  self.assertEqual(client.last_retry_count, 4)
1808
1941
  lines = warning.getvalue().splitlines()
1809
- self.assertEqual(len(lines), 2)
1942
+ self.assertEqual(len(lines), 3)
1810
1943
  self.assertIn("API retries exhausted", lines[0])
1811
- self.assertIn("Local Judge failed", lines[1])
1944
+ self.assertIn("retrying agent default", lines[1])
1945
+ self.assertIn("Local Judge failed", lines[2])
1812
1946
 
1813
1947
  async def test_invalid_configured_local_schema_is_terminal(
1814
1948
  self,
@@ -1874,7 +2008,7 @@ class ConfiguredFallbackRoutingTests(unittest.IsolatedAsyncioTestCase):
1874
2008
 
1875
2009
  self.assertIs(raised.exception, local_error)
1876
2010
  self.assertIsInstance(raised.exception.__cause__, LLMRetryExhaustedError)
1877
- self.assertEqual(route_models, ["gpt-5"])
2011
+ self.assertEqual(route_models, ["gpt-5", None])
1878
2012
  self.assertEqual(
1879
2013
  [call["model"]["name"] for call in api.calls],
1880
2014
  ["deepseek-v3"],
@@ -1938,22 +2072,25 @@ class ConfiguredFallbackRoutingTests(unittest.IsolatedAsyncioTestCase):
1938
2072
 
1939
2073
 
1940
2074
  class JudgeRoutingTests(unittest.TestCase):
1941
- def test_builtin_model_families_route_to_agent_defaults(self) -> None:
2075
+ def test_builtin_model_families_select_expected_initial_models(self) -> None:
1942
2076
  cases = {
1943
- "gpt-4.1": ("codex", None),
1944
- "gpt.4.1": ("codex", None),
1945
- "gpt_4.1": ("codex", None),
1946
- "CHATGPT-5": ("codex", None),
1947
- "o3": ("codex", None),
1948
- "o4-mini": ("codex", None),
1949
- "openai/gpt.4.1": ("codex", None),
1950
- "claude-sonnet-5": ("claude", None),
1951
- "claude.opus.5": ("claude", None),
1952
- "anthropic/claude-sonnet-5": ("claude", None),
1953
- "grok-4": ("cursor", None),
1954
- "grok.4.5": ("cursor", None),
1955
- "x-ai/grok-4": ("cursor", None),
1956
- "XAI/Grok-4": ("cursor", None),
2077
+ "gpt-4.1": ("codex", "gpt-4.1"),
2078
+ "gpt.4.1": ("codex", "gpt.4.1"),
2079
+ "gpt_4.1": ("codex", "gpt_4.1"),
2080
+ "CHATGPT-5": ("codex", "CHATGPT-5"),
2081
+ "o3": ("codex", "o3"),
2082
+ "o4-mini": ("codex", "o4-mini"),
2083
+ "openai/gpt.4.1": ("codex", "openai/gpt.4.1"),
2084
+ "claude-sonnet-5": ("claude", "claude-sonnet-5"),
2085
+ "claude.opus.5": ("claude", "claude.opus.5"),
2086
+ "anthropic/claude-sonnet-5": (
2087
+ "claude",
2088
+ "anthropic/claude-sonnet-5",
2089
+ ),
2090
+ "grok-4": ("cursor", "grok-4"),
2091
+ "grok.4.5": ("cursor", "grok.4.5"),
2092
+ "x-ai/grok-4": ("cursor", "x-ai/grok-4"),
2093
+ "XAI/Grok-4": ("cursor", "XAI/Grok-4"),
1957
2094
  }
1958
2095
  for name, expected in cases.items():
1959
2096
  route = resolve_local_judge_route(name, {})
@@ -212,14 +212,14 @@ class JudgeStatusReportTests(unittest.TestCase):
212
212
  "dimensions": [],
213
213
  },
214
214
  judge_execution={
215
- "configured_model": "x-ai/grok-4",
215
+ "configured_model": "grok.4.6",
216
216
  "attempts": [
217
217
  {
218
218
  "transport": "local",
219
219
  "agent": "cursor",
220
- "requested_model": "grok-4",
220
+ "requested_model": "grok.4.6",
221
221
  "effective_model": None,
222
- "model_source": "mapping",
222
+ "model_source": "configured_model",
223
223
  "status": "failed",
224
224
  "failure_stage": "model_unavailable",
225
225
  "error": "requested model is unavailable",
@@ -244,7 +244,7 @@ class JudgeStatusReportTests(unittest.TestCase):
244
244
 
245
245
  html = render_html_report([case], [result])
246
246
 
247
- first = html.index("Cursor · grok-4 · mapped")
247
+ first = html.index("Cursor · grok.4.6 · configured model")
248
248
  second = html.index("Cursor · Grok 4.5 · agent default")
249
249
  self.assertLess(first, second)
250
250
  self.assertIn("Judge attempts", html)
@@ -24,7 +24,8 @@ CI_ENV_MARKERS = (
24
24
  )
25
25
  _FALSE_ENV_VALUES = {"", "0", "false", "no", "off"}
26
26
  _MODEL_REJECTION_PREFIX = re.compile(
27
- r"(?:unknown|invalid)\s+model\s*(?::|=)?\s*['\"`(\[]*\s*$",
27
+ r"(?:(?:unknown|invalid)\s+model|cannot\s+use\s+(?:this\s+)?model)"
28
+ r"\s*(?::|=)?\s*['\"`(\[]*\s*$",
28
29
  re.IGNORECASE,
29
30
  )
30
31
  _MODEL_REJECTION_SUFFIX = re.compile(
@@ -737,9 +738,10 @@ class LocalFirstJudgeLLMClient(LLMClient):
737
738
  output_schema=output_schema,
738
739
  )
739
740
  except Exception as error:
740
- if not _is_local_model_unavailable(error, route.model):
741
+ if route.model is None:
741
742
  raise
742
- self._attempts()[-1]["failure_stage"] = "model_unavailable"
743
+ if _is_local_model_unavailable(error, route.model):
744
+ self._attempts()[-1]["failure_stage"] = "model_unavailable"
743
745
  self._warn_default_model_retry(route, model["name"])
744
746
  return await self._complete_local_attempt(
745
747
  LocalJudgeRoute(route.agent, route.command, None),
@@ -793,11 +795,18 @@ class LocalFirstJudgeLLMClient(LLMClient):
793
795
  self._start_trace(model["name"])
794
796
  route = resolve_local_judge_route(model["name"], self.model_maps)
795
797
  if route is not None:
798
+ mapped = model["name"] in self.model_maps.get(route.agent, {})
796
799
  try:
797
800
  return await self._complete_local_with_default_retry(
798
801
  route,
799
802
  model_source=(
800
- "mapping" if route.model is not None else "agent_default"
803
+ "mapping"
804
+ if mapped
805
+ else (
806
+ "configured_model"
807
+ if route.model is not None
808
+ else "agent_default"
809
+ )
801
810
  ),
802
811
  messages=messages,
803
812
  model=model,
@@ -873,7 +882,8 @@ class LocalFirstJudgeLLMClient(LLMClient):
873
882
  ) -> None:
874
883
  safe_model = _safe_error_summary(str(original_model_name), limit=160)
875
884
  warning = (
876
- "[yama] Local Judge model unavailable; retrying agent default: "
885
+ "[yama] Local Judge attempt with requested model failed; "
886
+ "retrying agent default: "
877
887
  f"agent={route.agent} requested={safe_model}"
878
888
  )
879
889
  if len(warning) > 598:
@@ -41,7 +41,10 @@ def resolve_judge_agent_and_model(
41
41
  maps = model_maps or {}
42
42
  builtin = classify_builtin_judge_agent(model_name)
43
43
  if builtin is not None:
44
- return builtin, maps.get(builtin, {}).get(model_name)
44
+ local_model = maps.get(builtin, {}).get(model_name)
45
+ if local_model is None:
46
+ local_model = model_name
47
+ return builtin, local_model
45
48
  for agent in AGENT_NAMES:
46
49
  entries = maps.get(agent, {})
47
50
  if model_name in entries:
@@ -455,6 +455,7 @@ def _render_judge_attempts(execution: Any) -> str:
455
455
  }
456
456
  source_labels = {
457
457
  "mapping": "mapped",
458
+ "configured_model": "configured model",
458
459
  "agent_default": "agent default",
459
460
  "fallback_config": "fallback config",
460
461
  "original_api": "original API",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes