@@ -500,6 +500,44 @@ async def fake_run(invocation_context):
500500 assert captured_branches [0 ] is None
501501
502502
503+ @pytest .mark .asyncio
504+ async def test_single_turn_propagates_isolation_scope (
505+ request : pytest .FixtureRequest ,
506+ ):
507+ """Single-turn workflow node propagates isolation_scope to the agent."""
508+ agent = _make_agent (mode = 'single_turn' )
509+ wrapper = build_node (agent )
510+ captured_isolation_scopes = []
511+
512+ async def fake_run_async (invocation_context ):
513+ captured_isolation_scopes .append (invocation_context .isolation_scope )
514+ yield Event (
515+ invocation_id = 'inv' ,
516+ author = wrapper .name ,
517+ content = types .Content (parts = [types .Part (text = 'ok' )]),
518+ )
519+
520+ object .__setattr__ (wrapper , 'run_async' , fake_run_async )
521+
522+ # Use the helper to create a real InvocationContext
523+ ic = await create_parent_invocation_context (
524+ request .function .__name__ , wrapper
525+ )
526+
527+ # Create the parent context with isolation_scope
528+ ctx = Context (invocation_context = ic )
529+ ctx .isolation_scope = 'test-scope-123'
530+
531+ # Run the node
532+ events = [
533+ event async for event in wrapper ._run_impl (ctx = ctx , node_input = 'hi' )
534+ ]
535+
536+ assert len (events ) == 1
537+ assert events [0 ].content .parts [0 ].text == 'ok'
538+ assert captured_isolation_scopes == ['test-scope-123' ]
539+
540+
503541@pytest .mark .xfail (
504542 strict = True ,
505543 reason = (
0 commit comments