Prepare MCP connections for coordinated OAuth refresh (#42128)

## What changed

- Add the under-development `mcp_oauth_refresh_coordination` feature and pin its selected refresh mode to each MCP connection.
- Treat the refresh mode as part of OAuth connection identity so runtime and MCP configuration refreshes reconnect when the mode changes.
- Keep legacy refresh behavior in builds where coordination is unavailable and emit a warning when coordinated mode is selected.

## Testing

- Cover connection replacement when the feature is toggled through both runtime and MCP configuration refresh paths.

GitOrigin-RevId: 89596150f0338e6ede0e712badecea4450831766
This commit is contained in:
Matthew Zeng
2026-09-01 20:26:57 +00:00
committed by copyberry
parent 7730edf62c
commit bd89ce67cc
15 changed files with 232 additions and 3 deletions
+16
View File
@@ -1883,6 +1883,14 @@ impl Session {
) {
warn!("failed to refresh MCP auth storage config: {err}");
}
if let Err(err) = config.features.set_enabled(
Feature::McpOAuthRefreshCoordination,
next_config
.features
.enabled(Feature::McpOAuthRefreshCoordination),
) {
warn!("failed to refresh MCP OAuth coordination config: {err}");
}
let config = Arc::new(config);
state.session_configuration.original_config_do_not_use = Arc::clone(&config);
self.mark_mcp_runtime_dirty();
@@ -1931,6 +1939,14 @@ impl Session {
) {
warn!("failed to refresh MCP auth storage config: {err}");
}
if let Err(err) = config.features.set_enabled(
Feature::McpOAuthRefreshCoordination,
next_config
.features
.enabled(Feature::McpOAuthRefreshCoordination),
) {
warn!("failed to refresh MCP OAuth coordination config: {err}");
}
state.session_configuration.original_config_do_not_use = Arc::new(config);
self.mark_mcp_runtime_dirty();
drop(state);