Skip to content

Commit 464ca6a

Browse files
authored
Merge pull request #1960 from lidge-jun/codex/wave5-wp8-shim-env
fix(test): sanitize both shim recursion-guard variables
2 parents c3bf2c2 + 75a1b31 commit 464ca6a

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

‎devlog/_plan/260817_wave5_execution/080_wave5d_antigravity.md‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,48 @@ That is also the honest answer to "is the sponsorship refusal over-cautious": I
217217
because reviewing *someone else's* auth change is the maintainer act the label records — but a
218218
one-line auth fix I wrote and verified myself is exactly the case where a maintainer sponsors
219219
their own work, so it ships.
220+
### #1891 landed after all
221+
222+
The hold expired four minutes after I wrote it. The gate bot marked #1891 `review-ready` at
223+
02:10:50Z — the author rebased onto `9eb3a101a` and ticked all four boxes — so the checklist
224+
block described above and in my PR comments was accurate when posted and false shortly after.
225+
226+
Merged as `5c66ad205`, verified as an ancestor of `origin/dev`. No file overlap with #1955
227+
(`src/adapters/` vs `src/oauth/`), so nothing conflicted.
228+
229+
Wave 5D final state: **#1897 and #1891 and the #1955 fix landed; #1889 alone remains**, blocked
230+
on maintainer sponsorship of an auth surface.
231+
232+
### Full-suite result and the one failure
233+
234+
`bun test --isolate tests` on the merged tree: **12805 pass, 10 skip, 1 fail** across 826 files.
235+
236+
The failure is `Codex autostart shim > Unix shim permits a real Codex process to start a new
237+
child invocation`, failing with `status 126` — permission denied on exec. It is **environmental
238+
and pre-existing**, established three ways rather than assumed:
239+
240+
1. it reproduces solo, so it is not cross-test interference;
241+
2. it fails identically at the campaign baseline `1208bd25c`, which predates every change in
242+
this campaign;
243+
3. all four `test 1/4..4/4` shards passed in the dev CI run for `9eb3a101a`.
244+
245+
**Correction — I had the mechanism wrong, and a reviewer traced the real one.** I wrote that 126
246+
was the shell's "found but not executable" and that this sandbox blocks execution from a temp
247+
path. Neither is true: a `chmod 755` script in `mktemp -d` runs fine here, and `/var/folders` is
248+
not mounted `noexec`.
249+
250+
126 is **opencodex's own recursion-guard sentinel**. This shell exports
251+
`OCX_SHIM_ACTIVE_DEPTH=1` and `OCX_SHIM_ACTIVE_PID`, because the session itself was launched
252+
through an installed Codex shim. The test deleted only the pid, so the outer shim started at
253+
depth 1 instead of 0, the child re-entry reached depth 2, and the guard fired with its
254+
launcher-loop message — the shim behaving exactly as designed, on a test that meant to start
255+
from a clean slate. CI is green because CI has no shimmed ancestor, which is what made the
256+
failure look environmental rather than under-sanitized.
257+
258+
So the fix is a one-line test change, not an environment note: `delete env.OCX_SHIM_ACTIVE_DEPTH`
259+
beside the existing pid deletion. Left alone it stays red for every developer running the suite
260+
under an installed shim. Fixed here; the suite is now **12806 pass, 0 fail** locally.
261+
262+
Worth keeping as the lesson: "environmental" was the right disposition and the wrong
263+
explanation, and a plausible-sounding mechanism in a durable devlog is exactly what misleads
264+
whoever hits this next.

‎tests/codex-shim.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,14 @@ printf '%s\\n' child-codex
10431043
chmodSync(realCodexPath, 0o755);
10441044
chmodSync(shimPath, 0o755);
10451045
const env = { ...process.env, OCX_SHIM_BYPASS: "1" };
1046+
// Both recursion-guard variables, not just the pid. A developer running this suite from a
1047+
// shell that was itself launched through an installed shim inherits
1048+
// OCX_SHIM_ACTIVE_DEPTH=1, so the outer shim starts at depth 1, the child re-entry lands on
1049+
// depth 2, and the guard exits 126 with the launcher-loop message — the shim behaving
1050+
// exactly as designed, on a test that meant to start from a clean slate. CI never sees it
1051+
// because CI has no shimmed ancestor, which is what made this look environmental.
10461052
delete env.OCX_SHIM_ACTIVE_PID;
1053+
delete env.OCX_SHIM_ACTIVE_DEPTH;
10471054

10481055
const result = spawnSync(shimPath, ["--help"], {
10491056
encoding: "utf8",

0 commit comments

Comments
 (0)