Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions xtask/src/scenario_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16760,6 +16760,39 @@ mod tests {
path
}

/// What a run's export says about its own compaction and input estimate:
/// the fact the request markers cannot tell apart from a lost prompt.
fn compaction_evidence(out: &Path, arm: &str) -> String {
let path = out
.join("outputs")
.join(arm)
.join("case")
.join("run-0.timeline.jsonl");
let (mut statuses, mut estimates) = (Vec::new(), Vec::new());
if let Ok(export) = std::fs::read_to_string(&path) {
for line in export.lines() {
let Ok(value) = serde_json::from_str::<Value>(line) else {
continue;
};
let event = &value["event"];
match (event["type"].as_str(), event["name"].as_str()) {
(Some("context"), Some("compaction")) => statuses.push(format!(
"{} {}",
event["data"]["status"].as_str().unwrap_or("-"),
event["data"]["strategy"].as_str().unwrap_or("-")
)),
(Some("context"), Some("budget")) => estimates.push(
event["data"]["estimatedInputTokens"]
.as_f64()
.unwrap_or_default(),
),
_ => {}
}
}
}
format!("compactions={statuses:?} estimates={estimates:?}")
}

/// Both arms run the shipped assembly on the same scenario, and the
/// candidate text reaches the candidate arm's summarizer request and only
/// that arm's. The judge is the wide one: the run's message makes its view
Expand Down Expand Up @@ -16837,11 +16870,33 @@ mod tests {
}
let current = fixture.arm("current");
let candidate = fixture.arm("candidate");
// A current arm without a summarizer request means compaction did not
// run, not that the product prompt went missing; the failure states
// which requests each arm recorded.
let mut diagnosis = String::new();
for record in &records {
diagnosis.push_str(&format!("\nrecord {record}"));
}
for (arm, requests) in [("current", &current), ("candidate", &candidate)] {
diagnosis.push_str(&format!(
"\n{arm}: {} requests {}",
requests.len(),
compaction_evidence(&options.out, arm)
));
for request in requests.iter() {
diagnosis.push_str(&format!(
"\n summarizer={} candidate={} bytes={}",
request.contains("You summarize a coding session"),
request.contains("CANDIDATE SUMMARY PROMPT"),
request.len()
));
}
}
assert!(
current
.iter()
.any(|request| request.contains("You summarize a coding session")),
"the current arm's summarizer request carries the product prompt"
"the current arm's summarizer request carries the product prompt: {diagnosis}"
);
assert!(
current
Expand All @@ -16853,7 +16908,7 @@ mod tests {
candidate
.iter()
.any(|request| request.contains("CANDIDATE SUMMARY PROMPT")),
"the candidate arm's summarizer request carries the candidate text"
"the candidate arm's summarizer request carries the candidate text: {diagnosis}"
);
assert!(
candidate
Expand Down