Add ability to attach extra files to feedback (#12370)

Allow clients to provide extra files.
This commit is contained in:
pakrym-oai
2026-02-20 14:26:14 -08:00
committed by GitHub
parent 9176f09cb8
commit 1bb7989b20
9 changed files with 58 additions and 13 deletions

View File

@@ -224,7 +224,7 @@ impl CodexLogSnapshot {
classification: &str,
reason: Option<&str>,
include_logs: bool,
rollout_path: Option<&std::path::Path>,
extra_log_files: &[PathBuf],
session_source: Option<SessionSource>,
) -> Result<()> {
use std::collections::BTreeMap;
@@ -317,11 +317,22 @@ impl CodexLogSnapshot {
}));
}
if let Some((path, data)) = rollout_path.and_then(|p| fs::read(p).ok().map(|d| (p, d))) {
for path in extra_log_files {
let data = match fs::read(path) {
Ok(data) => data,
Err(err) => {
tracing::warn!(
path = %path.display(),
error = %err,
"failed to read log attachment; skipping"
);
continue;
}
};
let fname = path
.file_name()
.map(|s| s.to_string_lossy().to_string())
.unwrap_or_else(|| "rollout.jsonl".to_string());
.unwrap_or_else(|| "extra-log.log".to_string());
let content_type = "text/plain".to_string();
envelope.add_item(EnvelopeItem::Attachment(Attachment {
buffer: data,