fix: preserve exploration demonstration source and recording scope

This commit is contained in:
chenmingxuan committed 2026-10-18 23:20:50 +08:00
1 parent f4cb55c030
commit 973ccae679
22 files changed
+624 -55

No files matched your search

+39
View File
@@ -82,6 +82,45 @@ async def test_generation_is_idempotent_and_preserves_rerun_independence(synthes
model.with_structured_output.return_value.ainvoke.assert_awaited_once()
@pytest.mark.asyncio
async def test_case_synthesis_receives_legacy_demonstration_platform(synthesis):
repository, session, run, model = synthesis
repository.database.put(
"exploration_demo",
"old-computer-demo",
{
"id": "old-computer-demo",
"exploration_id": session["id"],
"run_id": run["id"],
"source": "computer",
"status": "completed",
"media": [{"kind": "computer"}],
},
)
repository.add_message(
session["id"],
"浏览器中查看设置后返回首页",
"old-summary",
role="assistant",
metadata={"kind": "demonstration", "demonstration_id": "old-computer-demo"},
)
await generate_case(
repository, session["id"], "generate", run["id"], 0, ctx=SimpleNamespace(task_control=None)
)
messages = model.with_structured_output.return_value.ainvoke.await_args.args[0]
content = json.loads(messages[1].content)
assert content["demonstrations"] == [
{
"id": "old-computer-demo",
"run_id": run["id"],
"source": "computer",
"recorded_sources": ["computer"],
}
]
assert "不能用手机上的成功证明电脑步骤完成" in messages[0].content
assert repository.run(run["id"])["outcome"]["test_result"]["status"] == "passed"
@pytest.mark.asyncio
async def test_synthesis_repairs_unbound_parameters_once_with_original_evidence(synthesis):
repository, session, run, model = synthesis