From 86746973f74db7b3a66b268cc903b97acd6300de Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Sat, 17 Oct 2026 14:50:47 -0400 Subject: [PATCH 1/2] fix(review): install bubblewrap before the review lanes run Claude Code #756 set CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1 on both review attempts. Claude Code 2.1.300 on Linux refuses to start with the scrub on and no bubblewrap, and claude-code-action installs bubblewrap only when allowed_non_write_users is set, so every review lane failed while installing Claude Code. Install bubblewrap and socat before the first attempt, with apt retries and the AppArmor userns sysctl, and fail closed without bwrap. The scrub stays on. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43 --- .github/workflows/pr-review-security.yml | 24 ++++++++++++++++++++++++ .github/workflows/pr-review.yml | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/.github/workflows/pr-review-security.yml b/.github/workflows/pr-review-security.yml index 113fe208..d0a84efb 100644 --- a/.github/workflows/pr-review-security.yml +++ b/.github/workflows/pr-review-security.yml @@ -527,6 +527,30 @@ jobs: echo "fallback=$HAS_FALLBACK" } >> "$GITHUB_OUTPUT" + # With CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1, Claude Code on Linux will not + # start without bubblewrap ("bubblewrap is required for subprocess env + # scrubbing and isolation", v2.1.300). claude-code-action installs it + # only for allowed_non_write_users (action.yml, "Install subprocess + # isolation dependencies"), so this step does the same for both review + # attempts and fails closed without bwrap. + - name: Install subprocess isolation + if: steps.scope.outputs.review != 'false' + run: | + for i in 1 2 3; do + sudo apt-get update -qq && + sudo apt-get install -y --no-install-recommends bubblewrap socat && break + echo "apt-get attempt $i failed, retrying..." + sleep 5 + done + # Ubuntu 24.04 restricts unprivileged user namespaces via AppArmor. + if [ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + fi + if ! command -v bwrap >/dev/null; then + echo "::error::bubblewrap is not installed; Claude Code cannot scrub its subprocess environment" + exit 1 + fi + # continue-on-error keeps an infrastructure failure from ending the job # before the outcome step classifies it; the last step carries the red. # The pick step's first-attempt timeout repeats timeout-minutes. The diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index 6464c97a..fef6b7ea 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -570,6 +570,30 @@ jobs: echo "fallback=$HAS_FALLBACK" } >> "$GITHUB_OUTPUT" + # With CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1, Claude Code on Linux will not + # start without bubblewrap ("bubblewrap is required for subprocess env + # scrubbing and isolation", v2.1.300). claude-code-action installs it + # only for allowed_non_write_users (action.yml, "Install subprocess + # isolation dependencies"), so this step does the same for both review + # attempts and fails closed without bwrap. + - name: Install subprocess isolation + if: steps.scope.outputs.review != 'false' + run: | + for i in 1 2 3; do + sudo apt-get update -qq && + sudo apt-get install -y --no-install-recommends bubblewrap socat && break + echo "apt-get attempt $i failed, retrying..." + sleep 5 + done + # Ubuntu 24.04 restricts unprivileged user namespaces via AppArmor. + if [ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + fi + if ! command -v bwrap >/dev/null; then + echo "::error::bubblewrap is not installed; Claude Code cannot scrub its subprocess environment" + exit 1 + fi + # continue-on-error keeps an infrastructure failure from ending the job # before the outcome step classifies it; the last step carries the red. # The pick step's first-attempt timeout repeats timeout-minutes. The From bd64d9cbfce9cdb04a916ebc3701e9526028c69b Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Sat, 17 Oct 2026 15:00:53 -0400 Subject: [PATCH 2/2] fix(review): gate the isolation install to Linux and reserve its job time Run the bubblewrap install only on Linux, skip apt-get where it is absent (bwrap must then be present), lift the AppArmor userns sysctl only on GitHub-hosted runners, and bound the step at one minute. The code lane's job timeout rises from 13 to 16 minutes; the security lane is already at the 16-minute ceiling, so its review step budget drops from 14 to 13 minutes to keep the measured 38 s of slack. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43 --- .github/scripts/claude-lane-scope.test.cjs | 4 +-- .github/workflows/pr-review-security.yml | 42 +++++++++++++--------- .github/workflows/pr-review.yml | 34 +++++++++++------- 3 files changed, 50 insertions(+), 30 deletions(-) diff --git a/.github/scripts/claude-lane-scope.test.cjs b/.github/scripts/claude-lane-scope.test.cjs index 4813ffc8..46be3b1f 100644 --- a/.github/scripts/claude-lane-scope.test.cjs +++ b/.github/scripts/claude-lane-scope.test.cjs @@ -245,8 +245,8 @@ test("both lanes run the same scope and record scripts", () => { test("each review step leaves its job the measured overhead", () => { for (const [lane, step, job] of [ - [codeLane, 11, 13], - [securityLane, 14, 16], + [codeLane, 11, 16], + [securityLane, 13, 16], ]) { const claudeStep = lane.job.steps.find( (candidate) => candidate.id === "claude-review", diff --git a/.github/workflows/pr-review-security.yml b/.github/workflows/pr-review-security.yml index d0a84efb..b3d0fbff 100644 --- a/.github/workflows/pr-review-security.yml +++ b/.github/workflows/pr-review-security.yml @@ -72,7 +72,7 @@ name: pr-review-security # in pr-review.yml (see its header), with lane id `claude-security-review`; # this lane reviews from the API diff and writes no full diff of its own. The # usage-limit fallback works as in pr-review.yml, with lane name `Claude -# security review` and the 14-minute step budget. The +# security review` and the 13-minute step budget. The # check is advisory (github-iac ADR 0011 keeps agentic review # advisory, and `ci-status` is the only required check); do not make it # required. @@ -195,7 +195,8 @@ jobs: # Capped at the 16-minute ceiling set for every CI job (960 s). Outside the # review step, 1,366 successful jobs on claude-code-plugins (2026-09-29 to # 2026-10-01) took p95 17 s, max 82 s, and the scope and record steps took - # 1 s each on ci-workflows#653, so the step gets 14 minutes (840 s); + # 1 s each on ci-workflows#653; after the 1-minute isolation install the + # step gets 13 minutes (780 s), which leaves 38 s; # incremental scoping, not a longer step, shortens the reviews that reach it. timeout-minutes: 16 # The draft and fork tests are scoped to pull_request so a privileged @@ -532,18 +533,27 @@ jobs: # scrubbing and isolation", v2.1.300). claude-code-action installs it # only for allowed_non_write_users (action.yml, "Install subprocess # isolation dependencies"), so this step does the same for both review - # attempts and fails closed without bwrap. + # attempts and fails closed without bwrap. Linux only: the requirement is + # Linux's, and a runner without apt-get must already have bwrap. The + # AppArmor sysctl is lifted only on GitHub-hosted runners, which are + # discarded after the job, so no reused host keeps the change. - name: Install subprocess isolation - if: steps.scope.outputs.review != 'false' + if: steps.scope.outputs.review != 'false' && runner.os == 'Linux' + timeout-minutes: 1 + env: + RUNNER_HOSTING: ${{ runner.environment }} run: | - for i in 1 2 3; do - sudo apt-get update -qq && - sudo apt-get install -y --no-install-recommends bubblewrap socat && break - echo "apt-get attempt $i failed, retrying..." - sleep 5 - done + if command -v apt-get >/dev/null; then + for i in 1 2 3; do + sudo apt-get update -qq && + sudo apt-get install -y --no-install-recommends bubblewrap socat && break + echo "apt-get attempt $i failed, retrying..." + sleep 5 + done + fi # Ubuntu 24.04 restricts unprivileged user namespaces via AppArmor. - if [ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then + if [ "$RUNNER_HOSTING" = github-hosted ] && + [ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 fi if ! command -v bwrap >/dev/null; then @@ -560,7 +570,7 @@ jobs: id: claude-review if: steps.scope.outputs.review != 'false' continue-on-error: true - timeout-minutes: 14 + timeout-minutes: 13 uses: anthropics/claude-code-action@a26b07d8c778b0c43f64618e5fd29fd0f8af72e8 # v1.0.250 env: # The action stops reading at Claude's first result message @@ -640,7 +650,7 @@ jobs: env: EXECUTION_FILE: ${{ steps.claude-review.outputs.execution_file }} STARTED_AT: ${{ steps.compose-args.outputs.started-at }} - BUDGET_MINUTES: "14" + BUDGET_MINUTES: "13" with: script: | const fs = require("node:fs"); @@ -695,7 +705,7 @@ jobs: if: steps.first-outcome.outputs.retry == 'true' env: STARTED_AT: ${{ steps.compose-args.outputs.started-at }} - BUDGET_MINUTES: "14" + BUDGET_MINUTES: "13" run: | now="$(date +%s)" left=$(((BUDGET_MINUTES * 60 - (now - STARTED_AT)) / 60)) @@ -713,7 +723,7 @@ jobs: id: claude-review-fallback if: steps.fallback.outputs.run == 'true' continue-on-error: true - timeout-minutes: ${{ fromJSON(steps.fallback.outputs.timeout-minutes || '14') }} + timeout-minutes: ${{ fromJSON(steps.fallback.outputs.timeout-minutes || '13') }} uses: anthropics/claude-code-action@a26b07d8c778b0c43f64618e5fd29fd0f8af72e8 # v1.0.250 env: # The action stops reading at Claude's first result message @@ -786,7 +796,7 @@ jobs: FIRST_OUTCOME: ${{ steps.claude-review.outcome }} FIRST_EXECUTION_FILE: ${{ steps.claude-review.outputs.execution_file }} FIRST_STARTED_AT: ${{ steps.compose-args.outputs.started-at }} - FIRST_TIMEOUT_MINUTES: "14" + FIRST_TIMEOUT_MINUTES: "13" FIRST_STRUCTURED_OUTPUT: ${{ steps.claude-review.outputs.structured_output }} FALLBACK_RAN: ${{ steps.fallback.outputs.run }} FALLBACK_OUTCOME: ${{ steps.claude-review-fallback.outcome }} diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index fef6b7ea..52b3744d 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -202,12 +202,13 @@ jobs: # The review step stops at 11 minutes (660 s); incremental scoping, not a # longer step, shortens the reviews that reached it. Outside that step, # 1,169 successful jobs on claude-code-plugins (2026-09-29 to 2026-10-01) - # took p95 17 s, max 82 s, which leaves 38 s of 13 minutes (780 s) for the - # scope and record steps; they took 1 s each on ci-workflows#653. The + # took p95 17 s, max 82 s; with the 1-minute isolation install that leaves + # 158 s of 16 minutes (960 s) for the scope and record steps; they took + # 1 s each on ci-workflows#653. The # full-diff and verify steps are not yet measured: a fetch, a local diff # and one API listing. A job that still runs out never concludes # success, so the check never claims a review it did not finish. - timeout-minutes: 13 + timeout-minutes: 16 # The draft and fork tests are scoped to pull_request so a privileged # trigger still reaches the tripwire. A bot passes only when the event # sender's id is in allowed-bot-sender-ids. An empty or malformed list @@ -575,18 +576,27 @@ jobs: # scrubbing and isolation", v2.1.300). claude-code-action installs it # only for allowed_non_write_users (action.yml, "Install subprocess # isolation dependencies"), so this step does the same for both review - # attempts and fails closed without bwrap. + # attempts and fails closed without bwrap. Linux only: the requirement is + # Linux's, and a runner without apt-get must already have bwrap. The + # AppArmor sysctl is lifted only on GitHub-hosted runners, which are + # discarded after the job, so no reused host keeps the change. - name: Install subprocess isolation - if: steps.scope.outputs.review != 'false' + if: steps.scope.outputs.review != 'false' && runner.os == 'Linux' + timeout-minutes: 1 + env: + RUNNER_HOSTING: ${{ runner.environment }} run: | - for i in 1 2 3; do - sudo apt-get update -qq && - sudo apt-get install -y --no-install-recommends bubblewrap socat && break - echo "apt-get attempt $i failed, retrying..." - sleep 5 - done + if command -v apt-get >/dev/null; then + for i in 1 2 3; do + sudo apt-get update -qq && + sudo apt-get install -y --no-install-recommends bubblewrap socat && break + echo "apt-get attempt $i failed, retrying..." + sleep 5 + done + fi # Ubuntu 24.04 restricts unprivileged user namespaces via AppArmor. - if [ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then + if [ "$RUNNER_HOSTING" = github-hosted ] && + [ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 fi if ! command -v bwrap >/dev/null; then