Improve connector detection for migrated sessions (#36977)

## Why

Session IDs are derived from file stems and can repeat across projects. Keying
connector attribution only by session ID can therefore assign one session's
connectors to another session during a batched migration.

## What changed

- Preserve connector candidates by canonical source path until each imported
  session is annotated, then aggregate them for detection summaries.
- Resolve project-backed MCP tool calls from both `CallMcpTool` server IDs and
  `mcpDetails.serverName`, while requiring a match in project metadata.

## Testing

Add coverage for duplicate session stems, per-source connector results, and
both supported project-backed MCP tool-call formats.

GitOrigin-RevId: 10563d47c29673c07daa83be5f4e1a256740b901
This commit is contained in:
charlesgong-openai authored and copyberry committed 2026-08-04 21:45:28 +00:00
1 parent 1b90b1d16b
commit 1a5e152189
10 files changed
+546 -172

No files matched your search

@@ -133,6 +133,17 @@ impl ExternalAgentConfigService {
)
}
pub fn detect_session_connectors_by_source_path(
&self,
sessions: &[ExternalAgentSessionMigration],
) -> BTreeMap<PathBuf, Vec<DetectedConnectorCandidate>> {
self.source.detect_session_connectors_by_source_path(
sessions,
&self.connector_metadata_roots,
&self.external_agent_home,
)
}
pub fn codex_home(&self) -> &Path {
&self.codex_home
}