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:
Charley Cunningham 2026-03-11 11:41:50 -07:00 committed by Michael Bolin
parent c32c445f1c
commit f5bb338fdb
16 changed files with 107 additions and 124 deletions

View file

@ -1933,21 +1933,9 @@ impl Session {
};
match conversation_history {
InitialHistory::New => {
// Build and record initial items (user instructions + environment context)
// TODO(ccunningham): Defer initial context insertion until the first real turn
// starts so it reflects the actual first-turn settings (permissions, etc.) and
// we do not emit model-visible "diff" updates before the first user message.
let items = self.build_initial_context(&turn_context).await;
self.record_conversation_items(&turn_context, &items).await;
{
let mut state = self.state.lock().await;
state.set_reference_context_item(Some(turn_context.to_turn_context_item()));
}
// Defer initial context insertion until the first real turn starts so
// turn/start overrides can be merged before we write model-visible context.
self.set_previous_turn_settings(None).await;
// Ensure initial items are visible to immediate readers (e.g., tests, forks).
if !is_subagent {
self.flush_rollout().await;
}
}
InitialHistory::Resumed(resumed_history) => {
let rollout_items = resumed_history.history;

View file

@ -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;

View file

@ -39,17 +39,11 @@ fn collab_mode_with_instructions(instructions: Option<&str>) -> CollaborationMod
fn developer_texts(input: &[Value]) -> Vec<String> {
input
.iter()
.filter_map(|item| {
let role = item.get("role")?.as_str()?;
if role != "developer" {
return None;
}
let text = item
.get("content")?
.as_array()?
.first()?
.get("text")?
.as_str()?;
.filter(|item| item.get("role").and_then(Value::as_str) == Some("developer"))
.filter_map(|item| item.get("content")?.as_array().cloned())
.flatten()
.filter_map(|content| {
let text = content.get("text")?.as_str()?;
Some(text.to_string())
})
.collect()
@ -59,8 +53,8 @@ fn collab_xml(text: &str) -> String {
format!("{COLLABORATION_MODE_OPEN_TAG}{text}{COLLABORATION_MODE_CLOSE_TAG}")
}
fn count_exact(texts: &[String], target: &str) -> usize {
texts.iter().filter(|text| text.as_str() == target).count()
fn count_messages_containing(texts: &[String], target: &str) -> usize {
texts.iter().filter(|text| text.contains(target)).count()
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
@ -139,7 +133,7 @@ async fn user_input_includes_collaboration_instructions_after_override() -> Resu
let input = req.single_request().input();
let dev_texts = developer_texts(&input);
let collab_text = collab_xml(collab_text);
assert_eq!(count_exact(&dev_texts, &collab_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1);
Ok(())
}
@ -186,7 +180,7 @@ async fn collaboration_instructions_added_on_user_turn() -> Result<()> {
let input = req.single_request().input();
let dev_texts = developer_texts(&input);
let collab_text = collab_xml(collab_text);
assert_eq!(count_exact(&dev_texts, &collab_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1);
Ok(())
}
@ -235,7 +229,7 @@ async fn override_then_next_turn_uses_updated_collaboration_instructions() -> Re
let input = req.single_request().input();
let dev_texts = developer_texts(&input);
let collab_text = collab_xml(collab_text);
assert_eq!(count_exact(&dev_texts, &collab_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1);
Ok(())
}
@ -300,8 +294,8 @@ async fn user_turn_overrides_collaboration_instructions_after_override() -> Resu
let dev_texts = developer_texts(&input);
let base_text = collab_xml(base_text);
let turn_text = collab_xml(turn_text);
assert_eq!(count_exact(&dev_texts, &base_text), 0);
assert_eq!(count_exact(&dev_texts, &turn_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &base_text), 0);
assert_eq!(count_messages_containing(&dev_texts, &turn_text), 1);
Ok(())
}
@ -382,8 +376,8 @@ async fn collaboration_mode_update_emits_new_instruction_message() -> Result<()>
let dev_texts = developer_texts(&input);
let first_text = collab_xml(first_text);
let second_text = collab_xml(second_text);
assert_eq!(count_exact(&dev_texts, &first_text), 1);
assert_eq!(count_exact(&dev_texts, &second_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &first_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &second_text), 1);
Ok(())
}
@ -462,7 +456,7 @@ async fn collaboration_mode_update_noop_does_not_append() -> Result<()> {
let input = req2.single_request().input();
let dev_texts = developer_texts(&input);
let collab_text = collab_xml(collab_text);
assert_eq!(count_exact(&dev_texts, &collab_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1);
Ok(())
}
@ -549,8 +543,8 @@ async fn collaboration_mode_update_emits_new_instruction_message_when_mode_chang
let dev_texts = developer_texts(&input);
let default_text = collab_xml(default_text);
let plan_text = collab_xml(plan_text);
assert_eq!(count_exact(&dev_texts, &default_text), 1);
assert_eq!(count_exact(&dev_texts, &plan_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &default_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &plan_text), 1);
Ok(())
}
@ -635,7 +629,7 @@ async fn collaboration_mode_update_noop_does_not_append_when_mode_is_unchanged()
let input = req2.single_request().input();
let dev_texts = developer_texts(&input);
let collab_text = collab_xml(collab_text);
assert_eq!(count_exact(&dev_texts, &collab_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1);
Ok(())
}
@ -710,7 +704,7 @@ async fn resume_replays_collaboration_instructions() -> Result<()> {
let input = req2.single_request().input();
let dev_texts = developer_texts(&input);
let collab_text = collab_xml(collab_text);
assert_eq!(count_exact(&dev_texts, &collab_text), 1);
assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1);
Ok(())
}
@ -766,7 +760,7 @@ async fn empty_collaboration_instructions_are_ignored() -> Result<()> {
let dev_texts = developer_texts(&input);
assert_eq!(dev_texts.len(), 1);
let collab_text = collab_xml("");
assert_eq!(count_exact(&dev_texts, &collab_text), 0);
assert_eq!(count_messages_containing(&dev_texts, &collab_text), 0);
Ok(())
}

View file

@ -2541,7 +2541,6 @@ async fn snapshot_request_shape_remote_mid_turn_compaction_multi_summary_reinjec
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
// TODO(ccunningham): Update once manual remote /compact with no prior user turn becomes a no-op.
async fn snapshot_request_shape_remote_manual_compact_without_previous_user_messages() -> Result<()>
{
skip_if_no_network!(Ok(()));
@ -2581,19 +2580,15 @@ async fn snapshot_request_shape_remote_manual_compact_without_previous_user_mess
assert_eq!(
compact_mock.requests().len(),
1,
"current behavior still issues remote compaction for manual /compact without prior user"
0,
"manual /compact without prior user should not issue a remote compaction request"
);
let compact_request = compact_mock.single_request();
let follow_up_request = responses_mock.single_request();
insta::assert_snapshot!(
"remote_manual_compact_without_prev_user_shapes",
format_labeled_requests_snapshot(
"Remote manual /compact with no prior user turn still issues a compact request; follow-up turn carries canonical context and new user message.",
&[
("Remote Compaction Request", &compact_request),
("Remote Post-Compaction History Layout", &follow_up_request),
]
"Remote manual /compact with no prior user turn skips the remote compact request; the follow-up turn carries canonical context and new user message.",
&[("Remote Post-Compaction History Layout", &follow_up_request)]
)
);

View file

@ -867,7 +867,7 @@ async fn user_turn_personality_remote_model_template_includes_update_message() -
let developer_texts = request.message_input_texts("developer");
let personality_text = developer_texts
.iter()
.find(|text| text.contains("<personality_spec>"))
.find(|text| text.contains(remote_friendly_message))
.expect("expected personality update message in developer input");
assert!(

View file

@ -1,15 +1,12 @@
---
source: core/tests/suite/compact.rs
assertion_line: 3343
expression: "format_labeled_requests_snapshot(\"Manual /compact with no prior user turn currently still issues a compaction request; follow-up turn carries canonical context and the new user message.\",\n&[(\"Local Compaction Request\", &requests[0]),\n(\"Local Post-Compaction History Layout\", &requests[1]),])"
---
Scenario: Manual /compact with no prior user turn currently still issues a compaction request; follow-up turn carries canonical context and the new user message.
## Local Compaction Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/user:<SUMMARIZATION_PROMPT>
00:message/user:<SUMMARIZATION_PROMPT>
## Local Post-Compaction History Layout
00:message/user:<COMPACTION_SUMMARY>\nMANUAL_EMPTY_SUMMARY

View file

@ -1,6 +1,6 @@
---
source: core/tests/suite/compact.rs
assertion_line: 1791
assertion_line: 1799
expression: "format_labeled_requests_snapshot(\"Pre-sampling compaction on model switch to a smaller context window: current behavior compacts using prior-turn history only (incoming user message excluded), and the follow-up request carries compacted history plus the new user message.\",\n&[(\"Initial Request (Previous Model)\", &requests[0]),\n(\"Pre-sampling Compaction Request\", &requests[1]),\n(\"Post-Compaction Follow-up Request (Next Model)\", &requests[2]),])"
---
Scenario: Pre-sampling compaction on model switch to a smaller context window: current behavior compacts using prior-turn history only (incoming user message excluded), and the follow-up request carries compacted history plus the new user message.
@ -10,18 +10,16 @@ Scenario: Pre-sampling compaction on model switch to a smaller context window: c
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<PERMISSIONS_INSTRUCTIONS>
03:message/user:before switch
02:message/user:before switch
## Pre-sampling Compaction Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<PERMISSIONS_INSTRUCTIONS>
03:message/user:before switch
04:message/assistant:before switch
05:message/user:<SUMMARIZATION_PROMPT>
02:message/user:before switch
03:message/assistant:before switch
04:message/user:<SUMMARIZATION_PROMPT>
## Post-Compaction Follow-up Request (Next Model)
00:message/user:before switch

View file

@ -1,6 +1,6 @@
---
source: core/tests/suite/compact.rs
assertion_line: 3188
assertion_line: 3195
expression: "format_labeled_requests_snapshot(\"Pre-turn compaction during model switch (without pre-sampling model-switch compaction): current behavior strips incoming <model_switch> from the compact request and restores it in the post-compaction follow-up request.\",\n&[(\"Initial Request (Previous Model)\", &requests[0]),\n(\"Local Compaction Request\", &requests[1]),\n(\"Local Post-Compaction History Layout\", &requests[2]),])"
---
Scenario: Pre-turn compaction during model switch (without pre-sampling model-switch compaction): current behavior strips incoming <model_switch> from the compact request and restores it in the post-compaction follow-up request.
@ -10,18 +10,16 @@ Scenario: Pre-turn compaction during model switch (without pre-sampling model-sw
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<PERMISSIONS_INSTRUCTIONS>
03:message/user:BEFORE_SWITCH_USER
02:message/user:BEFORE_SWITCH_USER
## Local Compaction Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<PERMISSIONS_INSTRUCTIONS>
03:message/user:BEFORE_SWITCH_USER
04:message/assistant:BEFORE_SWITCH_REPLY
05:message/user:<SUMMARIZATION_PROMPT>
02:message/user:BEFORE_SWITCH_USER
03:message/assistant:BEFORE_SWITCH_REPLY
04:message/user:<SUMMARIZATION_PROMPT>
## Local Post-Compaction History Layout
00:message/user:BEFORE_SWITCH_USER

View file

@ -1,17 +1,19 @@
---
source: core/tests/suite/compact_remote.rs
assertion_line: 1950
expression: "format_labeled_requests_snapshot(\"After remote manual /compact and resume, the first resumed turn rebuilds history from the compaction item and restates realtime-end instructions from reconstructed previous-turn settings.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Resume History Layout\", after_resume_request),])"
---
Scenario: After remote manual /compact and resume, the first resumed turn rebuilds history from the compaction item and restates realtime-end instructions from reconstructed previous-turn settings.
## Remote Compaction Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
00:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <realtime_conversation>\nRealtime conversation started.\n\nYou a...
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<realtime_conversation>\nRealtime conversation started.\n\nYou a...
03:message/user:USER_ONE
04:message/assistant:REMOTE_FIRST_REPLY
02:message/user:USER_ONE
03:message/assistant:REMOTE_FIRST_REPLY
## Remote Post-Resume History Layout
00:compaction:encrypted=true

View file

@ -1,17 +1,19 @@
---
source: core/tests/suite/compact_remote.rs
assertion_line: 1742
expression: "format_labeled_requests_snapshot(\"Remote manual /compact while realtime remains active: the next regular turn restates realtime-start instructions after compaction clears the baseline.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", post_compact_request),])"
---
Scenario: Remote manual /compact while realtime remains active: the next regular turn restates realtime-start instructions after compaction clears the baseline.
## Remote Compaction Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
00:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <realtime_conversation>\nRealtime conversation started.\n\nYou a...
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<realtime_conversation>\nRealtime conversation started.\n\nYou a...
03:message/user:USER_ONE
04:message/assistant:REMOTE_FIRST_REPLY
02:message/user:USER_ONE
03:message/assistant:REMOTE_FIRST_REPLY
## Remote Post-Compaction History Layout
00:compaction:encrypted=true

View file

@ -1,14 +1,8 @@
---
source: core/tests/suite/compact_remote.rs
expression: "format_labeled_requests_snapshot(\"Remote manual /compact with no prior user turn still issues a compact request; follow-up turn carries canonical context and new user message.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", &follow_up_request),])"
expression: "format_labeled_requests_snapshot(\"Remote manual /compact with no prior user turn skips the remote compact request; the follow-up turn carries canonical context and new user message.\",\n&[(\"Remote Post-Compaction History Layout\", &follow_up_request),])"
---
Scenario: Remote manual /compact with no prior user turn still issues a compact request; follow-up turn carries canonical context and new user message.
## Remote Compaction Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
Scenario: Remote manual /compact with no prior user turn skips the remote compact request; the follow-up turn carries canonical context and new user message.
## Remote Post-Compaction History Layout
00:message/developer:<PERMISSIONS_INSTRUCTIONS>

View file

@ -1,32 +1,35 @@
---
source: core/tests/suite/compact_remote.rs
assertion_line: 1843
expression: "format_labeled_requests_snapshot(\"Remote mid-turn continuation compaction after realtime was closed before the turn: the initial second-turn request emits realtime-end instructions, but the continuation request does not restate them after compaction because the current turn already established the inactive baseline.\",\n&[(\"Second Turn Initial Request\", second_turn_request),\n(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", post_compact_request),])"
---
Scenario: Remote mid-turn continuation compaction after realtime was closed before the turn: the initial second-turn request emits realtime-end instructions, but the continuation request does not restate them after compaction because the current turn already established the inactive baseline.
## Second Turn Initial Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
00:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <realtime_conversation>\nRealtime conversation started.\n\nYou a...
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<realtime_conversation>\nRealtime conversation started.\n\nYou a...
03:message/user:SETUP_USER
04:message/assistant:REMOTE_SETUP_REPLY
05:message/developer:<realtime_conversation>\nRealtime conversation ended.\n\nSubsequ...
06:message/user:USER_TWO
02:message/user:SETUP_USER
03:message/assistant:REMOTE_SETUP_REPLY
04:message/developer:<realtime_conversation>\nRealtime conversation ended.\n\nSubsequ...
05:message/user:USER_TWO
## Remote Compaction Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
00:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <realtime_conversation>\nRealtime conversation started.\n\nYou a...
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<realtime_conversation>\nRealtime conversation started.\n\nYou a...
03:message/user:SETUP_USER
04:message/assistant:REMOTE_SETUP_REPLY
05:message/developer:<realtime_conversation>\nRealtime conversation ended.\n\nSubsequ...
06:message/user:USER_TWO
07:function_call/test_tool
08:function_call_output:unsupported call: test_tool
02:message/user:SETUP_USER
03:message/assistant:REMOTE_SETUP_REPLY
04:message/developer:<realtime_conversation>\nRealtime conversation ended.\n\nSubsequ...
05:message/user:USER_TWO
06:function_call/test_tool
07:function_call_output:unsupported call: test_tool
## Remote Post-Compaction History Layout
00:message/developer:<PERMISSIONS_INSTRUCTIONS>

