mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Retain user instructions in Guardian context (#42844)
## Why Guardian reviews need the original user instructions even when compaction or transcript selection removes them from the active conversation window. ## What changed - Capture complete user messages in host-owned retained context and include them as ordered authorization evidence alongside verified answers. - Omit oversized instructions atomically and emit an explicit incomplete-evidence notice instead of exposing a potentially misleading partial permission. - Mark user messages inherited by forked agents so they remain model-visible without becoming child-local authorization. ## Testing - Cover retained instructions across compaction, resume, rollback, and agent forks, including oversized evidence and legacy context behavior. GitOrigin-RevId: 97122509d818c90d2f87c6a1b29c99c05ad0316e
This commit is contained in:
@@ -196,16 +196,27 @@ async fn request_user_input_sets_non_blocking_outside_plan_mode(
|
||||
.expect("request_user_input handler should succeed");
|
||||
assert!(output.success_for_logging());
|
||||
let history = session.conversation_history_snapshot().await;
|
||||
let RenderedVerifiedAnswers {
|
||||
fragments,
|
||||
complete,
|
||||
} = codex_guardian_context::render_verified_answers(
|
||||
history.retained_context().expect("host context snapshot"),
|
||||
);
|
||||
if thread_context_enabled {
|
||||
let RenderedVerifiedAnswers {
|
||||
fragments,
|
||||
complete,
|
||||
} = codex_guardian_context::render_verified_answers(
|
||||
history.retained_context().expect("host context snapshot"),
|
||||
);
|
||||
let expected_fragments = expected
|
||||
.fragments
|
||||
.iter()
|
||||
.map(|fragment| {
|
||||
if expected.complete {
|
||||
format!("Retained source order: 0\n{fragment}")
|
||||
} else {
|
||||
fragment.clone()
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(
|
||||
(&fragments, complete),
|
||||
(&expected.fragments, expected.complete)
|
||||
(&expected_fragments, expected.complete)
|
||||
);
|
||||
} else {
|
||||
assert_eq!(
|
||||
@@ -239,7 +250,11 @@ async fn request_user_input_sets_non_blocking_outside_plan_mode(
|
||||
}
|
||||
_ => assert_eq!(
|
||||
legacy_answer,
|
||||
fragments.first().cloned().filter(|_| complete)
|
||||
expected
|
||||
.fragments
|
||||
.first()
|
||||
.cloned()
|
||||
.filter(|_| expected.complete)
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user