Skip to content

Commit 746cb85

Browse files
authored
fix(review): enable hosted Linux sandbox (#1162)
1 parent dc67620 commit 746cb85

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎.github/actions/setup-codex/action.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,28 @@ runs:
5252
fi
5353
codex --version
5454
55+
- name: Enable Linux user namespaces for bubblewrap
56+
if: ${{ runner.os == 'Linux' && runner.environment == 'github-hosted' }}
57+
shell: bash
58+
run: |
59+
set -euo pipefail
60+
61+
# Codex read-only reviews use bubblewrap. Newer Ubuntu images otherwise
62+
# reject its loopback setup before the first repository command runs.
63+
current_userns="$(sysctl -n kernel.unprivileged_userns_clone 2>/dev/null || true)"
64+
if [[ -n "$current_userns" && "$current_userns" != "1" ]]; then
65+
sudo sysctl -w kernel.unprivileged_userns_clone=1
66+
fi
67+
68+
current_apparmor="$(sysctl -n kernel.apparmor_restrict_unprivileged_userns 2>/dev/null || true)"
69+
if [[ -n "$current_apparmor" && "$current_apparmor" != "0" ]]; then
70+
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
71+
fi
72+
73+
# Exercise the same read-only, network-isolated backend used by reviews.
74+
# A sandbox regression must stop the job before it can publish a verdict.
75+
codex sandbox --permission-profile :read-only -C "$GITHUB_WORKSPACE" -- /bin/true
76+
5577
- name: Resolve Codex home
5678
shell: bash
5779
run: |

‎test/clawsweeper.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,6 +2346,13 @@ test("agent workflows install pinned CLI releases and keep runner models secret"
23462346
assert.doesNotMatch(localCheck, /gpt-5\.5/);
23472347
assert.match(action, /env -u OPENAI_API_KEY[\s\S]*-u CLAWSWEEPER_INTERNAL_MODEL/);
23482348
assert.equal(action.match(/--ignore-scripts/g)?.length, 2);
2349+
assert.match(action, /runner\.os == 'Linux' && runner\.environment == 'github-hosted'/);
2350+
assert.match(action, /kernel\.unprivileged_userns_clone=1/);
2351+
assert.match(action, /kernel\.apparmor_restrict_unprivileged_userns=0/);
2352+
assert.match(
2353+
action,
2354+
/codex sandbox --permission-profile :read-only -C "\$GITHUB_WORKSPACE" -- \/bin\/true/,
2355+
);
23492356
for (const workflow of workflows) {
23502357
assert.match(workflow, /CLAWSWEEPER_MODEL: internal/);
23512358
assert.match(workflow, /CLAWSWEEPER_INTERNAL_MODEL: \$\{\{ secrets\.CLAWSWEEPER_MODEL \}\}/);

0 commit comments

Comments
 (0)