View file

@ -1,17 +1,19 @@
---
source: core/tests/suite/compact_remote.rs
assertion_line: 1656
expression: "format_labeled_requests_snapshot(\"Remote pre-turn auto-compaction after realtime was closed between turns: the follow-up request emits realtime-end instructions from previous-turn settings even though compaction cleared the reference baseline.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", post_compact_request),])"
---
Scenario: Remote pre-turn auto-compaction after realtime was closed between turns: the follow-up request emits realtime-end instructions from previous-turn settings even though compaction cleared the reference baseline.
## Remote Compaction Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
00:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <realtime_conversation>\nRealtime conversation started.\n\nYou a...
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<realtime_conversation>\nRealtime conversation started.\n\nYou a...
03:message/user:USER_ONE
04:message/assistant:REMOTE_FIRST_REPLY
02:message/user:USER_ONE
03:message/assistant:REMOTE_FIRST_REPLY
## Remote Post-Compaction History Layout
00:compaction:encrypted=true

View file

@ -1,17 +1,19 @@
---
source: core/tests/suite/compact_remote.rs
assertion_line: 1521
expression: "format_labeled_requests_snapshot(\"Remote pre-turn auto-compaction while realtime remains active: compaction clears the reference baseline, so the follow-up request restates realtime-start instructions.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", post_compact_request),])"
---
Scenario: Remote pre-turn auto-compaction while realtime remains active: compaction clears the reference baseline, so the follow-up request restates realtime-start instructions.
## Remote Compaction Request
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
00:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <realtime_conversation>\nRealtime conversation started.\n\nYou a...
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<realtime_conversation>\nRealtime conversation started.\n\nYou a...
03:message/user:USER_ONE
04:message/assistant:REMOTE_FIRST_REPLY
02:message/user:USER_ONE
03:message/assistant:REMOTE_FIRST_REPLY
## Remote Post-Compaction History Layout
00:compaction:encrypted=true

