Allow per-turn overrides for direct-only tool namespaces (#59481)

## What changed

- Add `direct_only_tool_namespaces` to `TurnStartOptions`. Omission inherits the thread configuration; an empty list clears direct-only routing for that turn. Steering ignores the option.
- Persist explicit overrides in turn context and restore them when recovering an interrupted turn, including turns started by standalone tool output.
- Keep subsequent turns and spawned or resumed child agents on the thread's routing defaults.

## Testing

Add coverage for routing changes across turns in Responses and Responses Lite, recovery without carrying overrides into subsequent turns, and child-agent inheritance.

GitOrigin-RevId: cea1a997424572d4cd372cd15b098626904c6796
This commit is contained in:
Henry Levy
2026-11-04 19:58:49 +00:00
committed by copyberry
parent 41cbd5b9b2
commit d78f68f8d1
24 changed files with 322 additions and 39 deletions
@@ -850,6 +850,7 @@ mod tests {
item: RolloutItem::TurnContext(TurnContextItem {
turn_id: Some((*turn_id).to_string()),
root_turn_id: None,
direct_only_tool_namespaces: None,
disabled_plugin_ids: None,
cwd: AbsolutePathBuf::from_absolute_path(tempdir.path())
.expect("absolute feedback rollout directory"),
@@ -68,6 +68,7 @@ fn turn_context_item(
RolloutItem::TurnContext(TurnContextItem {
turn_id: Some(turn_id.to_string()),
root_turn_id: None,
direct_only_tool_namespaces: None,
disabled_plugin_ids: None,
cwd: cwd(),
approval_policy,
@@ -694,12 +694,12 @@ impl TurnRequestProcessor {
.on_start(TurnStartOptions {
turn_trigger: params.turn_trigger,
parent_turn_id: params.parent_turn_id,
initiating_agent_path: None,
root_turn_id: params.root_turn_id,
final_output_json_schema: params.output_schema,
service_tier: params.service_tier_for_turn,
prompt_cache_ttl: None,
cyber_access_program: params.cyber_access_program.map(Into::into),
..Default::default()
})
.with_additional_context(additional_context)
.with_responses_metadata(params.responsesapi_client_metadata)