mirror of
https://github.com/openai/codex.git
synced 2026-05-02 04:11:39 +03:00
feat: add post-compaction sub-agent infos (#12774)
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -26,6 +26,7 @@ use core_test_support::responses::start_mock_server;
|
||||
use core_test_support::skip_if_no_network;
|
||||
use core_test_support::test_codex::test_codex;
|
||||
use core_test_support::wait_for_event;
|
||||
use serde_json::json;
|
||||
|
||||
const PRETURN_CONTEXT_DIFF_CWD: &str = "PRETURN_CONTEXT_DIFF_CWD";
|
||||
|
||||
@@ -53,6 +54,30 @@ fn agents_message_count(request: &ResponsesRequest) -> usize {
|
||||
.count()
|
||||
}
|
||||
|
||||
fn format_environment_context_subagents_snapshot(subagents: &[&str]) -> String {
|
||||
let subagents_block = if subagents.is_empty() {
|
||||
String::new()
|
||||
} else {
|
||||
let lines = subagents
|
||||
.iter()
|
||||
.map(|line| format!(" {line}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
format!("\n <subagents>\n{lines}\n </subagents>")
|
||||
};
|
||||
let items = vec![json!({
|
||||
"type": "message",
|
||||
"role": "user",
|
||||
"content": [{
|
||||
"type": "input_text",
|
||||
"text": format!(
|
||||
"<environment_context>\n <cwd>/tmp/example</cwd>\n <shell>bash</shell>{subagents_block}\n</environment_context>"
|
||||
),
|
||||
}],
|
||||
})];
|
||||
context_snapshot::format_response_items_snapshot(items.as_slice(), &context_snapshot_options())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn snapshot_model_visible_layout_turn_overrides() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
@@ -445,3 +470,23 @@ async fn snapshot_model_visible_layout_resume_override_matches_rollout_model() -
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn snapshot_model_visible_layout_environment_context_includes_one_subagent() -> Result<()> {
|
||||
insta::assert_snapshot!(
|
||||
"model_visible_layout_environment_context_includes_one_subagent",
|
||||
format_environment_context_subagents_snapshot(&["- agent-1: Atlas"])
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn snapshot_model_visible_layout_environment_context_includes_two_subagents() -> Result<()> {
|
||||
insta::assert_snapshot!(
|
||||
"model_visible_layout_environment_context_includes_two_subagents",
|
||||
format_environment_context_subagents_snapshot(&["- agent-1: Atlas", "- agent-2: Juniper"])
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
source: core/tests/suite/model_visible_layout.rs
|
||||
assertion_line: 476
|
||||
expression: "format_environment_context_subagents_snapshot(&[\"- agent-1: Atlas\"])"
|
||||
---
|
||||
00:message/user:<ENVIRONMENT_CONTEXT:cwd=<CWD>:subagents=1>
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
source: core/tests/suite/model_visible_layout.rs
|
||||
assertion_line: 486
|
||||
expression: "format_environment_context_subagents_snapshot(&[\"- agent-1: Atlas\",\n\"- agent-2: Juniper\",])"
|
||||
---
|
||||
00:message/user:<ENVIRONMENT_CONTEXT:cwd=<CWD>:subagents=2>
|
||||
Reference in New Issue
Block a user