mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
Defer initial context insertion until the first turn (#14313)
## Summary - defer fresh-session `build_initial_context()` until the first real turn instead of seeding model-visible context during startup - rely on the existing `reference_context_item == None` turn-start path to inject full initial context on that first real turn (and again after baseline resets such as compaction) - add a regression test for `InitialHistory::New` and update affected deterministic tests / snapshots around developer-message layout, collaboration instructions, personality updates, and compact request shapes ## Notes - this PR does not add any special empty-thread `/compact` behavior - most of the snapshot churn is the direct result of moving the initial model-visible context from startup to the first real turn, so first-turn request layouts no longer contain a pre-user startup copy of permissions / environment / other developer-visible context - remote manual `/compact` with no prior user still skips the remote compact request; local first-turn `/compact` still issues a compact request, but that request now reflects the lack of startup-seeded context --------- Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
committed by
Michael Bolin
co-authored by
Codex
parent
c32c445f1c
commit
f5bb338fdb
@@ -808,6 +808,18 @@ async fn record_initial_history_reconstructs_resumed_transcript() {
|
||||
assert_eq!(expected, history.raw_items());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn record_initial_history_new_defers_initial_context_until_first_turn() {
|
||||
let (session, _turn_context) = make_session_and_context().await;
|
||||
|
||||
session.record_initial_history(InitialHistory::New).await;
|
||||
|
||||
let history = session.clone_history().await;
|
||||
assert_eq!(history.raw_items().to_vec(), Vec::<ResponseItem>::new());
|
||||
assert!(session.reference_context_item().await.is_none());
|
||||
assert_eq!(session.previous_turn_settings().await, None);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn resumed_history_injects_initial_context_on_first_context_update_only() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
|
||||
Reference in New Issue
Block a user