Skip to content

Commit 9edfacd

Browse files
committed
docs(safety): update README sample count to 40 and fix stale warning-override note
Two doc fixes after the ContextVar+_after fix and the 40-sample expansion: (1) acceptance table said '20 samples', actual is 40; (2) 'warning field may be overridden' is no longer true — _after merges safety_warning/safety_risk_level/safety_rule_ids into the tool result via ContextVar, surviving BaseFilter.run's handle() step.
1 parent df61807 commit 9edfacd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

examples/tool_safety/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ pytest tests/tool_safety/ -v
221221

222222
| issue 验收标准 | 结果 |
223223
|---|---|
224-
| 1. 样本可扫描并输出结构化报告 |20 条样本 + manifest |
224+
| 1. 样本可扫描并输出结构化报告 |40 条样本 + manifest(含 issue 要求的 12 类场景) |
225225
| 2. 高危检出率 ≥90%,误报率 ≤10% ||
226226
| 3. 读密钥/危险删除/非白名单外连 100% ||
227227
| 4. 500 行脚本 ≤1s ||
@@ -257,7 +257,7 @@ pytest tests/tool_safety/ -v
257257

258258
- 扫描**不会**阻止 tool 继续执行(`is_continue=True`
259259
- 完整结果仍写入 **审计 JSONL****OpenTelemetry** `tool.safety.*`
260-
- Filter 链路上的 warning 字段可能被后续 tool 返回值覆盖,**调用方不应依赖返回 dict 中的 warning**
260+
- `ToolSafetyFilter._after` 会通过 `ContextVar`warning 合并进 tool 实际返回值(`safety_warning` / `safety_risk_level` / `safety_rule_ids`),不会被 `BaseFilter.run` 的 handle 步骤覆盖;`BashTool` / `CodeExecutor` wrapper 因不经过 `BaseFilter` 链路,直接在拦截前写入返回值
261261
- 若要求 review 也必须拦截,请设置 `block_on_review=True`(Filter / BashTool / CodeExecutor 均支持)
262262

263263
---

0 commit comments

Comments
 (0)