Skip to content

feat(pr-pipeline): install lane skill dependencies on demand - #7786

Merged
kyle-sexton merged 9 commits into
mainfrom
feat/lanes-keep-docker-sudo-setup-env
Oct 17, 2026
Merged

kyle-sexton merged 9 commits into
mainfrom
feat/lanes-keep-docker-sudo-setup-env

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

No related issue: lets a lane skill run the repository's Python and Node tests by installing their dependencies on demand.

Summary

Lane runners installed no Python or test tooling before a skill ran, so a lane could not run the repository's Python and Node tests. One repo-owned script now installs those dependencies on demand. The "Remove sudo and docker access" step stays as on main: the owner chose to keep the strip (thread), and every install below works without sudo.

Fix

  • New scripts/setup-env.sh: idempotent (records the lock-file hash per step, skips while it matches). Installs Python at .python-version in a venv with the hash-pinned wheels from .github/requirements-ci.txt (--only-binary=:all: --require-hashes, as pr-require-checks.yml does), runs npm ci at the root and in .github/standards/runner-policy, and installs Playwright's Chromium only with --playwright or SETUP_ENV_PLAYWRIGHT=1 (--with-deps only when sudo works, per https://playwright.dev/docs/ci). Under Actions it adds the venv and node_modules/.bin to GITHUB_PATH.
  • pr-run-activity-read.yml and pr-run-activity-write.yml, for a skill: after the runner isolation step (which still removes sudo and docker) and before the head checkout (which replaces .base), copy the base's script and the files it installs from to $RUNNER_TEMP/setup-env; then run setup-python and the script before the model step. Both install from the base copies only, so no head code runs outside the skill's sandboxed Bash (ADR 0055 items 5 and 7, write-runner-never-rules.test.sh). A base without the script skips with a notice. The lanes never pass --playwright.
  • No sudo needed after the strip: setup-python installs into the runner-owned tool cache (its installer, nix-setup-template.sh, runs no sudo), pip installs into a venv under $RUNNER_TEMP, and npm ci already runs after the strip in eval-browser-dispatch.yml.
  • pr-run-activity.md steps 11 and 12 and the pr-pipeline CHANGELOG (2.3.0) describe the copy and install. Step 10, ADR 0055 and the runner-memory threat note are unchanged from main.

Verification

  • node --test scripts/setup-env.test.mjs: 12 pass (stubbed python/uv/npm/node/sudo; idempotent rerun, changed lock and requirements, SETUP_ENV_VENV, uv fallback, Playwright only on request, GITHUB_PATH, no-Python failure, usage error). A forced mutant (Playwright always on) failed 4 of them.
  • Real run of scripts/setup-env.sh in the worktree: venv on Python 3.14 with pytest, both npm cis; the second run skipped every step.
  • scripts/check-affected.sh --tests: 7 passed, 2 skipped. scripts/affected-tests.sh --run: 11 shell suites pass, including write-runner-never-rules.test.sh and write-runner-revoke-step.test.sh; test_babysit_dependabot.py: 55 pass.
  • actionlint, zizmor --persona=regular (no findings), markdownlint-cli2: clean.
  • Left out: no live lane run; the workflow change runs only once it is on the base.

Related

  • Security thread: the owner chose to keep the sudo and docker strip.
  • The write runner keeps an older setup-python and pytest install for the run-test-file wrapper beside the new venv; left as is.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43

kyle-sexton and others added 2 commits October 17, 2026 15:07
… demand

setup-runner-isolation no longer removes sudo and docker access; it still
installs bubblewrap and socat for a skill. Lanes keep both for now (owner
decision 2026-10-17), to be re-evaluated in the lanes audit.

scripts/setup-env.sh installs, idempotently, Python at .python-version in a
venv with the hash-pinned wheels from .github/requirements-ci.txt, the locked
root and runner-policy Node packages, and Playwright's Chromium only with
--playwright or SETUP_ENV_PLAYWRIGHT=1. The read and write lane runners copy
it from the base before the head checkout and run it before a skill
activity: the read runner against the head checkout, the write runner
against the base copies, since its skill runs no head code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43
The read runner ran setup-env.sh against the head checkout, so npm ci ran
head install scripts outside the skill's sandbox, before the step holding
the OAuth token, and put head-built bin dirs on GITHUB_PATH. Both runners
now install from the base copies in $RUNNER_TEMP/setup-env; a read skill
that needs the head's own packages runs npm ci in its sandboxed Bash.

setup-env.sh runs Python with -I and passes the version through argv,
and treats a venv whose interpreter no longer starts as stale. Tests cover
a changed requirements file, SETUP_ENV_VENV and the uv fallback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 17, 2026 19:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T19:19:26.417755Z c3daf03 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3daf03a3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/setup-env.sh Resolved
Comment thread scripts/setup-env.sh Resolved
kyle-sexton and others added 2 commits October 17, 2026 15:21
The editorconfig gate in lint-repo rejected the tab indentation Biome's
unconfigured default wrote into scripts/setup-env.test.mjs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 321c2aec739bad051e67f44b2b73f5fdda5ae135: 0 finding(s), 0 as inline comments.

Security review: PR 7786 at head 321c2ae

I found no security issues. I read the diff and the surrounding workflow context myself and ran no verifier subagents. The diff removes no standing instruction, so I did not consult the instruction exception register.

