mirror of
https://github.com/openai/codex.git
synced 2026-09-06 15:29:32 +00:00
fix child cwd inheritance for review sessions
This commit is contained in:
@@ -751,7 +751,7 @@ async fn run_guardian_review_session_before_deadline(
|
||||
guardian_model.as_str(),
|
||||
guardian_reasoning_effort.clone(),
|
||||
);
|
||||
let guardian_config = match guardian_config {
|
||||
let mut guardian_config = match guardian_config {
|
||||
Ok(config) => config,
|
||||
Err(err) => {
|
||||
return (
|
||||
@@ -760,6 +760,9 @@ async fn run_guardian_review_session_before_deadline(
|
||||
);
|
||||
}
|
||||
};
|
||||
if let Some(primary_environment) = turn.environments.primary() {
|
||||
guardian_config.cwd = primary_environment.cwd.clone();
|
||||
}
|
||||
|
||||
let (session_outcome, session_analytics_result) = Box::pin(
|
||||
session
|
||||
|
||||
@@ -45,6 +45,9 @@ pub(super) async fn spawn_review_thread(
|
||||
|
||||
// Build per‑turn client with the requested model/family.
|
||||
let mut per_turn_config = (*config).clone();
|
||||
if let Some(primary_environment) = parent_turn_context.environments.primary() {
|
||||
per_turn_config.cwd = primary_environment.cwd.clone();
|
||||
}
|
||||
per_turn_config.model = Some(model.clone());
|
||||
per_turn_config.features = review_features.clone();
|
||||
let tool_mode = model_info.tool_mode.unwrap_or_else(|| {
|
||||
|
||||
@@ -796,6 +796,7 @@ async fn review_uses_overridden_cwd_for_base_branch_merge_base() {
|
||||
run_git(repo_path, &["config", "user.email", "test@example.com"]);
|
||||
run_git(repo_path, &["config", "user.name", "Test User"]);
|
||||
std::fs::write(repo_path.join("file.txt"), "hello\n").unwrap();
|
||||
std::fs::write(repo_path.join("AGENTS.md"), "review repo instructions").unwrap();
|
||||
run_git(repo_path, &["add", "."]);
|
||||
run_git(repo_path, &["commit", "-m", "initial"]);
|
||||
|
||||
@@ -859,6 +860,13 @@ async fn review_uses_overridden_cwd_for_base_branch_merge_base() {
|
||||
saw_merge_base_sha,
|
||||
"expected review prompt to include merge-base sha {head_sha}"
|
||||
);
|
||||
assert!(
|
||||
input
|
||||
.iter()
|
||||
.filter_map(|msg| msg["content"][0]["text"].as_str())
|
||||
.any(|text| text.contains("review repo instructions")),
|
||||
"expected review child to load instructions from its overridden cwd"
|
||||
);
|
||||
|
||||
let _codex_home_guard = codex_home;
|
||||
server.verify().await;
|
||||
|
||||
Reference in New Issue
Block a user