refactor(agent): reduce loop runner parameter plumbing

This commit is contained in:
chengyongru
2026-08-26 17:50:52 +08:00
committed by chengyongru
parent c62aec0175
commit a618e80887
14 changed files with 168 additions and 194 deletions
+14 -8
View File
@@ -135,10 +135,13 @@ async def test_loop_binds_request_context_for_tool_execution(tmp_path: Path) ->
await loop._run_agent_loop(
[],
runtime=runtime,
channel="slack",
chat_id="C123",
metadata=metadata,
session_key="slack:C123:111.222",
request_context=RequestContext(
channel="slack",
chat_id="C123",
session_key="slack:C123:111.222",
runtime=runtime,
metadata=metadata,
),
)
assert cron.contexts[-1] == {
@@ -233,10 +236,13 @@ async def test_agent_loop_restores_outer_request_context_after_runner_exception(
await loop._run_agent_loop(
[],
runtime=runtime,
channel="slack",
chat_id="C123",
session_key="slack:C123:111.222",
original_user_text=" unchanged user text ",
request_context=RequestContext(
channel="slack",
chat_id="C123",
session_key="slack:C123:111.222",
original_user_text=" unchanged user text ",
runtime=runtime,
),
)
assert current_request_context() is outer
finally: