Preserve app invocation context across MCP tool refreshes (#59991)

## What changed

Keep the advertised `_codex_apps.invocation_context` when an app's tool metadata refreshes on the same server connection, while using refreshed values for other metadata. If the invocation context changes on a different connection, skip the call as unavailable.

## Testing

Extend the code-mode compaction test to refresh app tools before resuming a cell and verify that calls retain the original invocation context while picking up the refreshed `resource_uri`.

GitOrigin-RevId: 1b6072faed74623994ea82035a6ed977451984a4
This commit is contained in:
fahad-OAI
2026-11-06 21:53:04 +00:00
committed by copyberry
parent 1a2f5babe8
commit 8fcabd75a0
5 changed files with 65 additions and 16 deletions
+6
View File
@@ -284,6 +284,12 @@ impl PreparedMcpCall {
self.tool_info.get()
}
/// Whether the server connection that issued the step's tools still owns this call.
pub fn uses_connection_from(&self, binding: &McpBinding) -> bool {
self.connections
.shares_server_connection(&binding.connections, &self.server_name)
}
/// Returns the configuration and approval authority captured with this client.
pub fn config(&self) -> &McpConfig {
&self.config