View file

@ -1,5 +1,6 @@
---
source: core/tests/suite/model_visible_layout.rs
assertion_line: 288
expression: "format_labeled_requests_snapshot(\"Second turn changes cwd to a directory with different AGENTS.md; current behavior does not emit refreshed AGENTS instructions.\",\n&[(\"First Request (agents_one)\", &requests[0]),\n(\"Second Request (agents_two cwd)\", &requests[1]),])"
---
Scenario: Second turn changes cwd to a directory with different AGENTS.md; current behavior does not emit refreshed AGENTS instructions.
@ -9,18 +10,14 @@ Scenario: Second turn changes cwd to a directory with different AGENTS.md; curre
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<PERMISSIONS_INSTRUCTIONS>
03:message/user:<ENVIRONMENT_CONTEXT:cwd=<CWD>>
04:message/user:first turn in agents_one
02:message/user:first turn in agents_one
## Second Request (agents_two cwd)
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<PERMISSIONS_INSTRUCTIONS>
03:message/user:<ENVIRONMENT_CONTEXT:cwd=<CWD>>
04:message/user:first turn in agents_one
05:message/assistant:turn one complete
06:message/user:<ENVIRONMENT_CONTEXT:cwd=<CWD>>
07:message/user:second turn in agents_two
02:message/user:first turn in agents_one
03:message/assistant:turn one complete
04:message/user:<ENVIRONMENT_CONTEXT:cwd=<CWD>>
05:message/user:second turn in agents_two

