Consume ai-title from external sessions and add end marker (#20261)

## Summary
- Support Claude Code `ai-title` / `aiTitle` records when detecting and
importing external agent sessions.
- Preserve existing `custom-title` / `customTitle` precedence; only fall
back to `aiTitle` when no custom title is present.
- Add coverage for both detection and import title selection, including
the custom-title-over-ai-title case.

## Testing
- `cargo test -p codex-external-agent-sessions`
- `just fix -p codex-external-agent-sessions`
This commit is contained in:
alexsong-oai
2026-04-29 17:00:13 -07:00
committed by GitHub
parent 8774229a89
commit 7bcd4626c4
4 changed files with 222 additions and 13 deletions

View File

@@ -313,7 +313,17 @@ async fn external_agent_config_import_creates_session_rollouts() -> Result<()> {
.await??;
let response: ThreadReadResponse = to_response(response)?;
assert_eq!(response.thread.turns.len(), 1);
assert_eq!(response.thread.turns[0].items.len(), 2);
let items = &response.thread.turns[0].items;
assert_eq!(items.len(), 3);
assert_eq!(
items.last(),
Some(&ThreadItem::AgentMessage {
id: "item-3".into(),
text: "<EXTERNAL SESSION IMPORTED>".into(),
phase: None,
memory_citation: None,
})
);
let request_id = mcp
.send_thread_resume_request(ThreadResumeParams {