Repository navigation
Description
Problem
The Nightly Test Suite (Tier 3) on main has failed two nights in a row (2026-11-18 run 44275791171, 2026-11-19 run 44498114213) with one failing file:
1/1113 test runs failed: test/agentToolPolicyRuntime.test.ts
not ok 5 - Codex entrypoint adds --trust to codex exec only when asked and the installed CLI offers it
expected ['codex','exec','--trust','--ephemeral','--json','-']
actual ['codex','exec','--ephemeral','--json','-']
Pull request CI passes the same test. The difference is the user: the nightly job runs on the self-hosted runner as root (/root/actions-runner-propr/...). The test extracts the codex_exec_offers_trust block from scripts/codex-entrypoint.sh and runs it with a stub codex first on PATH. In that block, when id -u is 0, the help text is read through su-exec node env HOME=/home/node … codex exec --help. su-exec and the node user exist in the agent image but not on the runner host, so the function returns 1 and --trust is not added.
This is a test that depends on the host it runs on (the same class as #3620), not a product defect: inside the image the root branch works.
Wanted
- The test passes whether it runs as root or as an ordinary user, on a host without
su-execand without anodeuser. - Both branches of
codex_exec_offers_trustare covered: the non-root branch and the root branch (throughsu-exec). scripts/codex-entrypoint.shbehaviour in the image does not change.
Implementation
In test/agentToolPolicyRuntime.test.ts, test 'Codex entrypoint adds --trust to codex exec only when asked and the installed CLI offers it':
- Make the user explicit instead of inherited. Put stub executables in the per-case bin directory that is already first on
PATH: anidstub that prints a chosen uid for-u(and passes other arguments to the realid), and asu-execstub that drops its first argument (the user) and execs the rest, sosu-exec node env HOME=… codex exec --helpreaches the stubcodex. - Run the existing assertions twice: once with the
idstub printing1000(non-root branch) and once printing0(root branch through thesu-execstub). Add one assertion for the root branch wheresu-execis missing or fails:--trustis not added and the command is otherwise unchanged. - Do not change
scripts/codex-entrypoint.shunless a real defect is found while doing this; if one is found, describe it in the PR. - Search the other tests that execute extracted blocks of
scripts/*-entrypoint.sh(same file andtest/*entrypoint*) for the same dependency onid -u,su-execor anodeuser, and fix those the same way. List what was checked in the PR description. - Verify:
npx tsx --test test/agentToolPolicyRuntime.test.tsas the current user, and once more with the process running as root if the environment allows it (for examplesudo -nor a container); if it cannot be run as root, say so and rely on the stubbedid. Lint with--max-warnings 0and typecheck.
No CHANGELOG entry (test only). One focused PR against main.
Activity
propr-dev commentedon Nov 19, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-53737/claude-opus-5-5-nightly-test-fails-on-a-r-20261119-2101-5hbmainissue-3737-20261119-2101-claude-opus-5-5-5hb🔍 Track Task Execution