mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve MCP resource origins across compaction (#39192)
## Why Compaction can remove the tool-call events that associate an MCP app widget with the tool, account, and URI needed to authorize later resource reads. ## What changed - Store a bounded MCP resource-origin checkpoint with each compacted rollout. - Restore the checkpoint when resuming a session so existing widgets remain readable after compaction and restart. - Discard saved origins when rollback rewrites history across the compaction boundary, and reject oversized or invalid checkpoints during restoration. ## Testing - Extend the app-server MCP resource-origin test to compact a paginated thread, continue the conversation, and read the original widgets before and after a restart. - Verify rollback clears provenance that no longer matches retained history. GitOrigin-RevId: 7f91c6202fe8d9be21c78dda42fa205937c44263
This commit is contained in:
1 parent
880f1135ea
commit
a397079287
22 files changed
+254
-18
No files matched your search
@@ -188,6 +188,7 @@ fn compacted_replacement_history_stores_metadata_in_an_aligned_sidecar() -> Resu
|
||||
},
|
||||
ResponseItemEnvelope::new(compaction_item.clone()),
|
||||
]),
|
||||
mcp_resource_origins: None,
|
||||
window_number: None,
|
||||
first_window_id: None,
|
||||
previous_window_id: None,
|
||||
@@ -289,6 +290,7 @@ fn compacted_metadata_remains_compatible_with_legacy_response_item_readers() ->
|
||||
let compacted_line = serde_json::to_value(RolloutItem::Compacted(CompactedItem {
|
||||
message: "summary".to_string(),
|
||||
replacement_history: Some(vec![envelope]),
|
||||
mcp_resource_origins: Some(McpResourceOriginCheckpoint::default()),
|
||||
window_number: None,
|
||||
first_window_id: None,
|
||||
previous_window_id: None,
|
||||
@@ -430,6 +432,7 @@ fn compacted_item_serializes_window_number_and_id() -> Result<()> {
|
||||
let item = CompactedItem {
|
||||
message: "summary".to_string(),
|
||||
replacement_history: None,
|
||||
mcp_resource_origins: None,
|
||||
window_number: Some(3),
|
||||
first_window_id: Some("019b3f6e-0000-7000-8000-000000000001".to_string()),
|
||||
previous_window_id: Some("019b3f6e-0000-7000-8000-000000000002".to_string()),
|
||||
@@ -462,6 +465,7 @@ fn compacted_item_migrates_legacy_numeric_window_id() -> Result<()> {
|
||||
CompactedItem {
|
||||
message: "summary".to_string(),
|
||||
replacement_history: None,
|
||||
mcp_resource_origins: None,
|
||||
window_number: Some(3),
|
||||
first_window_id: None,
|
||||
previous_window_id: None,
|
||||
|
||||
Reference in new issue
Block a user