python-yama 0.7.0__tar.gz → 0.9.0__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.
- {python_yama-0.7.0 → python_yama-0.9.0}/PKG-INFO +17 -1
- {python_yama-0.7.0 → python_yama-0.9.0}/README.md +16 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/README.zh-CN.md +15 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/docs/agent-skill-test-framework-design.md +71 -18
- {python_yama-0.7.0 → python_yama-0.9.0}/docs/case-schema-reference.md +9 -6
- {python_yama-0.7.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/SKILL.md +14 -6
- {python_yama-0.7.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/references/case-schema.md +8 -2
- {python_yama-0.7.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/references/debugging.md +8 -2
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_cli.py +515 -1
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_framework.py +264 -0
- python_yama-0.9.0/tests/test_pr.py +571 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_report.py +91 -0
- python_yama-0.9.0/tests/test_report_bundle.py +224 -0
- python_yama-0.9.0/tests/test_report_upload.py +297 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_thread_case.py +36 -5
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/cli.py +253 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/loaders/case.py +46 -19
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/loaders/tool_loader.py +6 -0
- python_yama-0.9.0/yama/pr.py +361 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/report.py +288 -14
- python_yama-0.9.0/yama/report_bundle.py +237 -0
- python_yama-0.9.0/yama/report_upload.py +323 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/thread_case.py +0 -2
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/tools/bash/bash.py +6 -1
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/tools/bash/fs.py +58 -1
- {python_yama-0.7.0 → python_yama-0.9.0}/.github/workflows/publish.yml +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/.gitignore +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/CLAUDE.md +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/LICENSE +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/docs/yama-intro.html +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/pyproject.toml +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/references/install-upgrade.md +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_assertions.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_cli_shim.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_dashboard.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_llm.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_main_entrypoint.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_mocks.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_preview.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_public_api.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_run_plan.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_runner.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_skill_tool.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_tool_loader.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_usage.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/tests/test_workspace.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/uv.lock +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/__init__.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/__main__.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/assertions.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/dashboard.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/llm.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/loaders/__init__.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/loaders/common.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/mocks.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/models.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/preview.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/runner.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/tools/__init__.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/tools/base.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/tools/bash/__init__.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/tools/bash/_cli_shim.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/tools/skill/__init__.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/tools/skill/skill.py +0 -0
- {python_yama-0.7.0 → python_yama-0.9.0}/yama/workspace.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-yama
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
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
|
|
@@ -103,6 +103,7 @@ uv run --project yama yama --plugin dingding-simple --report
|
|
|
103
103
|
| `--list` | Only print the collected Cases, without running them |
|
|
104
104
|
| `--no-artifacts` | Write no artifact files at all |
|
|
105
105
|
| `--json` | Emit machine-readable JSON instead of Rich tables |
|
|
106
|
+
| `pr-run --upload-report --commit-id SHA` | With `--report`, upload the push report and merge/upload affected Plugin latest reports; requires `ADMIN_HOST` and `YAMA_EVAL_REPORT_API_TOKEN` |
|
|
106
107
|
|
|
107
108
|
`--plugin`, `--all-plugins`, and `--plugin-root` are mutually exclusive. When none of them is given, yama walks up from the current directory to the nearest directory containing `yama.toml` and uses it as the workspace root (falling back to the cwd), running it as a single plugin root.
|
|
108
109
|
|
|
@@ -114,6 +115,21 @@ uv run --project yama yama dashboard --plugin dingding-simple
|
|
|
114
115
|
|
|
115
116
|
`yama dashboard` starts a local HTTP server (default `http://127.0.0.1:8765/`, change with `--host`/`--port`; it also accepts the same plugin selection flags as the main command plus `-k/--filter` and `--result-dir`). The index page lists the historical HTML reports accumulated under `.yama/reports/` (newest first, with the `latest` one flagged), `/reports/<name>` serves each report, and `/preview` renders the same case preview as `--preview` — re-collecting and re-resolving the case files on every refresh (collection errors render as an error page), so you can edit a Case YAML and just reload the browser. No LLM calls are ever made by the dashboard.
|
|
116
117
|
|
|
118
|
+
### PR evals
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uv run --project yama yama pr-plan --base origin/main --json
|
|
122
|
+
OPENAI_API_KEY=... uv run --project yama yama pr-run --base origin/main --report --json-summary yama-pr-summary.json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`yama pr-plan` selects PR-scoped eval cases without model calls. `yama pr-run` executes the same selection and writes a JSON summary for external CI jobs to render or upload; credentials stay in environment variables or `.env`, not CLI flags. `pr-run` always forces builtin bash execution to the Linux `linux-bubblewrap` sandbox, regardless of Case backend settings, so the runner must be Linux with `bwrap`/`bubblewrap` installed. See the [CI integration guide](https://github.com/world-sim-dev/yama/blob/main/docs/pr-evals-ci-integration.zh-CN.md) for workflow examples and the summary JSON contract.
|
|
126
|
+
|
|
127
|
+
For CI environments that publish reports to the Yama Eval Report service, add
|
|
128
|
+
`--upload-report --commit-id <sha>` together with `--report`. The command reads
|
|
129
|
+
`ADMIN_HOST` and `YAMA_EVAL_REPORT_API_TOKEN` from the environment, uploads the
|
|
130
|
+
current commit report, then updates each affected Plugin latest report by merging
|
|
131
|
+
the just-run cases into the previous remote Plugin report.
|
|
132
|
+
|
|
117
133
|
### Output
|
|
118
134
|
|
|
119
135
|
Cases run in parallel, up to 10 at a time by default (`--concurrency` changes the cap); runs within one case stay sequential, and results keep collection order regardless of completion order. While several cases run concurrently, a transient dashboard at the bottom of the terminal shows one row per case, updated in place — waiting, then a spinner with the run/step currently executing, then its ✓/✗ verdict — and each case's full run/step detail is printed above the dashboard as one block the moment it finishes, so blocks of different cases never interleave. With `--concurrency 1` (or a single collected case) it streams instead — a spinner marks the step currently executing (on a terminal), and each case, run, and assertion result is printed the moment it completes. Either way a per-case summary table closes the output, and with `--json` the progress stream goes to stderr so stdout stays valid JSON.
|
|
@@ -77,6 +77,7 @@ uv run --project yama yama --plugin dingding-simple --report
|
|
|
77
77
|
| `--list` | Only print the collected Cases, without running them |
|
|
78
78
|
| `--no-artifacts` | Write no artifact files at all |
|
|
79
79
|
| `--json` | Emit machine-readable JSON instead of Rich tables |
|
|
80
|
+
| `pr-run --upload-report --commit-id SHA` | With `--report`, upload the push report and merge/upload affected Plugin latest reports; requires `ADMIN_HOST` and `YAMA_EVAL_REPORT_API_TOKEN` |
|
|
80
81
|
|
|
81
82
|
`--plugin`, `--all-plugins`, and `--plugin-root` are mutually exclusive. When none of them is given, yama walks up from the current directory to the nearest directory containing `yama.toml` and uses it as the workspace root (falling back to the cwd), running it as a single plugin root.
|
|
82
83
|
|
|
@@ -88,6 +89,21 @@ uv run --project yama yama dashboard --plugin dingding-simple
|
|
|
88
89
|
|
|
89
90
|
`yama dashboard` starts a local HTTP server (default `http://127.0.0.1:8765/`, change with `--host`/`--port`; it also accepts the same plugin selection flags as the main command plus `-k/--filter` and `--result-dir`). The index page lists the historical HTML reports accumulated under `.yama/reports/` (newest first, with the `latest` one flagged), `/reports/<name>` serves each report, and `/preview` renders the same case preview as `--preview` — re-collecting and re-resolving the case files on every refresh (collection errors render as an error page), so you can edit a Case YAML and just reload the browser. No LLM calls are ever made by the dashboard.
|
|
90
91
|
|
|
92
|
+
### PR evals
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
uv run --project yama yama pr-plan --base origin/main --json
|
|
96
|
+
OPENAI_API_KEY=... uv run --project yama yama pr-run --base origin/main --report --json-summary yama-pr-summary.json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`yama pr-plan` selects PR-scoped eval cases without model calls. `yama pr-run` executes the same selection and writes a JSON summary for external CI jobs to render or upload; credentials stay in environment variables or `.env`, not CLI flags. `pr-run` always forces builtin bash execution to the Linux `linux-bubblewrap` sandbox, regardless of Case backend settings, so the runner must be Linux with `bwrap`/`bubblewrap` installed. See the [CI integration guide](https://github.com/world-sim-dev/yama/blob/main/docs/pr-evals-ci-integration.zh-CN.md) for workflow examples and the summary JSON contract.
|
|
100
|
+
|
|
101
|
+
For CI environments that publish reports to the Yama Eval Report service, add
|
|
102
|
+
`--upload-report --commit-id <sha>` together with `--report`. The command reads
|
|
103
|
+
`ADMIN_HOST` and `YAMA_EVAL_REPORT_API_TOKEN` from the environment, uploads the
|
|
104
|
+
current commit report, then updates each affected Plugin latest report by merging
|
|
105
|
+
the just-run cases into the previous remote Plugin report.
|
|
106
|
+
|
|
91
107
|
### Output
|
|
92
108
|
|
|
93
109
|
Cases run in parallel, up to 10 at a time by default (`--concurrency` changes the cap); runs within one case stay sequential, and results keep collection order regardless of completion order. While several cases run concurrently, a transient dashboard at the bottom of the terminal shows one row per case, updated in place — waiting, then a spinner with the run/step currently executing, then its ✓/✗ verdict — and each case's full run/step detail is printed above the dashboard as one block the moment it finishes, so blocks of different cases never interleave. With `--concurrency 1` (or a single collected case) it streams instead — a spinner marks the step currently executing (on a terminal), and each case, run, and assertion result is printed the moment it completes. Either way a per-case summary table closes the output, and with `--json` the progress stream goes to stderr so stdout stays valid JSON.
|
|
@@ -77,6 +77,7 @@ uv run --project yama yama --plugin dingding-simple --report
|
|
|
77
77
|
| `--list` | 只打印匹配到的 Case,不运行 |
|
|
78
78
|
| `--no-artifacts` | 不写任何产物文件 |
|
|
79
79
|
| `--json` | 输出机器可读 JSON 而不是 Rich 表格 |
|
|
80
|
+
| `pr-run --upload-report --commit-id SHA` | 与 `--report` 一起使用:上传 push 报告,并合并/上传受影响 Plugin 的 latest 报告;需要 `ADMIN_HOST` 和 `YAMA_EVAL_REPORT_API_TOKEN` |
|
|
80
81
|
|
|
81
82
|
`--plugin`/`--all-plugins`/`--plugin-root` 三者互斥;都不提供时默认用当前目录向上搜索到的 `yama.toml` 所在目录作为 Workspace Root(找不到则用 cwd),把该目录当作单一 Plugin Root 运行。
|
|
82
83
|
|
|
@@ -88,6 +89,20 @@ uv run --project yama yama dashboard --plugin dingding-simple
|
|
|
88
89
|
|
|
89
90
|
`yama dashboard` 启动一个本地 HTTP 服务(默认 `http://127.0.0.1:8765/`,可用 `--host`/`--port` 调整;同样接受主命令的 Plugin 选择参数以及 `-k/--filter`、`--result-dir`)。首页列出 `.yama/reports/` 下累积的历史 HTML 报告(时间倒序,标注 `latest` 指向的那份),`/reports/<name>` 提供各报告文件,`/preview` 渲染与 `--preview` 相同的用例预览页——每次刷新都重新收集、重新解析 Case 文件(收集失败会渲染成错误页),改完 Case YAML 刷新浏览器即可看到效果。dashboard 不会发起任何 LLM 调用。
|
|
90
91
|
|
|
92
|
+
### PR eval
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
uv run --project yama yama pr-plan --base origin/main --json
|
|
96
|
+
OPENAI_API_KEY=... uv run --project yama yama pr-run --base origin/main --report --json-summary yama-pr-summary.json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`yama pr-plan` 只计算 PR 范围内要跑的 eval,不发起模型调用。`yama pr-run` 执行同一套选择逻辑,并写出供外部 CI 渲染或上传的 JSON summary;凭据继续通过环境变量或 `.env` 提供,不增加 CLI 参数。`pr-run` 会忽略 Case 里的 backend 设置,固定把内置 bash 执行强制为 Linux `linux-bubblewrap` 沙箱,因此 runner 必须是 Linux 且安装 `bwrap`/`bubblewrap`。CI workflow 示例和 summary JSON 契约见 [CI 接入指南](docs/pr-evals-ci-integration.zh-CN.md)。
|
|
100
|
+
|
|
101
|
+
CI 需要把报告发布到 Yama Eval Report 服务时,在 `--report` 之外加
|
|
102
|
+
`--upload-report --commit-id <sha>`。命令从环境变量读取 `ADMIN_HOST` 和
|
|
103
|
+
`YAMA_EVAL_REPORT_API_TOKEN`,先上传当前 commit 报告,再把本次运行到的 Case 合并进
|
|
104
|
+
对应 Plugin 的远端 latest 报告并上传。
|
|
105
|
+
|
|
91
106
|
### 输出
|
|
92
107
|
|
|
93
108
|
Case 之间并行执行,默认最多同时 10 个(用 `--concurrency` 调整上限);同一 Case 内的多个 run 仍顺序执行,结果始终保持收集顺序,与完成先后无关。多个 Case 并发运行时,终端底部会有一张原地刷新的状态面板,每个 Case 固定占一行——排队等待、转圈显示当前执行到的 Run/Step、完成后原地翻成 ✓/✗——任何一个 Case 一完成,它的完整 Run/Step 明细就作为一个整块打印到面板上方,不同 Case 的块不会交错。使用 `--concurrency 1`(或只收集到一个 Case)时则实时流式输出——正在执行的 Step 会显示转圈的 loading 状态(终端下),每个 Case、Run、断言一完成就立即打印结果。两种模式最后都以逐 Case 的汇总表格收尾;使用 `--json` 时进度流打印到 stderr,stdout 保持为纯 JSON。
|
|
@@ -188,7 +188,7 @@ vidmuse-plugins/
|
|
|
188
188
|
2. CLI 提供 `--plugin <name>`(可重复,一次运行多个 Plugin),从向上搜索到的 `yama.toml` 中解析。
|
|
189
189
|
3. CLI 提供 `--all-plugins`:运行 `yama.toml` 中 `[plugins.*]` 声明的全部 Plugin;若配置里没有任何 Plugin,直接报错 `"yama.toml has no configured plugins"`。
|
|
190
190
|
4. 都未提供时,向上搜索 `yama.toml` 所在目录作为 Workspace Root(找不到则退化为把当前 `cwd` 当作 Workspace Root),把 Workspace Root 本身当作单一 Plugin Root。
|
|
191
|
-
5. 确定的 Plugin Root 下不存在默认 System Prompt(`SYSTEM.md`,或该 Plugin 显式配置的文件名)时,在 collection 阶段报错 `"system prompt does not exist: ..."
|
|
191
|
+
5. 确定的 Plugin Root 下不存在默认 System Prompt(`SYSTEM.md`,或该 Plugin 显式配置的文件名)时,在 collection 阶段报错 `"system prompt does not exist: ..."`;但若 Case 的 `context.messages` 第一条就是 `role: system` 且 `content` 是非空字符串,则该记录里的 system message 直接作为最终 system prompt,不再读取或渲染默认 System Prompt 文件。
|
|
192
192
|
|
|
193
193
|
只做精确的名字查找(`plugin_name not in config.plugins` 直接报错 `"unknown plugin: ..."`),
|
|
194
194
|
不在多个候选 Plugin 之间进行模糊猜测。
|
|
@@ -235,7 +235,7 @@ Workspace Root(或 cwd 本身)作为单一 Plugin Root——这正是 `cd di
|
|
|
235
235
|
可行的原因。
|
|
236
236
|
|
|
237
237
|
**`yama dashboard` 子命令(`cli.py:_run_dashboard` + `dashboard.py`)。** 主命令之外
|
|
238
|
-
|
|
238
|
+
的浏览器预览子命令(`main()` 在 argv 首位是 `dashboard` 时分发到独立的
|
|
239
239
|
`_dashboard_parser`),启动一个本地 HTTP 服务(标准库 `ThreadingHTTPServer`,
|
|
240
240
|
无新增依赖):
|
|
241
241
|
|
|
@@ -264,6 +264,32 @@ yama dashboard --plugin dingding-simple --port 9000
|
|
|
264
264
|
Case 的人工预览回路:改 YAML → 刷新浏览器。收集/解析失败(YAML 损坏、
|
|
265
265
|
fixture 缺失等)时渲染成带完整错误信息的错误页(HTTP 500),服务本身不退出。
|
|
266
266
|
|
|
267
|
+
**`yama pr-plan` / `yama pr-run` 子命令(`cli.py:_run_pr_plan` / `_run_pr_run`)。**
|
|
268
|
+
`pr-plan` 只计算 PR 范围内要跑的 eval,不调用模型;它从
|
|
269
|
+
`git diff --name-status <base>...<head>` 或 `--changed-files` 读取变更文件,按
|
|
270
|
+
`yama.toml` 中的 Plugin 配置识别受影响 Plugin,选择直接变更的 Case 文件,以及
|
|
271
|
+
`<plugin>/__evals__/config.yaml` 里 `pull_request.cases` 配置的补充 Case。这里故意使用
|
|
272
|
+
三点 diff:比较 base/head 的 merge-base 到 head,贴近 PR 文件列表语义,避免把 PR 分支
|
|
273
|
+
分叉后只落在 base 分支上的变更也算进来。
|
|
274
|
+
|
|
275
|
+
`pr-run` 执行同一份 plan,并要求 `--json-summary PATH`。这个 summary 是 yama 侧给
|
|
276
|
+
外部 CI 的契约:CI 可以自己渲染 job summary、上传 `.yama/reports` / `.yama/runs` 或评论
|
|
277
|
+
PR,而不需要重新实现 yama 的选择逻辑。`pr-run --report` 对每个有选中 Case 的 Plugin
|
|
278
|
+
仍把 HTML 报告写在 `<plugin>/.yama/reports/`,run 证据写在 `<plugin>/.yama/runs/`;
|
|
279
|
+
collection/resolve 阶段失败也会写入 summary 的 `errors` 并以退出码 2 结束。`pr-run`
|
|
280
|
+
会忽略 Case 里对内置 bash backend 的设置(包括显式 `backend: none` 或
|
|
281
|
+
`macos-sandbox-exec`),统一强制为 `linux-bubblewrap`,因此这条命令面向 Linux CI
|
|
282
|
+
runner;环境必须提供 `bwrap`/`bubblewrap`。普通 `yama` 运行仍按 Case 自己的
|
|
283
|
+
`mocks.fs.backend` / `auto` 规则解析,不受这个 PR 专用覆盖影响。`pr-run`
|
|
284
|
+
可能调用 LLM,凭据沿用既有模式:`main()` 先加载 `.env`,LiteLLM 从环境变量读取 provider
|
|
285
|
+
key;yama 不提供 `--api-key` 等命令行凭据参数。
|
|
286
|
+
|
|
287
|
+
`pr-run --report --upload-report --commit-id <sha>` 会额外上传远端报告;缺少
|
|
288
|
+
`ADMIN_HOST`、`YAMA_EVAL_REPORT_API_TOKEN`、`--report` 或合法 commit id 都是配置错误。
|
|
289
|
+
上传失败会写入 summary 的 `upload_errors` 或 `plugins[].upload_error`,并在没有 eval
|
|
290
|
+
fail 时让命令以退出码 2 结束;若同时存在 eval fail,退出码仍为 1。上传成功时 summary
|
|
291
|
+
写入 `remote_push_report_url` 和 `plugins[].remote_report_url`。
|
|
292
|
+
|
|
267
293
|
**Case 筛选(`-k/--filter`,`workspace.py:matches_case_filter`)。** 收集阶段
|
|
268
294
|
(`collect_case_paths`)在 glob/显式路径展开之后、YAML 解析之前,用 case key
|
|
269
295
|
(`case_key_for_path`:Case 路径相对 Plugin Root 的 POSIX 形式,Plugin Root 之外
|
|
@@ -538,6 +564,12 @@ context:
|
|
|
538
564
|
# file: prompts/alt-system.md
|
|
539
565
|
```
|
|
540
566
|
|
|
567
|
+
如果 `context.messages` 第一条就是 `role: system`,且 `content` 是非空字符串,
|
|
568
|
+
`resolve_case` 会直接使用这条消息作为最终 system prompt 和 `initial_messages[0]`。
|
|
569
|
+
这种模式用于复现已记录的模型请求;此时不会读取 `SYSTEM.md`/`context.system_prompt`
|
|
570
|
+
文件,也不会重新追加 `<available_skills>` catalog。`context.skills` 仍会被加载,用于
|
|
571
|
+
校验和解析 `{builtin: skill}` 等工具配置。
|
|
572
|
+
|
|
541
573
|
### 6.4 Skill Tool
|
|
542
574
|
|
|
543
575
|
`<available_skills>` 永远只包含 `name` 和 `description`,不存在正文注入模式。只要 Case 的 `context.skills` 非空,就必须在 `context.tools` 中显式声明 `{builtin: skill}`——或者声明一个自定义 Schema 的 Tool,并在它的 `mocks.tools` 条目里使用 `handler: {builtin: skill}`(见本节末尾);两者都缺失时在 collection 阶段失败(`"context.tools must include {builtin: skill} (or a tool whose mocks.tools entry uses handler: {builtin: skill}) when context.skills is non-empty"`)。这样每个 Case 都会测试真实的 Skill 查阅行为,不会因 Prompt 预先包含正文而绕过 Tool Call。
|
|
@@ -692,7 +724,7 @@ OpenAI Chat Completion 的 text/image_url/file part,或按 `delivery: file_pat
|
|
|
692
724
|
Responses API `input_text` 等 Provider/API 专用字段——`_resolve_message_parts` 会用
|
|
693
725
|
"允许字段白名单"拒绝任何多出的字段。
|
|
694
726
|
|
|
695
|
-
|
|
727
|
+
框架默认首先构造:
|
|
696
728
|
|
|
697
729
|
```python
|
|
698
730
|
messages = [
|
|
@@ -701,7 +733,9 @@ messages = [
|
|
|
701
733
|
]
|
|
702
734
|
```
|
|
703
735
|
|
|
704
|
-
其中 `initial_history` 来自 Case 的 `context.messages
|
|
736
|
+
其中 `initial_history` 来自 Case 的 `context.messages`。若 `context.messages[0]`
|
|
737
|
+
是非空字符串 content 的 system message,则框架改用这条消息作为第一条消息,不再额外
|
|
738
|
+
插入 `rendered_system_prompt`,以避免记录回放时出现两条 system message。
|
|
705
739
|
|
|
706
740
|
### 7.2 在 Context 中定义 Tools
|
|
707
741
|
|
|
@@ -1168,9 +1202,9 @@ Judge 使用的模型写在 `steps[].assert.judge.model` 或全局 Judge 配置
|
|
|
1168
1202
|
|
|
1169
1203
|
| 子字段 | 含义 |
|
|
1170
1204
|
| --- | --- |
|
|
1171
|
-
| `system_prompt` | 使用 Plugin 默认 System Prompt
|
|
1205
|
+
| `system_prompt` | 使用 Plugin 默认 System Prompt,或显式指定覆盖文件;若 `context.messages` 首条是非空字符串 content 的 system message,则该消息优先生效并跳过文件渲染。 |
|
|
1172
1206
|
| `skills` | 按声明顺序暴露的 Skill metadata;正文只能通过 `skill` Tool 读取。 |
|
|
1173
|
-
| `messages` | Step 开始前已经存在的 History Message。 |
|
|
1207
|
+
| `messages` | Step 开始前已经存在的 History Message;首条可为非空字符串 content 的 system message,用来回放已记录请求的原始 system prompt。 |
|
|
1174
1208
|
| `tools` | 发送给模型的内置 Tool 或 Tool Schema;`skills` 非空时必须包含 `{builtin: skill}`(或一个 Mock 使用 `handler: {builtin: skill}` 的自定义 Tool,见 6.4 节)。 |
|
|
1175
1209
|
| `builders` | 在 Case 开始前的三个位置(`after_system`/`before_history`/`after_history`)插入额外 Message(Schema 不做 collection 期校验,见 7.3 节)。Step 级/Tool Call 级的插入见 `steps[].message_inject`(8.6 节、7.6 节)。 |
|
|
1176
1210
|
|
|
@@ -1399,14 +1433,14 @@ mocks:
|
|
|
1399
1433
|
节点/规则级 `passthrough: true`(与 `stdout`/`stderr`/`exit_code` 互斥,同时出现在 collection 阶段失败;`cat: { passthrough: true }` 这种命令级简写其实是一条"无 `match` 的透传规则",并非独立字段——是统一规则/节点语法的自然产物)编译进该命令的规则树后,由 `yama.tools.bash._cli_shim` 在匹配到这条规则时执行 `os.execvpe`,把自己替换成真实二进制——`exec` 时使用的 `PATH` 来自会话环境变量 `YAMA_REAL_PATH`(真实系统 PATH,与 `.mockbin/` 无关),避免二次调用又绕回自己的 shadow 脚本。
|
|
1400
1434
|
|
|
1401
1435
|
- `mocks.cli.passthrough_timeout_seconds`(正数,默认 30):单条命令的超时时间;超时会杀掉整个进程组、重启一个新的沙箱会话(cwd 重置为初始值),以统一的 `BASH_TIMEOUT` 错误返回给模型——不再区分"mock 超时"和"透传超时",因为二者现在共用同一个执行引擎和同一个超时机制。仍受 `execution.timeout_seconds_per_step` 总预算约束。
|
|
1402
|
-
- 会话的工作目录是 8.4.3 节描述的隔离沙箱工作目录(`.yama/fs-runs/<case-key>/run-{run_index:03d}/`),不再是 Plugin
|
|
1436
|
+
- 会话的工作目录是 8.4.3 节描述的隔离沙箱工作目录(`.yama/fs-runs/<case-key>/run-{run_index:03d}/`),不再是 Plugin 根目录;普通 `yama` 运行下 `mocks.cli` 默认使用 `backend: none`(不做 OS 级隔离,`fs.py:compile_cli_config` 硬编码),因此像 `../escape.txt` 这样的写入不会被这一层拦截——它会落在沙箱工作目录的上一级(仍在框架自己的 `.yama/fs-runs/` 树内,不会碰到 Plugin 的真实源码目录),需要 OS 级写入边界时改用 `mocks.fs`,让 `backend: auto` 在 macOS/Linux 上选择对应 backend,或显式选择 `macos-sandbox-exec` / `linux-bubblewrap`。`yama pr-run` 是例外:它会把内置 bash 的执行 backend 统一覆盖为 `linux-bubblewrap`,包括由 `mocks.cli` 编译出来的执行配置。
|
|
1403
1437
|
- 透传是显式的安全逃生舱:开启后,模型产生的 Tool Call 会执行真实子进程,不再是纯确定性回放。建议只在本地联调、且信任模型不会拿到危险命令时启用;CI 或需要严格可重复结果的场景应保持默认关闭,逐个命令补齐 Mock。
|
|
1404
1438
|
|
|
1405
1439
|
#### 8.4.3 `mocks.fs`:真实沙箱工作区
|
|
1406
1440
|
|
|
1407
1441
|
`mocks.cli` 面向"我能枚举出每个命令每种参数组合"的场景;一旦 Case 需要模型执行**任意**命令——尤其是任意 Python 脚本——枚举式声明就不再可行,必须换成真实执行。`mocks.fs` 提供这条路径:为当前 Case run 声明一份初始文件树,物化成一个真实、隔离的工作目录,`bash` Tool 的命令在这个目录里用真实 shell 执行,而不是被框架解析/回放。
|
|
1408
1442
|
|
|
1409
|
-
`mocks.cli` 与 `mocks.fs` 底层是**同一套执行引擎**(`yama/tools/bash/fs.py` 的持久 shell 会话):区别只在于沙箱工作目录里预先放了什么——`mocks.fs.files`/`mocks.fs.bin` 是 Case 作者直接声明的内容,`mocks.cli` 是框架把声明式规则树编译成的 `.mockbin/` 脚本(8.4.1 节)。两者因此共享本节描述的生命周期、marker 协议、PATH shadow 机制、rlimit
|
|
1443
|
+
`mocks.cli` 与 `mocks.fs` 底层是**同一套执行引擎**(`yama/tools/bash/fs.py` 的持久 shell 会话):区别只在于沙箱工作目录里预先放了什么——`mocks.fs.files`/`mocks.fs.bin` 是 Case 作者直接声明的内容,`mocks.cli` 是框架把声明式规则树编译成的 `.mockbin/` 脚本(8.4.1 节)。两者因此共享本节描述的生命周期、marker 协议、PATH shadow 机制、rlimit/环境变量护栏;普通 `yama` 运行下差别仅是 `mocks.cli` 固定用 `backend: none`(不叠加 OS 级 backend),而 `mocks.fs` 默认 `backend: auto`;`yama pr-run` 会把二者统一覆盖为 `linux-bubblewrap`。会话环境变量里始终有 `YAMA_WORKSPACE`(沙箱工作目录绝对路径)、`YAMA_PYTHON`(运行 yama 的解释器路径)、`YAMA_REAL_PATH`(未叠加 `.mockbin/` 的真实系统 PATH,供节点/规则级 `passthrough: true` 或用户自己的 `mocks.fs.bin` 脚本按需 `exec` 真实二进制)。
|
|
1410
1444
|
|
|
1411
1445
|
`mocks.fs` 与 `mocks.cli` **互斥**:一个 Case 要么用 `mocks.cli` 换取完全确定性回放,要么用 `mocks.fs` 换取真实执行能力,二者同时声明在 collection 阶段报错(`"mocks.cli cannot be combined with mocks.fs"`);同样,`mocks.fs` 只在 Case 里存在 `handler: {builtin: bash}` Mock(`{builtin: bash}` 声明或自定义 Tool 指向 builtin handler)时生效,缺失时报错。声明了 `{builtin: bash}` 却用自定义 `mocks.tools.bash` Handler 覆盖其 Mock 时同样报错(`"mocks.fs cannot be combined with a custom mocks.tools.bash handler"`)。
|
|
1412
1446
|
|
|
@@ -1421,7 +1455,7 @@ mocks:
|
|
|
1421
1455
|
fs:
|
|
1422
1456
|
cwd: project # 可选,相对工作目录的初始 cwd,默认 ""(工作目录本身)
|
|
1423
1457
|
network: false # 可选,默认 false,是否放行沙箱内的网络访问
|
|
1424
|
-
backend: auto # 可选:auto(默认)| macos-sandbox-exec | none
|
|
1458
|
+
backend: auto # 可选:auto(默认)| macos-sandbox-exec | linux-bubblewrap | none
|
|
1425
1459
|
|
|
1426
1460
|
files: # 相对路径 -> 初始内容
|
|
1427
1461
|
project/README.md: |
|
|
@@ -1524,18 +1558,27 @@ printf '%s %d\n' '<marker>' "$__yama_ec__" 1>&2
|
|
|
1524
1558
|
|
|
1525
1559
|
读权限故意放宽——Python/bash/coreutils 依赖大量系统库、Homebrew/pyenv 路径,逐条收紧读权限在实践中会不断踩坑;真正的边界放在**写**(只能写工作目录)和**网络**(默认整体拒绝)上,读权限只对几类敏感目录做定向拒绝兜底。Seatbelt 的规则解析是"更具体的规则优先于更宽泛的规则",因此 `allow file-read*` 之后追加针对性的 `deny` 是 Seatbelt 里公认可行的写法。Profile 按 run 生成并写入 `.yama/fs-runs/.../sandbox.sb`,排查权限拒绝问题时可以直接读。
|
|
1526
1560
|
|
|
1527
|
-
`backend: auto`
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1561
|
+
**Linux 后端:`bubblewrap`。** `backend: auto` 在 Linux 上解析为 `linux-bubblewrap`,
|
|
1562
|
+
持久 shell 跑在 `bwrap`/`bubblewrap` 之下。命令参数使用 PID/IPC namespace,`network:
|
|
1563
|
+
false` 时加 `--unshare-net`,把宿主根目录只读挂载,把 yama 工作目录可写 bind 到同一路径,
|
|
1564
|
+
把 `/tmp` 和当前用户 `HOME` 覆盖成 tmpfs,并 `--chdir` 到 `mocks.fs.cwd` 指定的初始目录。
|
|
1565
|
+
这给 eval 提供写入边界和默认网络边界,同时保留足够的只读系统路径让 bash、Python 解释器
|
|
1566
|
+
和 `.mockbin` shim 正常运行。它不是面向任意不可信代码的强保密沙箱:宿主根目录大部分仍
|
|
1567
|
+
可只读访问,只是当前用户 HOME 被 tmpfs 遮住以避免常见凭据目录被读到。Linux runner 缺少
|
|
1568
|
+
`bwrap`/`bubblewrap` 二进制时会报
|
|
1569
|
+
`"mocks.fs.backend: linux-bubblewrap requires bubblewrap; install the bwrap package"`;
|
|
1570
|
+
Ubuntu 系 CI 里通常需要先安装 `bubblewrap` 包。
|
|
1571
|
+
|
|
1572
|
+
其他平台的 `backend: auto` 在 collection 阶段直接报错(`"mocks.fs has no sandboxing
|
|
1573
|
+
backend on this platform; set mocks.fs.backend: none to run without OS-level isolation"`),
|
|
1574
|
+
要求显式改成 `backend: none`。`backend: none` 完全不做 OS 级隔离,只是把 cwd 换成
|
|
1575
|
+
隔离的空工作目录,等价于 `mocks.cli.passthrough` 的加强版(换了执行根目录,别的都不保证)。
|
|
1576
|
+
`sandbox-exec` 已被 Apple 标注为 deprecated,未来某个 macOS 版本可能移除;`backend`
|
|
1577
|
+
字段保留这个可插拔的口子,是为了将来接入其他隔离机制时不需要改 Case Schema。
|
|
1535
1578
|
|
|
1536
1579
|
**轻量护栏(不是安全边界):** 不管选哪个 backend,框架都会做几件几乎零成本、也不依赖外部运行时的事——环境变量清洗(不整个继承 Runner 进程的环境,只带 `PATH`/`HOME`/`LANG`/`LC_ALL`/`TMPDIR`/`USER`/`SHELL` 白名单 + `mocks.fs.env` 追加项,避免宿主机的 API Key、云凭据泄漏进沙箱——注意 `mocks.fs.env` 是在 `YAMA_WORKSPACE`/`YAMA_PYTHON`/`YAMA_REAL_PATH` 这几个会话变量**之后**再 `update` 上去的,因此如果 Case 恰好在 `mocks.fs.env` 里声明了同名 key,会覆盖框架自己设置的值,这是原设计未提及的一个顺序细节)、`mocks.fs.limits` 对应的 `resource.setrlimit`(`RLIMIT_CPU`/`RLIMIT_AS`/`RLIMIT_NPROC`,防止失控的死循环或 fork bomb 拖垮跑 Case 的机器)、以及 run 结束时保证杀掉整个进程组,不留孤儿进程。这些是纵深防御,不是 Seatbelt 之外的独立安全边界;`backend: none` 时它们是唯一的保护。
|
|
1537
1580
|
|
|
1538
|
-
**使用边界:** `backend: none` 下,模型能访问网络、能读写工作目录之外的宿主机文件、能消耗不受限的 CPU/内存(直到 rlimit 触发)——只应该在信任被测模型、且相信不会主动执行破坏性操作的场景下使用。`backend: macos-sandbox-exec`
|
|
1581
|
+
**使用边界:** `backend: none` 下,模型能访问网络、能读写工作目录之外的宿主机文件、能消耗不受限的 CPU/内存(直到 rlimit 触发)——只应该在信任被测模型、且相信不会主动执行破坏性操作的场景下使用。`backend: macos-sandbox-exec` 和 `backend: linux-bubblewrap` 下写和网络有 OS 级边界,但读权限仍然不是完整保密边界,也不做 cgroup 级资源隔离(CPU/内存限制仍然只靠 rlimit)。这些 backend 都不适合面向任意不可信输入的强安全场景。
|
|
1539
1582
|
|
|
1540
1583
|
#### 8.4.4 `tools/bash/` 子系统内部关系
|
|
1541
1584
|
|
|
@@ -2737,6 +2780,16 @@ PASS)。`error_kind="llm"` 对应 LLM 请求异常和 Step 超时;`error_kin
|
|
|
2737
2780
|
统计,而不必解析报告正文标记。这里保留机器可读的 run/error 细分统计;报告正文顶部
|
|
2738
2781
|
只保留上面三张人工浏览用汇总卡片。
|
|
2739
2782
|
|
|
2783
|
+
远端报告上传由 `yama pr-run --report --upload-report --commit-id <sha>` 触发。命令从
|
|
2784
|
+
环境变量读取 `ADMIN_HOST` 和 `YAMA_EVAL_REPORT_API_TOKEN`,先上传当前 commit 的
|
|
2785
|
+
push HTML 报告,再对本次涉及的每个 Plugin 查询远端 latest 报告、读取其中的
|
|
2786
|
+
`<script type="application/json" id="yama-report-bundle">`,按 `case_key` 把本次运行到的
|
|
2787
|
+
Case 新增或覆盖进去,最后上传新的 Plugin latest HTML。`yama-report-meta` 继续服务本地
|
|
2788
|
+
dashboard;`yama-report-bundle` 是远端 Plugin latest 合并用的机器可读数据,包含
|
|
2789
|
+
Plugin、Case、最小渲染字段和 `CaseResult.to_dict()` 兼容结果。每个被本次 CI 新增或更新的
|
|
2790
|
+
Case 都写入 `updated_at_beijing`,格式为 `YYYY-MM-DD HH:MM:SS`,HTML 页面标明这是
|
|
2791
|
+
Beijing time;本次未运行的旧 Case 在 Plugin latest 中保留原 entry。
|
|
2792
|
+
|
|
2740
2793
|
**用例预览页(`preview.py`,`--preview` 与 dashboard `/preview` 共用)。**
|
|
2741
2794
|
`render_preview_html` 复用报告的页面外壳与版式(`report.py:render_page` +
|
|
2742
2795
|
`_PAGE_CSS`),渲染"这个 Case 将发送什么、期望什么",但不含任何执行数据——
|
|
@@ -590,14 +590,17 @@ stdout 直接拼接,需要换行要在配置的 `stdout` 字符串里自带 `\
|
|
|
590
590
|
| `cwd` | 相对路径字符串 | `""`(工作区根目录) | 会话启动时的初始工作目录,相对沙箱
|
|
591
591
|
工作区解析。不能是绝对路径,不能包含 `..`。 |
|
|
592
592
|
| `network` | boolean | `false` | 是否允许网络访问。默认拒绝,体现"评测环境不应依赖
|
|
593
|
-
外网"的原则;显式设为 `true`
|
|
594
|
-
|
|
595
|
-
| `backend` | `auto` \| `macos-sandbox-exec` \| `none` | `auto` | 沙箱隔离方式。
|
|
593
|
+
外网"的原则;显式设为 `true` 才放开(在 macOS `sandbox-exec` 与 Linux
|
|
594
|
+
`bubblewrap` backend 下有 OS 级网络隔离效果)。 |
|
|
595
|
+
| `backend` | `auto` \| `macos-sandbox-exec` \| `linux-bubblewrap` \| `none` | `auto` | 沙箱隔离方式。
|
|
596
596
|
`auto` 在 macOS 上等价于 `macos-sandbox-exec`(用 `sandbox-exec` 做文件读写/网络
|
|
597
597
|
层面的 OS 级隔离,并显式拒绝读取 `~/.ssh`、`~/.aws`、`~/.config/gcloud`、
|
|
598
|
-
`~/.gnupg`、`~/Library/Keychains`
|
|
599
|
-
`
|
|
600
|
-
|
|
598
|
+
`~/.gnupg`、`~/Library/Keychains` 等敏感目录);在 Linux 上等价于
|
|
599
|
+
`linux-bubblewrap`(需要 `bwrap`/`bubblewrap`,默认禁网、只读挂载宿主根目录、可写
|
|
600
|
+
bind yama 工作目录,并用 tmpfs 遮住当前用户 HOME)。其它平台上 `auto` 会直接报错,
|
|
601
|
+
要求显式选择 `none`(明确放弃 OS 级隔离,只依赖资源限制和 PATH shadow)。`yama pr-run`
|
|
602
|
+
是例外:它会忽略 Case 里的 backend 设置,统一强制内置 bash 使用
|
|
603
|
+
`linux-bubblewrap`,面向 Linux CI runner 运行。 |
|
|
601
604
|
| `files` | `{<相对路径>: <内容>}` | `{}` | 预置到工作区里的文件。路径不能是绝对路径
|
|
602
605
|
或包含 `..`。内容可以是字符串(直接写作文件内容)或 `{content: str, mode?: str}` /
|
|
603
606
|
`{file: <相对 __evals__ 的路径>, mode?: str}`(从磁盘固件读取,且该固件必须落在
|
|
@@ -20,7 +20,8 @@ yama eval。接到自然语言请求时,先把意图归到下面一类,再
|
|
|
20
20
|
|
|
21
21
|
- **“给这个 Skill/Plugin 加 yama 评测、回归覆盖、验证某行为”**:定位 Plugin Root、
|
|
22
22
|
目标 `SYSTEM.md`/Skill/Tool Schema,读取已有 `__evals__` 约定,新增或修改 Case;
|
|
23
|
-
用 `yama --preview` 验证 Case
|
|
23
|
+
用 `yama --preview` 验证 Case 展开;用户要运行 Case 时,默认在运行命令里加
|
|
24
|
+
`--report` 生成 HTML 报告。
|
|
24
25
|
- **“复现线上 thread / 从某次对话生成 eval”**:优先用 `yama from-thread` 生成
|
|
25
26
|
Case 骨架;LLM 只负责把用户信息转成要执行的 bash 命令,以及补齐 `mocks.tools`;
|
|
26
27
|
其它内容保留命令生成结果。不要把骨架当成完整可运行 Case。
|
|
@@ -72,7 +73,8 @@ Case 文件相对 Plugin Root 的路径就是它的唯一身份 `case_key`,不
|
|
|
72
73
|
4. 明确怎么判定通过:工具调用、参数、顺序、稳定文本用 hard check;创意质量、主观满足度、
|
|
73
74
|
差异化、是否遵循复杂意图用 judge。
|
|
74
75
|
5. 写完先跑 `yama --preview` 或 `yama --preview --json` 看展开后的 System Prompt、
|
|
75
|
-
Skill、Tool、Step 和 Mock
|
|
76
|
+
Skill、Tool、Step 和 Mock 是否符合预期;再运行目标 Case,运行命令默认加
|
|
77
|
+
`--report`。
|
|
76
78
|
|
|
77
79
|
一个 Case 按四段组织:`context`(模型看到什么)→ `mocks`(Tool Call 如何被执行)→
|
|
78
80
|
`steps`(依次发送的用户回合与断言)→ `outcome`(Case 级通过门槛):
|
|
@@ -228,7 +230,8 @@ Python >= 3.12。安装、升级、识别当前入口环境和网络受限重试
|
|
|
228
230
|
|
|
229
231
|
## 运行
|
|
230
232
|
|
|
231
|
-
以下命令假定 `yama`
|
|
233
|
+
以下命令假定 `yama` 已按上一节安装、可直接调用;运行 Case 默认加 `--report`
|
|
234
|
+
生成 HTML 报告,预览、列出和 dashboard 命令除外:
|
|
232
235
|
|
|
233
236
|
```bash
|
|
234
237
|
# 在 Plugin 根目录直接运行(默认收集 __evals__/cases/**/*.yaml)
|
|
@@ -240,13 +243,13 @@ OPENAI_API_KEY=... yama
|
|
|
240
243
|
yama --plugin <name> --report
|
|
241
244
|
|
|
242
245
|
# 只跑一个 Case;只列出会收集到哪些 Case
|
|
243
|
-
yama __evals__/cases/foo.yaml
|
|
246
|
+
yama __evals__/cases/foo.yaml --report
|
|
244
247
|
yama --list
|
|
245
248
|
|
|
246
249
|
# 按 case key(相对 Plugin Root 的路径)筛选要跑的 Case:
|
|
247
250
|
# 默认子串匹配,含 * ? [ 时按 fnmatch 通配符匹配;-k 可重复,命中任意一个即运行
|
|
248
|
-
yama -k smoke
|
|
249
|
-
yama -k "__evals__/cases/smoke/*.yaml" -k regress
|
|
251
|
+
yama -k smoke --report
|
|
252
|
+
yama -k "__evals__/cases/smoke/*.yaml" -k regress --report
|
|
250
253
|
|
|
251
254
|
# 不运行、不调 LLM,只解析 Case 生成用例预览(写 Case / Review 时用)
|
|
252
255
|
yama --preview # 写 .yama/reports/preview.html
|
|
@@ -270,6 +273,11 @@ FAIL;`130` 手动中断。HTML 报告顶部显示 `CASES PASSED`(pass Case
|
|
|
270
273
|
message(含 tool_calls);Case/Run/Step 层级仍展示 tool-loop LLM Request
|
|
271
274
|
耗时总和。
|
|
272
275
|
|
|
276
|
+
当仓库 CI 使用 `yama pr-run --report --upload-report --commit-id <sha>` 时,yama 会上传当前
|
|
277
|
+
commit 报告,并更新受影响 Plugin 的远端 latest 报告。Plugin latest 会保留旧 Case,并按
|
|
278
|
+
`case_key` 替换本次运行到的 Case;每个被更新的条目显示 `updated_at_beijing`,该时间是
|
|
279
|
+
北京时间。
|
|
280
|
+
|
|
273
281
|
## 排查不通过的用例
|
|
274
282
|
|
|
275
283
|
先分层,再看证据;详细现象、产物文件和专项排查见
|
{python_yama-0.7.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/references/case-schema.md
RENAMED
|
@@ -55,7 +55,7 @@ CLI 启动时会从当前目录向上查找并加载最近的 `.env` 文件(
|
|
|
55
55
|
|
|
56
56
|
| 子字段 | 含义 |
|
|
57
57
|
| --- | --- |
|
|
58
|
-
| `system_prompt` | `{default: true}` 用 Plugin 根目录 `SYSTEM.md`;或 `{file: prompts/alt.md}`(相对 `__evals__
|
|
58
|
+
| `system_prompt` | `{default: true}` 用 Plugin 根目录 `SYSTEM.md`;或 `{file: prompts/alt.md}`(相对 `__evals__`);若 `context.messages` 首条是非空字符串 content 的 system message,则该消息优先生效并跳过文件渲染 |
|
|
59
59
|
| `skills` | 按声明顺序暴露的 Skill 名列表;正文只能通过 `skill` Tool 读取 |
|
|
60
60
|
| `messages` | Step 开始前已存在的 History Message |
|
|
61
61
|
| `tools` | 发给模型的 Tool 列表;`skills` 非空时必须包含 `{builtin: skill}`(或一个 Mock 用 `handler: {builtin: skill}` 的自定义 Tool) |
|
|
@@ -280,7 +280,7 @@ mocks:
|
|
|
280
280
|
fs:
|
|
281
281
|
cwd: project # 初始 cwd,相对工作目录
|
|
282
282
|
network: false # 默认拒绝网络
|
|
283
|
-
backend: auto # macOS
|
|
283
|
+
backend: auto # macOS=sandbox-exec;Linux=bubblewrap;其它平台显式 none
|
|
284
284
|
files:
|
|
285
285
|
project/README.md: "# Demo\n"
|
|
286
286
|
project/src/main.py: { file: fixtures/main.py, mode: "0755" }
|
|
@@ -301,6 +301,12 @@ mocks:
|
|
|
301
301
|
- 单条命令超时(默认 30s;模型通过 bash Tool 的 `timeout_seconds` 参数请求更短
|
|
302
302
|
超时会生效,超过配置上限被钳到上限)→ `BASH_TIMEOUT` 错误返回给模型并重启会话。
|
|
303
303
|
- 会话内可用环境变量:`YAMA_WORKSPACE`、`YAMA_PYTHON`、`YAMA_REAL_PATH`。
|
|
304
|
+
- `yama pr-run` 面向 Linux CI runner:它会忽略 Case 里的 backend 设置,统一强制内置
|
|
305
|
+
bash 使用 `linux-bubblewrap`。因此 PR CI 环境必须安装 `bwrap`/`bubblewrap`;普通
|
|
306
|
+
`yama` 运行仍按这里声明的 `backend` / `auto` 规则执行。
|
|
307
|
+
- 远端 Plugin latest 报告里的 Case 身份就是 `case_key`(相对 Plugin Root 的 Case 路径)。
|
|
308
|
+
`yama pr-run --report --upload-report --commit-id <sha>` 合并远端报告时,会用相同
|
|
309
|
+
`case_key` 的本次运行结果替换旧条目,未运行到的旧 Case 保留。
|
|
304
310
|
|
|
305
311
|
## execution
|
|
306
312
|
|
{python_yama-0.7.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/references/debugging.md
RENAMED
|
@@ -55,6 +55,11 @@ Step 超时)的具体 `LLM error` / `Framework error` 文本显示在对应 Ca
|
|
|
55
55
|
还没有运行结果、只想人工确认 Case 配置本身时,用 `yama --preview`(或 dashboard
|
|
56
56
|
的 `/preview` 页,刷新即重新解析)生成不含执行数据的用例预览。
|
|
57
57
|
|
|
58
|
+
CI 若开启 `yama pr-run --report --upload-report --commit-id <sha>`,上传失败也是 CI 失败。
|
|
59
|
+
先看 `yama-pr-summary.json`:`upload_errors` 表示 push 报告上传失败,
|
|
60
|
+
`plugins[].upload_error` 表示 Plugin latest 查询、合并或上传失败;上传成功时对应 URL 在
|
|
61
|
+
`remote_push_report_url` 和 `plugins[].remote_report_url`。
|
|
62
|
+
|
|
58
63
|
## 第 1 层:Collection error(退出码 2)
|
|
59
64
|
|
|
60
65
|
用例在收集/解析阶段就被拒绝,一条也没运行。若 stderr 打印的是
|
|
@@ -64,7 +69,7 @@ Step 超时)的具体 `LLM error` / `Framework error` 文本显示在对应 Ca
|
|
|
64
69
|
|
|
65
70
|
| 错误消息(关键词) | 原因与修法 |
|
|
66
71
|
| --- | --- |
|
|
67
|
-
| `system prompt does not exist` | Plugin Root 下没有 `SYSTEM.md`(或配置的文件名);确认 `--plugin-root`/cwd
|
|
72
|
+
| `system prompt does not exist` | Plugin Root 下没有 `SYSTEM.md`(或配置的文件名);确认 `--plugin-root`/cwd 是否指对了目录。若 Case 是回放线上请求,也可以把 `context.messages` 第一条写成非空 `role: system`,直接使用记录里的 System Prompt |
|
|
68
73
|
| `unknown plugin: ...` | `--plugin` 名字不在 `yama.toml` 的 `[plugins.*]` 里,只做精确匹配 |
|
|
69
74
|
| `context tools have no mock handlers: [...]` | `context.tools` 声明了但 `mocks.tools` 缺同名条目 |
|
|
70
75
|
| `mock handlers are not exposed in context.tools: [...]` | `mocks.tools` 多出了未声明的 Tool;两个集合必须完全相等 |
|
|
@@ -76,7 +81,8 @@ Step 超时)的具体 `LLM error` / `Framework error` 文本显示在对应 Ca
|
|
|
76
81
|
| `mocks.cli/fs requires a builtin bash handler` | 有 `mocks.cli`/`mocks.fs` 但没有任何 Mock 走内置 bash 执行;声明 `{builtin: bash}` 或写 `handler: {builtin: bash}` |
|
|
77
82
|
| `... must declare a required 'command'/'name' property` | 自定义 Schema 接 `handler: {builtin: ...}` 时,参数缺内置 Handler 必需的 required 属性(bash: `command`;skill: `name`) |
|
|
78
83
|
| `unknown builtin handler` / `builtin handler cannot contain other fields` | `handler: {builtin: ...}` 只支持 `skill`/`bash`,且旁边不能有 `with` 等其他字段 |
|
|
79
|
-
| `
|
|
84
|
+
| `linux-bubblewrap requires bubblewrap` | Linux runner 需要 bubblewrap 但环境里缺少 `bwrap`。运行 `yama pr-run` 时必须安装 `bubblewrap` 包;普通 `yama` 运行只有在 Case 明确接受无 OS 级隔离时才考虑显式设置 `mocks.fs.backend: none` |
|
|
85
|
+
| `mocks.fs has no sandboxing backend on this platform` | 当前平台没有默认 OS 级 backend;仅在 Case 明确接受无 OS 级隔离时显式设置 `backend: none` |
|
|
80
86
|
| `a matcher must use exactly one operation` | 一条 match 规则里写了 0 个或多个操作符 |
|
|
81
87
|
| Python handler/checker 相关 | 引用缺 `:callable`、目标不存在/不可调用/签名不兼容、路径逃出 Plugin Root |
|
|
82
88
|
| `No eval cases collected.` | glob 没命中任何文件;用 `--list` 验证收集范围,确认文件在 `__evals__/cases/**/*.yaml` 下 |
|