feat: inject run_id as cache_salt for per-epoch resampling (algo #10)
This commit is contained in:
@@ -94,6 +94,17 @@ def _invalid_tool_json() -> str:
|
||||
class TestAgentLoop:
|
||||
"""AgentLoop 推理循环引擎测试。"""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_forwards_cache_salt(self) -> None:
|
||||
"""AgentLoop.run(cache_salt=...) 透传到 llm.chat(算法 #10 跨 epoch 重采样)。"""
|
||||
llm = AsyncMock()
|
||||
llm.chat.return_value = _make_response(_submit_json())
|
||||
|
||||
loop = AgentLoop(llm=llm, max_steps=10)
|
||||
await loop.run("system", "user", _StubDispatcher(), cache_salt="run:e2")
|
||||
|
||||
assert llm.chat.call_args.kwargs["cache_salt"] == "run:e2"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_submit_answer_terminates_loop(self) -> None:
|
||||
"""submit_answer 终止循环 → finished, result=args, steps_used=1。"""
|
||||
|
||||
Reference in New Issue
Block a user