[BREAKING] Stop loading project .env files (#3184)
Loading project local .env often loads settings that break codex cli. Fixes: https://github.com/openai/codex/issues/3174
This commit is contained in:
@@ -21,8 +21,7 @@ const MISSPELLED_APPLY_PATCH_ARG0: &str = "applypatch";
|
|||||||
/// `codex-linux-sandbox` we *directly* execute
|
/// `codex-linux-sandbox` we *directly* execute
|
||||||
/// [`codex_linux_sandbox::run_main`] (which never returns). Otherwise we:
|
/// [`codex_linux_sandbox::run_main`] (which never returns). Otherwise we:
|
||||||
///
|
///
|
||||||
/// 1. Use [`dotenvy::from_path`] and [`dotenvy::dotenv`] to modify the
|
/// 1. Load `.env` values from `~/.codex/.env` before creating any threads.
|
||||||
/// environment before creating any threads.
|
|
||||||
/// 2. Construct a Tokio multi-thread runtime.
|
/// 2. Construct a Tokio multi-thread runtime.
|
||||||
/// 3. Derive the path to the current executable (so children can re-invoke the
|
/// 3. Derive the path to the current executable (so children can re-invoke the
|
||||||
/// sandbox) when running on Linux.
|
/// sandbox) when running on Linux.
|
||||||
@@ -106,7 +105,7 @@ where
|
|||||||
|
|
||||||
const ILLEGAL_ENV_VAR_PREFIX: &str = "CODEX_";
|
const ILLEGAL_ENV_VAR_PREFIX: &str = "CODEX_";
|
||||||
|
|
||||||
/// Load env vars from ~/.codex/.env and `$(pwd)/.env`.
|
/// Load env vars from ~/.codex/.env.
|
||||||
///
|
///
|
||||||
/// Security: Do not allow `.env` files to create or modify any variables
|
/// Security: Do not allow `.env` files to create or modify any variables
|
||||||
/// with names starting with `CODEX_`.
|
/// with names starting with `CODEX_`.
|
||||||
@@ -116,10 +115,6 @@ fn load_dotenv() {
|
|||||||
{
|
{
|
||||||
set_filtered(iter);
|
set_filtered(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(iter) = dotenvy::dotenv_iter() {
|
|
||||||
set_filtered(iter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper to set vars from a dotenvy iterator while filtering out `CODEX_` keys.
|
/// Helper to set vars from a dotenvy iterator while filtering out `CODEX_` keys.
|
||||||
|
|||||||
Reference in New Issue
Block a user