fix: disable review rollout filtering (#7371)
This commit is contained in:
parent
40006808a3
commit
a421eba31f
2 changed files with 18 additions and 23 deletions
|
|
@ -71,7 +71,6 @@ impl ContextManager {
|
|||
// With extra response items filtered out and GhostCommits removed.
|
||||
pub(crate) fn get_history_for_prompt(&mut self) -> Vec<ResponseItem> {
|
||||
let mut history = self.get_history();
|
||||
history.retain(|item| !is_review_rollout_item(item));
|
||||
Self::remove_ghost_snapshots(&mut history);
|
||||
history
|
||||
}
|
||||
|
|
@ -250,15 +249,6 @@ fn is_api_message(message: &ResponseItem) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_review_rollout_item(item: &ResponseItem) -> bool {
|
||||
matches!(item,
|
||||
ResponseItem::Message {
|
||||
id: Some(id),
|
||||
..
|
||||
} if id.starts_with("review:rollout:")
|
||||
)
|
||||
}
|
||||
|
||||
fn estimate_reasoning_length(encoded_len: usize) -> usize {
|
||||
encoded_len
|
||||
.saturating_mul(3)
|
||||
|
|
|
|||
|
|
@ -599,11 +599,10 @@ async fn review_input_isolated_from_parent_history() {
|
|||
server.verify().await;
|
||||
}
|
||||
|
||||
/// After a review thread finishes, its conversation should not leak into the
|
||||
/// parent session. A subsequent parent turn must not include any review
|
||||
/// messages in its request `input`.
|
||||
/// After a review thread finishes, its conversation should be visible in the
|
||||
/// parent session so later turns can reference the results.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn review_history_does_not_leak_into_parent_session() {
|
||||
async fn review_history_surfaces_in_parent_session() {
|
||||
skip_if_no_network!();
|
||||
|
||||
// Respond to both the review request and the subsequent parent request.
|
||||
|
|
@ -666,20 +665,26 @@ async fn review_history_does_not_leak_into_parent_session() {
|
|||
let last_text = last["content"][0]["text"].as_str().unwrap();
|
||||
assert_eq!(last_text, followup);
|
||||
|
||||
// Ensure no review-thread content leaked into the parent request
|
||||
let contains_review_prompt = input
|
||||
.iter()
|
||||
.any(|msg| msg["content"][0]["text"].as_str().unwrap_or_default() == "Start a review");
|
||||
// Ensure review-thread content is present for downstream turns.
|
||||
let contains_review_rollout_user = input.iter().any(|msg| {
|
||||
msg["content"][0]["text"]
|
||||
.as_str()
|
||||
.unwrap_or_default()
|
||||
.contains("User initiated a review task.")
|
||||
});
|
||||
let contains_review_assistant = input.iter().any(|msg| {
|
||||
msg["content"][0]["text"].as_str().unwrap_or_default() == "review assistant output"
|
||||
msg["content"][0]["text"]
|
||||
.as_str()
|
||||
.unwrap_or_default()
|
||||
.contains("review assistant output")
|
||||
});
|
||||
assert!(
|
||||
!contains_review_prompt,
|
||||
"review prompt leaked into parent turn input"
|
||||
contains_review_rollout_user,
|
||||
"review rollout user message missing from parent turn input"
|
||||
);
|
||||
assert!(
|
||||
!contains_review_assistant,
|
||||
"review assistant output leaked into parent turn input"
|
||||
contains_review_assistant,
|
||||
"review assistant output missing from parent turn input"
|
||||
);
|
||||
|
||||
server.verify().await;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue