mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Stop applying macOS background priority to managed daemons (#54763)
## What changed Launch managed app-server and updater processes directly through the shared background command helper, removing the macOS `taskpolicy -b` wrapper and its availability probe. Remove the associated launch-policy tests and macOS daemon-startup test serialization. Retain the 30-second macOS readiness timeout because older updaters can pass background policy to replacement daemons during upgrades. GitOrigin-RevId: d8620a49139bd2a5c226c624cf7908e06ba7ba38
This commit is contained in:
committed by
copyberry
parent
df8990e261
commit
d13db678cb
@@ -95,6 +95,7 @@ impl PidBackend {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let mut command = Command::from(codex_utils_process::background_command(&codex_bin));
|
||||
let stderr_log = match self.open_stderr_log().await {
|
||||
Ok(stderr_log) => stderr_log,
|
||||
Err(err) => {
|
||||
@@ -104,10 +105,17 @@ impl PidBackend {
|
||||
return Err(err);
|
||||
}
|
||||
};
|
||||
command
|
||||
// Handoff suppression belongs to the foreground CLI, not its long-lived children.
|
||||
.env_remove(crate::telemetry::HANDOFF_ENV)
|
||||
.args(self.command_args().iter().map(std::borrow::Cow::as_ref))
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::from(stderr_log.into_std().await));
|
||||
// Older or pinned managed binaries may predate this optional startup flag.
|
||||
let managed_app_server =
|
||||
matches!(self.command_kind, super::PidCommandKind::AppServer { .. });
|
||||
let managed_daemon_supported = managed_app_server
|
||||
if managed_app_server
|
||||
&& matches!(
|
||||
tokio::time::timeout(
|
||||
std::time::Duration::from_secs(5),
|
||||
@@ -120,8 +128,10 @@ impl PidBackend {
|
||||
.status(),
|
||||
).await,
|
||||
Ok(Ok(status)) if status.success()
|
||||
);
|
||||
if managed_app_server && !managed_daemon_supported {
|
||||
)
|
||||
{
|
||||
command.arg("--managed-daemon");
|
||||
} else if managed_app_server {
|
||||
let codex_home = self
|
||||
.pid_file
|
||||
.parent()
|
||||
@@ -136,31 +146,6 @@ impl PidBackend {
|
||||
}
|
||||
}
|
||||
}
|
||||
let command = crate::background_command::managed_process(&codex_bin).await;
|
||||
let mut command = match command {
|
||||
Ok(command) => Command::from(command),
|
||||
Err(err) => {
|
||||
if replacement.is_none() {
|
||||
let _ = fs::remove_file(&self.pid_file).await;
|
||||
}
|
||||
return Err(err).with_context(|| {
|
||||
format!(
|
||||
"failed to spawn detached app-server process using {}",
|
||||
self.codex_bin.display()
|
||||
)
|
||||
});
|
||||
}
|
||||
};
|
||||
command
|
||||
// Handoff suppression belongs to the foreground CLI, not its long-lived children.
|
||||
.env_remove(crate::telemetry::HANDOFF_ENV)
|
||||
.args(self.command_args().iter().map(std::borrow::Cow::as_ref))
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::from(stderr_log.into_std().await));
|
||||
if managed_daemon_supported {
|
||||
command.arg("--managed-daemon");
|
||||
}
|
||||
if let Some((key, value)) = self.command_env() {
|
||||
command.env(key, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user