mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Simplify unified exec output snapshots (#39259)
## What changed - Return retained unified-exec output as one contiguous byte buffer. - Use the buffer directly for sandbox-denial checks, removing intermediate chunk aggregation and an unnecessary owned string conversion. - Update the output-retention test to assert the flattened snapshot. GitOrigin-RevId: 84eacee0166b86d3cb2d6a37e96125977fad0267
This commit is contained in:
1 parent
ecb8013dfa
commit
3006151ad4
4 files changed
+10
-33
No files matched your search
@@ -259,9 +259,9 @@ impl UnifiedExecProcess {
|
||||
self.terminate();
|
||||
}
|
||||
|
||||
async fn snapshot_output(&self) -> Vec<Vec<u8>> {
|
||||
async fn snapshot_output(&self) -> Vec<u8> {
|
||||
let guard = self.output.output_buffer.lock().await;
|
||||
guard.snapshot_chunks()
|
||||
guard.to_bytes()
|
||||
}
|
||||
|
||||
pub(crate) fn sandbox_type(&self) -> SandboxType {
|
||||
@@ -279,13 +279,9 @@ impl UnifiedExecProcess {
|
||||
)
|
||||
.await;
|
||||
|
||||
let collected_chunks = self.snapshot_output().await;
|
||||
let mut aggregated: Vec<u8> = Vec::new();
|
||||
for chunk in collected_chunks {
|
||||
aggregated.extend_from_slice(&chunk);
|
||||
}
|
||||
let aggregated_text = String::from_utf8_lossy(&aggregated).to_string();
|
||||
self.check_for_sandbox_denial_with_text(&aggregated_text)
|
||||
let aggregated = self.snapshot_output().await;
|
||||
let aggregated_text = String::from_utf8_lossy(&aggregated);
|
||||
self.check_for_sandbox_denial_with_text(aggregated_text.as_ref())
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user