Skip to content

Nightly test fails on a runner that runs as root: Codex entrypoint --trust test #3737

Closed

Description

@integry

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-exec and without a node user.
  • Both branches of codex_exec_offers_trust are covered: the non-root branch and the root branch (through su-exec).
  • scripts/codex-entrypoint.sh behaviour 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':

  1. Make the user explicit instead of inherited. Put stub executables in the per-case bin directory that is already first on PATH: an id stub that prints a chosen uid for -u (and passes other arguments to the real id), and a su-exec stub that drops its first argument (the user) and execs the rest, so su-exec node env HOME=… codex exec --help reaches the stub codex.
  2. Run the existing assertions twice: once with the id stub printing 1000 (non-root branch) and once printing 0 (root branch through the su-exec stub). Add one assertion for the root branch where su-exec is missing or fails: --trust is not added and the command is otherwise unchanged.
  3. Do not change scripts/codex-entrypoint.sh unless a real defect is found while doing this; if one is found, describe it in the PR.
  4. Search the other tests that execute extracted blocks of scripts/*-entrypoint.sh (same file and test/*entrypoint*) for the same dependency on id -u, su-exec or a node user, and fix those the same way. List what was checked in the PR description.
  5. Verify: npx tsx --test test/agentToolPolicyRuntime.test.ts as the current user, and once more with the process running as root if the environment allows it (for example sudo -n or a container); if it cannot be run as root, say so and rely on the stubbed id. Lint with --max-warnings 0 and typecheck.

No CHANGELOG entry (test only). One focused PR against main.

Activity

  1. propr-dev commented on Nov 19, 2026

    @propr-dev
    Contributor

    🤖 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:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 3737/claude-opus-5-5-nightly-test-fails-on-a-r-20261119-2101-5hb
    • Base Branch: main
    • Worktree: issue-3737-20261119-2101-claude-opus-5-5-5hb

    🔍 Track Task Execution

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions