Skip to content

fix(process): apply undefined env removals#107258

Merged
steipete merged 1 commit into
mainfrom
codex/fix-exec-env-undefined
Jul 14, 2026
Merged

fix(process): apply undefined env removals#107258
steipete merged 1 commit into
mainfrom
codex/fix-exec-env-undefined

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #107248

What Problem This Solves

Resolves a regression where explicit undefined child-environment overrides were ignored. That could preserve inherited variables instead of removing them, including case-insensitive Windows keys. The same regression also left duplicate unused helpers in exec.ts, breaking type and lint gates on main.

Why This Change Was Made

Undefined-value deletion now lives in the canonical exec-spawn.ts environment merge path. The unused duplicate implementation is deleted from exec.ts.

User Impact

Callers can reliably remove inherited child-process environment variables. Current main type, lint, and process test failures are repaired.

Evidence

  • Blacksmith Testbox tbx_01kxfrgjna33j431bjzz0medm1: 38 process exec tests passed, 1 skipped.
  • pnpm tsgo:core passed.
  • Focused oxlint passed for src/process/exec.ts and src/process/exec-spawn.ts.
  • Fresh autoreview: clean, no actionable findings.

Recreates #107248 because its branch is not maintainer-writable. Preserves contributor credit via Co-authored-by.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f19ff94d42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/process/exec-spawn.ts
Comment on lines +23 to +25
if (params.value === undefined) {
delete params.env[params.key];
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor explicit PATH removals during lookup

When a Windows caller removes an inherited PATH/Path while spawning a bare command, e.g. baseEnv: { Path: ... }, env: { PATH: undefined }, this branch deletes all spellings from the merged child env. resolveSafeChildProcessInvocation then calls the Windows resolver, whose missing-PATH fallback uses process.env (src/process/windows-command.ts:79-82), so the child no longer gets the intended PATH but the executable is still selected from the ambient parent PATH. That makes explicit undefined removal launch the wrong binary instead of failing or honoring the isolated env.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 489690f into main Jul 14, 2026
120 of 122 checks passed
@steipete
steipete deleted the codex/fix-exec-env-undefined branch July 14, 2026 07:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant