Add deferred MCP reprojection for the next regular turn (#61356)

## What changed

Add `CodexThread::reproject_mcp_on_next_turn()` to request an MCP reprojection after `TurnStarted` and before tools are bound. Repeated requests coalesce, and idle reconciliation or prewarming leaves the request pending until the next regular turn.

## Testing

Add coverage for deferred requests surviving prewarm and idle reconciliation, coalescing into one reprojection, and exposing refreshed tools in the turn's first model request. Verify that discovery starts after `TurnStarted`.

GitOrigin-RevId: 260b2381013291a47eb9a7f736c129de76c5897f
This commit is contained in:
Krish Chainani
2026-11-13 18:52:09 +00:00
committed by copyberry
parent 76a8ca3914
commit ae12a9d645
7 changed files with 186 additions and 4 deletions
+6
View File
@@ -1276,6 +1276,12 @@ impl CodexThread {
self.session.hooks().list_with_environment_hooks(sources)
}
/// Rebuilds the MCP projection on the next regular turn, after turn start and before
/// tools are bound. Repeated requests coalesce without starting a background refresh.
pub fn reproject_mcp_on_next_turn(&self) {
self.session.reproject_mcp_on_next_turn();
}
/// Observes this thread's published MCP connections that match the requested config.
pub async fn mcp_connection_statuses(
&self,