mirror of
https://github.com/openai/codex.git
synced 2026-11-26 07:26:11 +00:00
Preserve turn lineage across goal continuations (#41562)
## Why Automatic goal continuations should remain attributable to the turn that created the goal. External input, hook context, or goal edits can make that attribution ambiguous and must not leave stale lineage metadata behind. ## What changed - Carry the trusted root and previous parent turn through successive automatic goal continuations. - Invalidate stored lineage when external context reaches an active turn or when a goal is edited or cleared. - Preserve lineage for async hook results only when they belong to the receiving turn. ## Testing - Cover goal continuations across intervening user turns and external objective edits. - Cover active, buffered, and externally injected hook or response context. GitOrigin-RevId: 22ccc07961cd0ed8f4b17912b7efa416b342bf50
This commit is contained in:
1 parent
6478a751fd
commit
4210c08def
9 files changed
+410
-10
No files matched your search
@@ -275,6 +275,10 @@ impl GoalService {
|
||||
.map(|goal| (goal, Some(previous_goal)))?
|
||||
};
|
||||
|
||||
if let Some(runtime) = runtime.as_ref() {
|
||||
runtime.invalidate_turn_lineage().await;
|
||||
}
|
||||
|
||||
if objective.is_some() {
|
||||
fill_empty_thread_preview_if_possible(state_db, thread_id, &goal).await;
|
||||
}
|
||||
@@ -316,6 +320,9 @@ impl GoalService {
|
||||
GoalServiceError::Internal(format!("failed to clear thread goal: {err}"))
|
||||
})?;
|
||||
let cleared = cleared_goal.is_some();
|
||||
if cleared && let Some(runtime) = runtime.as_ref() {
|
||||
runtime.invalidate_turn_lineage().await;
|
||||
}
|
||||
drop(goal_state_permit);
|
||||
drop(runtime);
|
||||
|
||||
|
||||
Reference in new issue
Block a user