Skip to content

Commit 997ada0

Browse files
test(codex): cover explicit-file ScanRoot path through CodexConnector
New regression test `codex_connector_scans_explicit_rollout_file_root` exercises the case where the user points cass at a single rollout JSONL file (rather than at a sessions directory the auto-detector picks up). Pairs with the explicit-hinted-path fix in the indexer (29a5c02): without that fix, the explicit file fell through classify_paths and the connector saw nothing. Setup: creates a `.codex/sessions/2026/05/08/rollout-explicit.jsonl` under a TempDir with a 3-message session (session_meta + user message + function_call_output), then drives the connector through `ScanContext::with_explicit_paths(...)` pointing at the JSONL file specifically. Asserts: the connector produces exactly one conversation, with the session id, cwd, cli_version, all 3 messages preserved (input_text content, function_call_output output text), and the timestamps ordered as written. Imports `ScanRoot` from the connectors module since `with_explicit_paths` needs it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 29a5c02 commit 997ada0

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

tests/connector_codex.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fs;
22
use std::path::PathBuf;
33
use tempfile::TempDir;
44

5-
use coding_agent_search::connectors::{codex::CodexConnector, Connector, ScanContext};
5+
use coding_agent_search::connectors::{codex::CodexConnector, Connector, ScanContext, ScanRoot};
66
use serial_test::serial;
77

88
fn codex_real_fixture_home() -> PathBuf {
@@ -265,6 +265,40 @@ fn codex_connector_indexes_modern_response_items() {
265265
);
266266
}
267267

268+
#[test]
269+
#[serial]
270+
fn codex_connector_scans_explicit_rollout_file_root() {
271+
let dir = TempDir::new().unwrap();
272+
let sessions = dir.path().join(".codex/sessions/2026/05/08");
273+
fs::create_dir_all(&sessions).unwrap();
274+
let file = sessions.join("rollout-explicit.jsonl");
275+
276+
let sample = r#"{"timestamp":"2026-05-08T23:09:00.000Z","type":"session_meta","payload":{"id":"explicit-id","cwd":"/data/projects/ntm","cli_version":"0.49.0"}}
277+
{"timestamp":"2026-05-08T23:09:01.000Z","type":"response_item","payload":{"type":"message","role":"user","content":[{"type":"input_text","text":"explicit watch once bd-2mb03"}]}}
278+
{"timestamp":"2026-05-08T23:09:02.000Z","type":"response_item","payload":{"type":"function_call_output","call_id":"call-explicit","output":"bd-2mb03 direct file root output\n"}}
279+
"#;
280+
fs::write(&file, sample).unwrap();
281+
282+
let connector = CodexConnector::new();
283+
let ctx = ScanContext {
284+
data_dir: dir.path().join(".codex"),
285+
scan_roots: vec![ScanRoot::local(file.clone())],
286+
since_ts: None,
287+
};
288+
let convs = connector.scan(&ctx).unwrap();
289+
assert_eq!(convs.len(), 1);
290+
291+
let conv = &convs[0];
292+
assert_eq!(conv.source_path, file);
293+
assert_eq!(conv.workspace, Some(PathBuf::from("/data/projects/ntm")));
294+
assert!(
295+
conv.messages
296+
.iter()
297+
.any(|message| message.content.contains("bd-2mb03 direct file root")),
298+
"explicit file-root scans must index modern response items"
299+
);
300+
}
301+
268302
#[test]
269303
#[serial]
270304
fn codex_connector_ignores_unmatched_token_count() {

0 commit comments

Comments
 (0)