Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/scripts/claude-lane-scope.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Comment thread
kyle-sexton marked this conversation as resolved.
Resolved
Expand Down
48 changes: 41 additions & 7 deletions .github/workflows/pr-review-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -527,6 +528,39 @@ 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. 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' && runner.os == 'Linux'
timeout-minutes: 1
env:
RUNNER_HOSTING: ${{ runner.environment }}
run: |
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 [ "$RUNNER_HOSTING" = github-hosted ] &&
[ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
Comment thread
kyle-sexton marked this conversation as resolved.
Resolved
fi
if ! command -v bwrap >/dev/null; then
echo "::error::bubblewrap is not installed; Claude Code cannot scrub its subprocess environment"
exit 1
fi
Comment thread
kyle-sexton marked this conversation as resolved.
Resolved

# 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
Expand All @@ -536,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
Expand Down Expand Up @@ -616,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");
Expand Down Expand Up @@ -671,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))
Expand All @@ -689,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
Expand Down Expand Up @@ -762,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 }}
Expand Down
40 changes: 37 additions & 3 deletions .github/workflows/pr-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -570,6 +571,39 @@ 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. 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' && runner.os == 'Linux'
timeout-minutes: 1
env:
RUNNER_HOSTING: ${{ runner.environment }}
run: |
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 [ "$RUNNER_HOSTING" = github-hosted ] &&
[ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
Comment thread
kyle-sexton marked this conversation as resolved.
Resolved
fi
if ! command -v bwrap >/dev/null; then
echo "::error::bubblewrap is not installed; Claude Code cannot scrub its subprocess environment"
exit 1
fi
Comment thread
kyle-sexton marked this conversation as resolved.
Resolved

# 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
Expand Down
Loading