Add workspace routing support for Responses requests (#45812)

## What changed

- Add an optional `WorkspaceRoutingResolver` to `AuthManager` and pass session configuration into routing lookups. Callers without a resolver retain existing routing behavior.
- Apply resolved backend origins and account routing overrides to eligible ChatGPT Responses HTTP requests and WebSocket handshakes. Preserve endpoint paths, validate routing values, and reject HTTP redirects for routed requests, including `NO_CONSTRAINT` routes.
- Key cached WebSocket connections by destination, routing header, and auth revision. Rebuild request setup after credential refreshes and reject account changes during setup or routing discovery.
- Serialize routing lookups per session and retain whether the session has previously been routed.

## Testing

Add tests for path preservation, provider exclusions, concurrent routing lookups, unavailable resolvers, workspace mismatches, redirect rejection, and credential refresh or account changes during request setup.

GitOrigin-RevId: 2b6609019e84a315745c94858955f3f16426fe7f
This commit is contained in:
acrognale-oai authored and copyberry committed 2026-09-16 00:20:40 +00:00
1 parent 8f9d0e4652
commit 58e2e8cf3c
28 files changed
+1003 -80

No files matched your search

+3
View File
@@ -136,6 +136,7 @@ async fn responses_stream_includes_subagent_header_on_review() {
/*concurrent_reasoning_summaries_enabled*/ false,
/*attestation_provider*/ None,
config.http_client_factory(),
config.workspace_routing_context(),
);
let responses_metadata = test_turn_responses_metadata(&client, thread_id, &session_source);
let mut client_session = client.new_session();
@@ -273,6 +274,7 @@ async fn responses_stream_includes_subagent_header_on_other() {
/*concurrent_reasoning_summaries_enabled*/ false,
/*attestation_provider*/ None,
config.http_client_factory(),
config.workspace_routing_context(),
);
let responses_metadata = test_turn_responses_metadata(&client, thread_id, &session_source);
let mut client_session = client.new_session();
@@ -395,6 +397,7 @@ async fn responses_respects_model_info_overrides_from_config() {
/*concurrent_reasoning_summaries_enabled*/ false,
/*attestation_provider*/ None,
config.http_client_factory(),
config.workspace_routing_context(),
);
let responses_metadata = test_turn_responses_metadata(&client, thread_id, &session_source);
let mut client_session = client.new_session();