Extract connector runtime snapshot management (#32698)

## What changed

- Move the Codex Apps tool cache into a reusable `codex-connectors` runtime manager keyed by account and workspace.
- Represent cached tools as atomically published snapshots with refresh timestamps while preserving the newest accepted fetch generation.
- Harden disk persistence with bounded reads, atomic file replacement, and serialized writes so an older fetch cannot overwrite newer state.

## Testing

Add coverage for identity isolation, snapshot timestamps, oversized cache files, atomic replacement, and concurrent persistence ordering.

GitOrigin-RevId: 5ea2234469daae3abf54b030244c3251de62ca5a
This commit is contained in:
Matthew Zeng authored and copyberry committed 2026-07-13 05:02:52 +00:00
1 parent c888e8e75a
commit 2f7d89b141
20 files changed
+1028 -512

No files matched your search

@@ -1,4 +1,6 @@
use super::*;
use codex_connectors::ConnectorRuntimeManager;
use codex_mcp::ToolInfo;
const MCP_TOOL_THREAD_ID_META_KEY: &str = "threadId";
@@ -284,7 +286,7 @@ impl McpRequestProcessor {
mcp_config: codex_mcp::McpConfig,
auth: Option<CodexAuth>,
runtime_context: McpRuntimeContext,
codex_apps_tools_cache: codex_mcp::CodexAppsToolsCache,
codex_apps_tools_cache: ConnectorRuntimeManager<ToolInfo>,
) {
let result = Self::list_mcp_server_status_response(
request_id.request_id.to_string(),
@@ -304,7 +306,7 @@ impl McpRequestProcessor {
mcp_config: codex_mcp::McpConfig,
auth: Option<CodexAuth>,
runtime_context: McpRuntimeContext,
codex_apps_tools_cache: codex_mcp::CodexAppsToolsCache,
codex_apps_tools_cache: ConnectorRuntimeManager<ToolInfo>,
) -> Result<ListMcpServerStatusResponse, JSONRPCErrorError> {
let detail = match params.detail.unwrap_or(McpServerStatusDetail::Full) {
McpServerStatusDetail::Full => McpSnapshotDetail::Full,