fix: ground Work reports in measurements

This commit is contained in:
wuyang
2026-07-26 17:00:23 +08:00
parent b49b93dcf7
commit f64380a0f4
2 changed files with 41 additions and 11 deletions
+11 -3
View File
@@ -11,6 +11,7 @@ from agent_platform.runtime.loop import (
AgentLoop,
deliverable_evidence_failure,
is_substantive_execution,
measurement_tokens,
non_source_execution_error,
normalize_write_file_content,
python_source_error,
@@ -77,7 +78,8 @@ def test_script_and_report_require_distinct_verified_artifacts() -> None:
written_source_paths={"benchmark.py"},
written_report_paths=set(),
reports_written_after_execution=set(),
verified_paths={"benchmark.py"},
report_grounding_required=True,
grounded_report_paths=set(),
)
== "Create a separate report file such as `report.md`."
)
@@ -88,12 +90,18 @@ def test_script_and_report_require_distinct_verified_artifacts() -> None:
written_source_paths={"benchmark.py"},
written_report_paths={"report.md"},
reports_written_after_execution={"report.md"},
verified_paths={"benchmark.py", "report.md"},
report_grounding_required=True,
grounded_report_paths={"report.md"},
)
is None
)
def test_measurement_tokens_only_capture_exact_numeric_measurements() -> None:
assert measurement_tokens("n=1000 elapsed=0.012345s score=4.7e-06") == {"0.012345", "4.7e-06"}
assert measurement_tokens("O(n²), version 3") == set()
def test_read_only_shell_commands_do_not_satisfy_execution_evidence() -> None:
assert not is_substantive_execution("exec", {"command": "cat report.txt"})
assert not is_substantive_execution("exec", {"command": "sed -n '1,20p' script.py"})
@@ -461,7 +469,7 @@ async def test_script_and_report_completion_requires_both_files(settings) -> Non
max_tool_output_chars=10_000,
).run(
spec=get_model_spec("work-light"),
messages=[{"role": "user", "content": "写脚本对比算法并给一个报告"}],
messages=[{"role": "user", "content": "一个脚本并给一个报告"}],
identity=UserIdentity("u1", "", "", "user"),
raw_user_jwt="jwt",
chat_id="script-report",