From 9b3dfc57b35642cb5581975f7a612e26d90c7308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=20Alexander=20=F0=9F=91=91?= Date: Tue, 25 Aug 2026 21:14:13 -0500 Subject: [PATCH] fix: redact memory activity before audit Signed-off-by: Codex --- crates/worker/src/redact.rs | 42 +++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/crates/worker/src/redact.rs b/crates/worker/src/redact.rs index ebbb411..3764e20 100644 --- a/crates/worker/src/redact.rs +++ b/crates/worker/src/redact.rs @@ -91,6 +91,23 @@ pub fn sanitize_result(result: &mut SessionResult, live_tokens: &[&str]) { for limitation in &mut review.limitations { fix(limitation, live_tokens); } + if let Some(memory) = &mut result.memory_used { + for entry in &mut memory.read { + fix(&mut entry.id, live_tokens); + fix(&mut entry.scope, live_tokens); + } + for write in &mut memory.proposed { + fix(&mut write.key, live_tokens); + fix(&mut write.summary, live_tokens); + fix(&mut write.scope, live_tokens); + fix(&mut write.approval, live_tokens); + } + for rejected in &mut memory.rejected { + fix(&mut rejected.summary, live_tokens); + fix(&mut rejected.scope, live_tokens); + fix(&mut rejected.reason, live_tokens); + } + } } fn fix(text: &mut String, live_tokens: &[&str]) { @@ -141,9 +158,9 @@ fn redact_pattern( mod tests { use super::*; use coven_github_api::{ - CommitInfo, ReviewEvidenceStatus, ReviewFinding, ReviewMode, ReviewResult, - ReviewSeverity, ReviewTestRun, ReviewTestStatus, SessionResult, SessionStatus, - HEADLESS_CONTRACT_VERSION, + CommitInfo, MemoryEntryRef, MemoryUsed, ProposedMemory, RejectedMemory, + ReviewEvidenceStatus, ReviewFinding, ReviewMode, ReviewResult, ReviewSeverity, + ReviewTestRun, ReviewTestStatus, SessionResult, SessionStatus, HEADLESS_CONTRACT_VERSION, }; #[test] @@ -230,7 +247,24 @@ mod tests { limitations: vec![poison("limitation")], }, exit_reason: None, - memory_used: None, + memory_used: Some(MemoryUsed { + enabled: true, + read: vec![MemoryEntryRef { + id: poison("read-id"), + scope: poison("read-scope"), + }], + proposed: vec![ProposedMemory { + key: poison("write-key"), + summary: poison("write-summary"), + scope: poison("write-scope"), + approval: poison("approval"), + }], + rejected: vec![RejectedMemory { + summary: poison("rejected-summary"), + scope: poison("rejected-scope"), + reason: poison("rejected-reason"), + }], + }), }; sanitize_result(&mut result, &[tok]);