Skip to content

fix(test): sanitize both shim recursion-guard variables - #1960

Merged
lidge-jun merged 3 commits into
devfrom
codex/wave5-wp8-shim-env
Aug 18, 2026
Merged

fix(test): sanitize both shim recursion-guard variables#1960
lidge-jun merged 3 commits into
devfrom
codex/wave5-wp8-shim-env

Conversation

@lidge-jun

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

Copy link
Copy Markdown
Owner

Summary

One test fix plus the Wave 5D record.

The test fix. tests/codex-shim.test.ts deleted OCX_SHIM_ACTIVE_PID from the child
environment but inherited OCX_SHIM_ACTIVE_DEPTH from the parent. Anyone running the suite from
a shell that was itself launched through an installed Codex shim carries DEPTH=1, so the outer
shim starts at depth 1 rather than 0, the child re-entry lands on depth 2, and the recursion
guard exits 126 with its launcher-loop message.

The shim was behaving exactly as designed. The test was starting from a slate it believed was
clean. CI never sees it because CI has no shimmed ancestor — which is precisely what made it look
like a machine quirk rather than an under-sanitized test.

Production code already does the right thing here: probeUnixShimInstall deletes PID, DEPTH
and PROBE_ACTIVE before spawning its probe. This brings the test in line with the runtime's own
practice.

I first recorded the cause as "the sandbox blocks execution from a temp path." That was wrong —
a chmod 755 script in mktemp -d runs fine, and /var/folders is not noexec — and a reviewer
traced the real mechanism. The devlog carries the correction, because a plausible-sounding wrong
explanation in a durable record is worse than none.

Wave 5D record. #1897 had already merged and #1836 was already closed before the phase ran.
#1891 landed (5c66ad205) once its author rebased and ticked its checklist. #1889 remains blocked
on maintainer sponsorship of src/oauth/ — a label that records a security review, so not one an
agent should apply to unblock a merge.

Verification

  • bun test tests/codex-shim.test.ts69 pass, 0 fail (was 68/1).
  • Full suite on the merged tree before this fix: 12805 pass, 10 skip, 1 fail — that one failure.
  • Pre-existing confirmed three ways: reproduces solo, fails identically at the campaign baseline 1208bd25c, and all four shards pass in dev CI run 32090176020.

Checklist

  • Tests added or updated
  • Docs updated — devlog records the outcome and the corrected mechanism
  • No credentials, request bodies, or account identifiers logged
  • Targets dev

Summary by CodeRabbit

  • Bug Fixes

    • Fixed a Unix shim test that could incorrectly report launcher recursion when inherited environment settings were present.
    • Improved test isolation by clearing recursion-guard state before child-process execution.
  • Tests

    • Updated full-suite results: 12,806 tests passing, 10 skipped, with no failures.

#1891's hold expired four minutes after I wrote it - the author rebased and
ticked all four boxes at 02:10:50Z - so it merged as 5c66ad2. Wave 5D is now
down to #1889 alone, blocked on maintainer sponsorship.

The full suite on the merged tree is 12805 pass, 10 skip, 1 fail. The failure is
the Unix shim autostart test failing with status 126, permission denied on exec,
and it is environmental rather than a regression: it reproduces solo, it fails
identically at the pre-campaign baseline 1208bd2, and all four test shards
passed in dev CI for 9eb3a10. The test writes a shim to a temp dir and
spawnSyncs it; this sandbox blocks execution from that path. Recorded rather
than skipped - the fix is an environment note, not a test change.
The autostart shim test deleted OCX_SHIM_ACTIVE_PID from the child environment
but inherited OCX_SHIM_ACTIVE_DEPTH from the parent. A developer running the
suite from a shell that was itself launched through an installed Codex shim
carries DEPTH=1, so the outer shim started at depth 1 rather than 0, the child
re-entry landed on depth 2, and the guard exited 126 with its launcher-loop
message. The shim was behaving exactly as designed; the test was starting from
a slate it believed was clean.

CI never sees this because CI has no shimmed ancestor, which is precisely what
made it look like a machine quirk.

I had recorded the cause as the sandbox blocking execution from a temp path.
That was wrong - a chmod 755 script in mktemp -d runs fine here and /var/folders
is not mounted noexec - and a reviewer traced the real mechanism. The devlog now
carries the correction, because a plausible-sounding wrong explanation in a
durable record is worse than no explanation.
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 18, 2026
@lidge-jun
lidge-jun merged commit 464ca6a into dev Aug 18, 2026
8 of 9 checks passed
@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: 98980f50-0e53-4614-a272-c1d074bfd816

📥 Commits

Reviewing files that changed from the base of the PR and between c3bf2c2 and 75a1b31.

📒 Files selected for processing (2)
  • devlog/_plan/260817_wave5_execution/080_wave5d_antigravity.md
  • tests/codex-shim.test.ts

📝 Walkthrough

Walkthrough

The child-invocation Codex shim test now clears inherited recursion-guard variables. The execution log records the corrected cause and the final suite result: 12,806 passing tests, 10 skipped tests, and no failures.

Changes

Codex shim recursion-guard correction

Layer / File(s) Summary
Clear inherited guard state
tests/codex-shim.test.ts:1046-1053
The child-invocation test deletes OCX_SHIM_ACTIVE_PID and OCX_SHIM_ACTIVE_DEPTH before spawning the shim.
Record verified suite result
devlog/_plan/260817_wave5_execution/080_wave5d_antigravity.md:220-264
The execution log records the wave status, identifies inherited OCX_SHIM_ACTIVE_DEPTH as the failure cause, and records 12,806 passing tests with zero failures.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • lidge-jun/opencodex#1441: Updates the same child-invocation recursion-guard test by clearing inherited guard variables.

Suggested labels: review-ready

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-wp8-shim-env

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-wp8-shim-env 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

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant