mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Preserve context annotations in merged messages (#40184)
## What changed - Carry each contextual fragment's `ContentItemKind` through initial context assembly and world-state updates. - Attach the classifications to merged response messages through `content_item_kinds`, preserving their order alongside the message content. - Convert extension prompt fragments into annotated developer fragments and classify built-in developer and guardian instructions. ## Testing - Add an integration test covering roles and content annotations in the first request. - Update world-state and persisted-history tests to account for annotation metadata. GitOrigin-RevId: 71c48dad5b17bffd47ba03263e3eb6d5e74fbf4b
This commit is contained in:
@@ -2,6 +2,7 @@ use super::super::test_support::render_section_cases;
|
||||
use super::*;
|
||||
use crate::context::MultiAgentRoleInstructions;
|
||||
use crate::context::world_state::WorldState;
|
||||
use codex_protocol::models::ContentItem;
|
||||
use codex_protocol::models::ResponseItem;
|
||||
use codex_utils_output_truncation::approx_token_count;
|
||||
|
||||
@@ -112,10 +113,20 @@ fn catalog_role_updates_remain_separate_from_active_mode() {
|
||||
let expected_mode = MultiAgentModeInstructions::from_mode(MultiAgentMode::Proactive)
|
||||
.expect("proactive mode should render");
|
||||
assert_eq!(
|
||||
updates,
|
||||
updates
|
||||
.into_iter()
|
||||
.map(|item| match item {
|
||||
ResponseItem::Message { content, .. } => content,
|
||||
_ => panic!("expected world-state message"),
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
vec![
|
||||
ContextualUserFragment::into(current_role),
|
||||
ContextualUserFragment::into(expected_mode),
|
||||
vec![ContentItem::InputText {
|
||||
text: current_role.render(),
|
||||
}],
|
||||
vec![ContentItem::InputText {
|
||||
text: expected_mode.render(),
|
||||
}],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user