Files
codex/codex-rs/memories/write/src/rollout_input_tests.rs
T
jif 6924ce636b Prioritize human evidence in memory v2 extraction (#43799)
## Why

Memory extraction has a limited rollout budget. Select evidence by source so human input and assistant final responses take priority over commentary, context, and tool output.

## What changed

- Use tiered selection for memory v2, preferring newer evidence within each tier and rendering selected items in chronological order with omission markers.
- Keep answered `request_user_input` questions alongside human replies, label evidence sources, replace message media with placeholders, and bound tool output and individual rows.
- Add typed memory context fragments with bounded messages and Unicode-safe extraction chunking.

## Testing

Add tests for memory v2 startup using tiered input and for extraction chunks preserving Unicode evidence within message bounds.

GitOrigin-RevId: 1b2bba4e3264b4fda271e429ad3b7d5f69caed59
2026-09-08 11:12:01 +00:00

39 lines
1.0 KiB
Rust

use super::*;
use pretty_assertions::assert_eq;
#[test]
fn classifies_memory_excluded_fragments() {
let cases = [
(
"# AGENTS.md instructions for /tmp\n\n<INSTRUCTIONS>\nbody\n</INSTRUCTIONS>",
true,
),
(
"# AGENTS.md instructions\n\n<INSTRUCTIONS>\nbody\n</INSTRUCTIONS>",
true,
),
(
"<skill>\n<name>demo</name>\n<path>skills/demo/SKILL.md</path>\nbody\n</skill>",
true,
),
(
"<environment_context>\n<cwd>/tmp</cwd>\n</environment_context>",
false,
),
(
"<subagent_notification>{\"agent_id\":\"a\",\"status\":\"completed\"}</subagent_notification>",
false,
),
];
for (text, expected) in cases {
assert_eq!(
is_memory_excluded_contextual_user_fragment(&ContentItem::InputText {
text: text.to_string(),
}),
expected,
"{text}",
);
}
}