mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:22:05 +00:00
Preserve root turn attribution in turn-start events (#44611)
## Why Persisted turn-start events lack the originating root turn ID, so they cannot directly associate child turns with the root turn that initiated them. ## What changed - Add optional `root_turn_id` to `TurnStartedEvent`. Use the inherited root turn ID when available, otherwise the turn's own ID. - Centralize turn-start emission for regular turns, shell commands, and manual compaction so they record attribution consistently. - Carry attribution into `ThreadHistoryTurnChange` when processing turn-start events and retain it through completion in the history builder. - Keep older records compatible by defaulting missing attribution to `None`. ## Testing Add coverage for root and child turn attribution, persistence when tool collisions fail a turn before sampling, history change propagation, and deserialization of older turn-start records. GitOrigin-RevId: 54a80b828ca7d1c4c19f13d468c01d052e1b9130
This commit is contained in:
1 parent
242c5ce01c
commit
196964ef10
40 files changed
+252
-55
No files matched your search
@@ -1824,6 +1824,7 @@ async fn older_pagination_reconciles_review_prompts_across_page_boundaries() ->
|
||||
]);
|
||||
let events = std::iter::once(EventMsg::TurnStarted(TurnStartedEvent {
|
||||
turn_id: "cross-page-review-turn".to_string(),
|
||||
root_turn_id: None,
|
||||
trace_id: None,
|
||||
started_at: None,
|
||||
model_context_window: None,
|
||||
@@ -1986,6 +1987,7 @@ async fn transcript_home_loads_every_older_history_page() -> Result<()> {
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
let events = std::iter::once(EventMsg::TurnStarted(TurnStartedEvent {
|
||||
turn_id: "multi-page-turn".to_string(),
|
||||
root_turn_id: None,
|
||||
trace_id: None,
|
||||
started_at: None,
|
||||
model_context_window: None,
|
||||
@@ -2394,6 +2396,7 @@ async fn underfilled_scrollback_fetches_older_pages_without_opening_the_transcri
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
let events = std::iter::once(EventMsg::TurnStarted(TurnStartedEvent {
|
||||
turn_id: "scrollback-pagination-turn".to_string(),
|
||||
root_turn_id: None,
|
||||
trace_id: None,
|
||||
started_at: None,
|
||||
model_context_window: None,
|
||||
|
||||
Reference in new issue
Block a user