Skip to content

test(codex): centralize shim recursion-guard sanitization - #1961

Merged
lidge-jun merged 1 commit into
devfrom
codex/wave5-shim-env-helper
Aug 18, 2026
Merged

test(codex): centralize shim recursion-guard sanitization#1961
lidge-jun merged 1 commit into
devfrom
codex/wave5-shim-env-helper

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Follow-up to #1960. The previous fix sanitized one spawn site; this centralizes it.

A reviewer noted the class of bug survives a single-site fix: the nearby re-entry tests assert status === 126, so an inherited depth offset leaves them passing for the wrong reason, and the second spawn site deleted only the pid.

shimChildEnv strips OCX_SHIM_ACTIVE_PID, OCX_SHIM_ACTIVE_DEPTH and OCX_SHIM_PROBE_ACTIVE in one place, mirroring what probeUnixShimInstall already does before spawning its probe.

What it buys: a green run means what it says. Before, these tests measured whatever shim ancestry the developer shell carried, and were green in CI only because CI has no shimmed ancestor.

Verification

  • bun run typecheck passed.
  • bun test tests/codex-shim.test.ts 69 pass, 0 fail.

Checklist

  • Tests added or updated
  • Docs updated n/a
  • No credentials, request bodies, or account identifiers logged
  • Targets dev

Summary by CodeRabbit

  • Tests
    • Improved child-process test isolation by consistently clearing shim-related environment settings.
    • Updated re-entry and child-invocation tests to use the standardized environment setup.

The previous fix deleted both guard variables at one spawn site. A reviewer
pointed out the class of bug survives: the nearby re-entry tests assert status
126, so an inherited depth offset leaves them passing for entirely the wrong
reason, and the next test to spawn a shim starts the cycle again.

shimChildEnv strips PID, DEPTH and PROBE_ACTIVE in one place, mirroring what
probeUnixShimInstall already does before spawning its probe. The second spawn
site at line 291 had the same gap - it deleted only the pid - so it was quietly
depth-sensitive too.

What this buys is that a green run means what it says. Before, these tests
measured whatever shim ancestry the developer's shell happened to carry, and
were green in CI only because CI has no shimmed ancestor.
@lidge-jun
lidge-jun merged commit 87f7f97 into dev Aug 18, 2026
7 of 8 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 637e57de-b678-4089-acc8-cd1684b0e495

📥 Commits

Reviewing files that changed from the base of the PR and between 464ca6a and b0f1739.

📒 Files selected for processing (1)
  • tests/codex-shim.test.ts

📝 Walkthrough

Walkthrough

The test suite adds a shared shimChildEnv helper that removes three shim environment variables before child-process execution. The Unix re-entry and child-invocation tests now use this helper.

Changes

Shim environment tests

Layer / File(s) Summary
Sanitize child environments
tests/codex-shim.test.ts
Lines 10–32 add shimChildEnv, which clones the environment, applies overrides, and removes OCX_SHIM_ACTIVE_PID, OCX_SHIM_ACTIVE_DEPTH, and OCX_SHIM_PROBE_ACTIVE. Lines 314 and 1067 use the helper in the Unix re-entry and child-invocation tests.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: wibias, ingwannu

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/wave5-shim-env-helper

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

olddonkey pushed a commit to olddonkey/opencodex that referenced this pull request Aug 18, 2026
Gate on dev at 87f7f97: 12807 pass, 10 skip, 0 fail across 826 files, with
typecheck and privacy scan green. Promoted 107 commits to preview (a43150c)
and main (7979903), both verified by ancestry rather than by the merge
reporting success.

Recording which PRs did not exist when the campaign started - lidge-jun#1951, lidge-jun#1953,
lidge-jun#1955, lidge-jun#1960 and lidge-jun#1961 all came out of auditing the plan rather than executing
it. Two of them fix defects I introduced myself, which is the part of this
campaign most worth remembering.

Every remaining item carries its reason in the table rather than sitting
unexplained.
@lidge-jun
lidge-jun deleted the codex/wave5-shim-env-helper branch August 18, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant