Stabilize remote full CI test fixtures

This commit is contained in:
starr-openai
2026-05-29 05:55:33 -07:00
parent cc85a4a2e9
commit 750e90633c
7 changed files with 32 additions and 11 deletions
+3
View File
@@ -1910,6 +1910,9 @@ async fn skill_roots_include_admin_with_lowest_priority() {
if home_dir().is_some() {
expected.insert(1, SkillScope::User);
}
if scopes.contains(&SkillScope::Repo) {
expected.insert(0, SkillScope::Repo);
}
expected.push(SkillScope::Admin);
assert_eq!(scopes, expected);
}
+1 -1
View File
@@ -7851,7 +7851,7 @@ async fn run_user_shell_command_does_not_set_reference_context_item() {
handlers::run_user_shell_command(&session, "sub-id".to_string(), "echo shell".to_string())
.await;
let deadline = StdDuration::from_secs(15);
let deadline = StdDuration::from_secs(30);
let start = std::time::Instant::now();
loop {
let remaining = deadline.saturating_sub(start.elapsed());
+8 -4
View File
@@ -327,9 +327,7 @@ fn stdio_transport(
env: Option<HashMap<String, String>>,
env_vars: Vec<McpServerEnvVar>,
) -> McpServerTransportConfig {
let cwd =
std::env::var_os(remote_env_env_var()).map(|_| PathBuf::from("/tmp/codex-remote-env"));
stdio_transport_with_cwd(command, env, env_vars, cwd)
stdio_transport_with_cwd(command, env, env_vars, /*cwd*/ None)
}
fn stdio_transport_with_cwd(
@@ -350,9 +348,15 @@ fn stdio_transport_with_cwd(
fn insert_mcp_server(
config: &mut Config,
server_name: &str,
transport: McpServerTransportConfig,
mut transport: McpServerTransportConfig,
options: TestMcpServerOptions,
) {
if options.environment_id != codex_config::DEFAULT_MCP_SERVER_ENVIRONMENT_ID
&& let McpServerTransportConfig::Stdio { cwd, .. } = &mut transport
&& cwd.is_none()
{
*cwd = Some(config.cwd.to_path_buf());
}
let mut servers = config.mcp_servers.get().clone();
servers.insert(
server_name.to_string(),
@@ -158,7 +158,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
StreamableHttpService::new(
|| Ok(TestToolServer::new()),
Arc::new(LocalSessionManager::default()),
StreamableHttpServerConfig::default(),
// Full CI can run this private test server in a remote container
// reached through its dynamic container IP instead of loopback.
StreamableHttpServerConfig::default().disable_allowed_hosts(),
),
)
.layer(middleware::from_fn_with_state(
+2 -1
View File
@@ -188,7 +188,8 @@ mod tests {
#[test]
fn environment_id_fallback_has_cwd_prefix() {
let dir = tempfile::tempdir().expect("tempdir");
let home = std::env::var_os("HOME").expect("HOME should be set for tests");
let dir = tempfile::tempdir_in(home).expect("tempdir outside repo");
let env_id = environment_id_from_cwd(dir.path());
let canonical = dir
.path()
@@ -61,6 +61,13 @@ fn cache_project_root(chat: &mut ChatWidget, root_name: &str) {
});
}
fn cache_missing_project_root(chat: &mut ChatWidget) {
chat.status_line_project_root_name_cache = Some(CachedProjectRootName {
cwd: chat.config.cwd.to_path_buf(),
root_name: None,
});
}
fn cache_rate_limit_snapshot(chat: &mut ChatWidget) {
chat.on_rate_limit_snapshot(Some(RateLimitSnapshot {
limit_id: None,
@@ -182,6 +189,7 @@ async fn status_line_setup_popup_hardcoded_only_snapshot() {
#[tokio::test]
async fn status_surface_preview_lines_mixed_snapshot() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
cache_missing_project_root(&mut chat);
chat.status_line_branch = Some("feature/mixed-preview".to_string());
chat.thread_name = Some("Mixed preview thread".to_string());
@@ -278,6 +286,7 @@ async fn status_line_setup_popup_rate_limits_snapshot() {
#[tokio::test]
async fn status_line_setup_popup_mixed_snapshot() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
cache_missing_project_root(&mut chat);
chat.status_line_branch = Some("feature/mixed-preview".to_string());
chat.thread_name = Some("Mixed preview thread".to_string());
chat.config.tui_status_line = Some(vec![
@@ -330,6 +339,7 @@ async fn terminal_title_setup_popup_hardcoded_only_snapshot() {
#[tokio::test]
async fn terminal_title_setup_popup_mixed_snapshot() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
cache_missing_project_root(&mut chat);
chat.thread_name = Some("Mixed preview thread".to_string());
chat.config.tui_terminal_title = Some(vec![
"project-name".to_string(),
@@ -361,6 +371,7 @@ async fn terminal_title_setup_popup_rate_limits_snapshot() {
#[tokio::test]
async fn missing_project_root_uses_different_status_and_title_preview_sources() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
cache_missing_project_root(&mut chat);
let status_preview = status_preview_line(&mut chat, &[StatusLineItem::ProjectRoot]);
let title_preview = title_preview_line(&mut chat, &[TerminalTitleItem::Project]);
@@ -14,7 +14,7 @@ async fn terminal_title_shows_action_required_while_exec_approval_is_pending() {
approval_id: Some("call-action-required".into()),
turn_id: "turn-action-required".into(),
command: vec!["bash".into(), "-lc".into(), "echo hello".into()],
cwd: AbsolutePathBuf::current_dir().expect("current dir"),
cwd: test_project_path().abs(),
reason: Some("need confirmation".into()),
network_approval_context: None,
proposed_execpolicy_amendment: None,
@@ -56,7 +56,7 @@ async fn terminal_title_action_required_respects_spinner_setting() {
approval_id: Some("call-no-spinner".into()),
turn_id: "turn-no-spinner".into(),
command: vec!["bash".into(), "-lc".into(), "echo hello".into()],
cwd: AbsolutePathBuf::current_dir().expect("current dir"),
cwd: test_project_path().abs(),
reason: Some("need confirmation".into()),
network_approval_context: None,
proposed_execpolicy_amendment: None,
@@ -84,7 +84,7 @@ async fn terminal_title_action_required_blinks_when_animations_are_enabled() {
approval_id: Some("call-blink".into()),
turn_id: "turn-blink".into(),
command: vec!["bash".into(), "-lc".into(), "echo hello".into()],
cwd: AbsolutePathBuf::current_dir().expect("current dir"),
cwd: test_project_path().abs(),
reason: Some("need confirmation".into()),
network_approval_context: None,
proposed_execpolicy_amendment: None,
@@ -119,7 +119,7 @@ async fn terminal_title_activity_indicators_do_not_animate_when_animations_are_d
approval_id: Some("call-no-animations".into()),
turn_id: "turn-no-animations".into(),
command: vec!["bash".into(), "-lc".into(), "echo hello".into()],
cwd: AbsolutePathBuf::current_dir().expect("current dir"),
cwd: test_project_path().abs(),
reason: Some("need confirmation".into()),
network_approval_context: None,
proposed_execpolicy_amendment: None,