mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Track cumulative MCP attribution across requests and thread history (#47081)
## What changed - Record each MCP source and its first turn, including connector and plugin identifiers when available. Cover direct and Code Mode calls, including returned errors and results that are not printed. - Persist cumulative attribution checkpoints and restore them across compaction, resume, and forks, including forks limited to recent turns. - Attach fresh attribution to Responses API `client_metadata` under `mcp_attribution`, outside model-visible content. Restrict transmission to allowed OpenAI HTTPS destinations for both HTTP and WebSocket requests. - Report `attribution_error` for legacy history without checkpoints, malformed or conflicting attribution, and serialized attribution exceeding 16 KiB. ## Testing Add coverage for source deduplication, checkpoint persistence and restoration, recent-turn forks, direct and Code Mode calls, destination filtering, and the serialized size limit. GitOrigin-RevId: fd285e152ca9e24bfa000debb20013709d67a86e
This commit is contained in:
@@ -64,6 +64,18 @@ pub async fn history_with_tool_call_metadata(
|
||||
items
|
||||
}
|
||||
|
||||
/// Returns the recorder state used by the next session metadata snapshot.
|
||||
/// This does not change destination filtering or issue a request.
|
||||
pub fn mcp_attribution_snapshot(
|
||||
thread: &crate::CodexThread,
|
||||
) -> codex_protocol::mcp::McpAttribution {
|
||||
thread
|
||||
.session
|
||||
.services
|
||||
.executed_tool_calls
|
||||
.mcp_attribution_snapshot()
|
||||
}
|
||||
|
||||
/// Test-only provider that supplies no user instructions.
|
||||
#[derive(Debug, Default)]
|
||||
pub struct EmptyUserInstructionsProvider;
|
||||
|
||||
Reference in New Issue
Block a user