View file

@ -1,5 +1,6 @@
---
source: core/tests/suite/model_visible_layout.rs
assertion_line: 177
expression: "format_labeled_requests_snapshot(\"Second turn changes cwd, approval policy, and personality while keeping model constant.\",\n&[(\"First Request (Baseline)\", &requests[0]),\n(\"Second Request (Turn Overrides)\", &requests[1]),])"
---
Scenario: Second turn changes cwd, approval policy, and personality while keeping model constant.
@ -9,19 +10,17 @@ Scenario: Second turn changes cwd, approval policy, and personality while keepin
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<PERMISSIONS_INSTRUCTIONS>
03:message/user:first turn
02:message/user:first turn
## Second Request (Turn Overrides)
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
01:message/user[2]:
[01] <AGENTS_MD>
[02] <ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/developer:<PERMISSIONS_INSTRUCTIONS>
03:message/user:first turn
04:message/assistant:turn one complete
05:message/developer[2]:
02:message/user:first turn
03:message/assistant:turn one complete
04:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <personality_spec> The user has requested a new communication style. Future messages should adhe...
06:message/user:<ENVIRONMENT_CONTEXT:cwd=PRETURN_CONTEXT_DIFF_CWD>
07:message/user:second turn with context updates
05:message/user:<ENVIRONMENT_CONTEXT:cwd=PRETURN_CONTEXT_DIFF_CWD>
06:message/user:second turn with context updates