Expose the session ID to shell commands (#37848)

## What changed

- Set `CODEX_SESSION_ID` to the shared root-session ID for shell tool calls,
  unified exec processes, and user shell commands.
- Preserve `CODEX_SESSION_ID` when restoring a shell snapshot, alongside the
  existing runtime-owned environment variables.

GitOrigin-RevId: 5228867d25507105c7edf11607a8298958c3b917
This commit is contained in:
jif authored and copyberry committed 2026-08-10 17:02:19 +00:00
1 parent 4996cf05af
commit 97729885d4
7 files changed
+18

No files matched your search

+2
View File
@@ -5,6 +5,7 @@ Concrete ToolRuntime implementations for specific tools. Each runtime stays
small and focused and reuses the orchestrator for approvals + sandbox + retry.
*/
use crate::exec_env::CODEX_PERMISSION_PROFILE_ENV_VAR;
use crate::exec_env::CODEX_SESSION_ID_ENV_VAR;
use crate::exec_env::CODEX_THREAD_ID_ENV_VAR;
use crate::sandboxing::SandboxPermissions;
use crate::shell::Shell;
@@ -269,6 +270,7 @@ pub(crate) fn maybe_wrap_shell_lc_with_snapshot(
.collect::<String>();
let mut override_env = explicit_env_overrides.clone();
for key in [
CODEX_SESSION_ID_ENV_VAR,
CODEX_THREAD_ID_ENV_VAR,
CODEX_PERMISSION_PROFILE_ENV_VAR,
CODEX_APPLY_PATCH_PRESERVE_LINE_ENDINGS_ENV_VAR,