Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

feat: alias compaction (#7442)

jif-oai85e2fabc9fc6
diff --git a/codex-rs/protocol/src/models.rs b/codex-rs/protocol/src/models.rs
index b6bd92c6ea..daf98152d5 100644
--- a/codex-rs/protocol/src/models.rs
+++ b/codex-rs/protocol/src/models.rs
@@ -132,6 +132,7 @@ pub enum ResponseItem {
GhostSnapshot {
ghost_commit: GhostCommit,
},
+ #[serde(alias = "compaction")]
CompactionSummary {
encrypted_content: String,
},
@@ -537,6 +538,7 @@ mod tests {
use anyhow::Result;
use mcp_types::ImageContent;
use mcp_types::TextContent;
+ use pretty_assertions::assert_eq;
use tempfile::tempdir;
#[test]
@@ -650,6 +652,21 @@ mod tests {
Ok(())
}
+ #[test]
+ fn deserializes_compaction_alias() -> Result<()> {
+ let json = r#"{"type":"compaction","encrypted_content":"abc"}"#;
+
+ let item: ResponseItem = serde_json::from_str(json)?;
+
+ assert_eq!(
+ item,
+ ResponseItem::CompactionSummary {
+ encrypted_content: "abc".into(),
+ }
+ );
+ Ok(())
+ }
+
#[test]
fn roundtrips_web_search_call_actions() -> Result<()> {
let cases = vec![