Scope. The PR adds scripts/setup-env.sh and its tests. It also adds a "copy the base's setup, then install" step pair to pr-run-activity-read.yml and pr-run-activity-write.yml, plus a convention doc and changelog.

What I checked

  • Install source: The install reads only base-derived inputs: setup-env.sh, .python-version, requirements-ci.txt and the lockfiles. They are copied from .base into $RUNNER_TEMP/setup-env before the head checkout replaces .base. .base is the default-branch tip (pr-run-activity-read.yml:92), so no head-controlled file reaches pip or npm ci.
  • Working directory: setup-env.sh does cd "$root" into the base copy, so the install runs outside the head workspace even though the step runs there.
  • Python install: It runs python -I -m pip install --require-hashes --only-binary=:all:, so wheels are hash-pinned and no sdist build runs.
  • Secrets during install: The install steps hold only SETUP_ENV_VENV and the runner defaults. The lane token and the OAuth token are not in their environment, so npm ci lifecycle scripts from the base lockfile have no secret to read.
  • Ordering: The install runs after sudo and docker are removed (isolation step) and before the skill step, so it needs no privilege.
  • Merge-base mode: The install is gated to a conflicted merge, and node_modules is gitignored. The staged-merge tree comes from the validated index, so the copied node_modules cannot enter the merge commit.

Residual observations (not reported as findings; I found no concrete exploit path in this diff)

  • Symlinked parent directory: The copy loop does rm -rf "$GITHUB_WORKSPACE/$dir/node_modules" and then cp -R, with dir set to . and .github/standards/runner-policy.
    • If the PR head makes .github/standards/runner-policy a symlink, the loop deletes and writes node_modules under the symlink's target.
    • The content written is base-built and only node_modules is touched, so I see no gain from it. A [ ! -L ] check on the parent would still be cheap.
  • PATH entries under $RUNNER_TEMP: setup-env.sh appends the venv bin and $root/node_modules/.bin to GITHUB_PATH for every later step, and both live under $RUNNER_TEMP.
    • The write workflow already treats the activity as able to tamper with $RUNNER_TEMP and PATH: it SHA-checks the copied merge scripts, and its commit step pins PATH: /usr/bin:/bin.
    • I did not confirm whether the skill's Bash can write the venv bin.
    • Later steps that hold LANE_TOKEN call bare jq. If that directory is writable, a planted binary there would run with the token. The model can already read that token, per the workflow's own comment, so I judged the added exposure marginal.
    • Hash-checking or chmod-locking the venv and node_modules/.bin after install would close it if the maintainers want that margin.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 321c2aec739bad051e67f44b2b73f5fdda5ae135: 2 finding(s), 2 as inline comments.

Summary: I reported one likely defect, as two inline comments (one per workflow file). I did not run the workflows. No live lane run exists, so this review is by reading the diff only.

Finding (plausible, not confirmed): Both new "Set up Python for the skill" steps pass python-version-file: ${{ runner.temp }}/setup-env/.python-version, an absolute path.

  • As I recall, actions/setup-python joins that input onto GITHUB_WORKSPACE, so the file would not be found and the step would fail. That fails the skill job on every lane where the base has setup-env.sh.
  • I couldn't fetch the action source to check this. Every other python-version-file in the repo is workspace-relative.
  • Suggested fix: read the version into a step output in the copy step and pass it as python-version.
  • Locations: .github/workflows/pr-run-activity-read.yml:330 and .github/workflows/pr-run-activity-write.yml:926.

Not flagged: scripts/setup-env.sh, its tests, and the docs and CHANGELOG changes read as consistent with the PR description. The test results and actionlint/zizmor outcomes in the PR body are author-claimed and unverified by me.

Node resolves a package from the importing file's directory, so the
base-built node_modules under $RUNNER_TEMP/setup-env were invisible to the
checkout's tests (runner-policy's yaml and ajv). Both lane runners now copy
the root and runner-policy trees into the checkout after the install.

setup-env.sh resolves a relative --root to an absolute path before it
changes directory, so the venv and the GITHUB_PATH entries no longer nest
under the root twice. The step docs stop calling the skill's Bash
sandboxed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43
…r-sudo-setup-env

The pr-pipeline CHANGELOG conflict keeps both entries: this branch's entry
becomes 2.1.0 above main's 2.0.0, with `version` staying 2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43
…r-sudo-setup-env

The pr-pipeline CHANGELOG conflict keeps every entry: this branch's entry
becomes 2.3.0 above main's new 2.2.0 and 2.1.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43
kyle-sexton and others added 2 commits October 17, 2026 17:28
Restore the "Remove sudo and docker access" step in setup-runner-isolation
and the convention, ADR 0055 and eval-browser-dispatch text that describes
it, as on main. The on-demand dependency install stays: the base copy now
runs after the strip, and setup-python, the venv pip install and npm ci
need no sudo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AfcE6qXwStK92XAx21MG43
@kyle-sexton kyle-sexton changed the title feat(pr-pipeline): let lanes keep docker and sudo and install deps on demand feat(pr-pipeline): install lane skill dependencies on demand Oct 17, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 17, 2026
Merged via the queue into main with commit 390f89f Oct 17, 2026
47 of 49 checks passed
@kyle-sexton
kyle-sexton deleted the feat/lanes-keep-docker-sudo-setup-env branch October 17, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant