Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
refactor(codex-cloud): replace the Taskfile and mise with a shell script (#3839)
Maximilian Roosd73ce6915814
diff --git a/.claude/skills/running-tend/SKILL.md b/.claude/skills/running-tend/SKILL.mdindex 9ca22410a..7181c1bfd 100644--- a/.claude/skills/running-tend/SKILL.md+++ b/.claude/skills/running-tend/SKILL.md@@ -301,7 +301,7 @@ For each weekly run, check upstream and bump:- **`baptiste0928/cargo-install@v3` blocks** in `.github/workflows/{affected,ci,coverage,nightly}.yaml` and `.github/actions/{test,claude}-setup/action.yaml` — every `version: "=X.Y.Z"` against `cargo info <crate>`. Today: `cargo-affected`, `cargo-insta`, `cargo-nextest`, `cargo-llvm-cov`, `cargo-msrv`, `cargo-udeps`, `lychee`, `worktrunk`. `cargo-affected` is pinned twice in `affected.yaml`; move both together. Verify each crate's `rust-version` against the pinned toolchain and note compatibility in the PR body (see PR #1657 for the format).- **`hustcer/setup-nu@v3`** `version:` input — latest from `gh api repos/nushell/nushell/releases/latest --jq '.tag_name'`. Four call sites: `coverage.yaml` (`code-coverage`), `nightly.yaml` (`feature-powerset`), `benchmarks.yaml` (`benchmarks`), and `actions/test-setup/action.yaml`.-- **Codex Cloud tools** — `scripts/codex-cloud/Taskfile.yaml` pins Task through mise, pre-commit through uv, and cargo-insta, cargo-nextest, Nushell, and PowerShell archives with SHA-256 checksums. Keep overlapping versions aligned with CI and `setup-web`, update changed archive checksums, then copy the Taskfile's new digest into both README launchers.+- **Codex Cloud tools** — `scripts/codex-cloud/codex.sh` pins pre-commit through uv, and Task, cargo-insta, cargo-nextest, Nushell, and PowerShell archives with SHA-256 checksums. Keep overlapping versions aligned with CI and `setup-web`, and update changed archive checksums.- **`taiki-e/[email protected]`** `tool: zola@<ver>` in the `check-docs` job — latest from `gh api repos/getzola/zola/releases/latest --jq '.tag_name'`.- **Runner images** — `ubuntu-24.04`, `macos-15`, `windows-2022`. Keep `windows-2022` pinned (actions/runner-images#12677 — windows-2025 lacks the D: drive).diff --git a/CLAUDE.md b/CLAUDE.mdindex c7a1d4fb6..8bd91f613 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -7,7 +7,7 @@ cargo run -- hook pre-merge --yes # all tests + lints (runs automatically in w```Claude Code web: run `task setup-web` first. Test commands, isolation, and coverage investigation: `tests/CLAUDE.md`.-Codex Cloud: use the checksum-gated setup in `scripts/codex-cloud/README.md`.+Codex Cloud: use the setup in `scripts/codex-cloud/README.md`.## Project Statusdiff --git a/Taskfile.yaml b/Taskfile.yamlindex ba74f8f44..ade2ff537 100644--- a/Taskfile.yaml+++ b/Taskfile.yaml@@ -26,16 +26,6 @@ tasks:- bash -c 'time "$@"' bash cargo nextest run --features shell-integration-tests {{.CLI_ARGS}}- echo "per-test timings in target/nextest/default/junit.xml"- setup-codex:- desc: Setup Codex Cloud universal image (root only)- platforms: [linux]- cmd: task --taskfile scripts/codex-cloud/Taskfile.yaml setup-codex-- maintain-codex:- desc: Maintain Codex Cloud universal image (root only)- platforms: [linux]- cmd: task --taskfile scripts/codex-cloud/Taskfile.yaml maintain-codex-setup-web:desc: Setup Claude Code web environment for developmentplatforms: [linux]diff --git a/scripts/codex-cloud/README.md b/scripts/codex-cloud/README.mdindex 6fd6e5109..9c1d37f70 100644--- a/scripts/codex-cloud/README.md+++ b/scripts/codex-cloud/README.md@@ -6,19 +6,15 @@ and no variables or secrets.Setup command:```bash-TASKFILE_SHA=f14dbc890ec1a08163efffc63bd1dd750beb820afe18a2941f846e2b1b2c7227; printf '%s %s\n' "$TASKFILE_SHA" scripts/codex-cloud/Taskfile.yaml | sha256sum -c - && MISE_NO_CONFIG=1 MISE_HTTP_RETRIES=6 mise x [email protected] -- task -t scripts/codex-cloud/Taskfile.yaml setup-codex+bash scripts/codex-cloud/codex.sh setup```Maintenance command:```bash-TASKFILE_SHA=f14dbc890ec1a08163efffc63bd1dd750beb820afe18a2941f846e2b1b2c7227; printf '%s %s\n' "$TASKFILE_SHA" scripts/codex-cloud/Taskfile.yaml | sha256sum -c - && MISE_NO_CONFIG=1 MISE_HTTP_RETRIES=6 mise x [email protected] -- task -t scripts/codex-cloud/Taskfile.yaml maintain-codex+bash scripts/codex-cloud/codex.sh maintain```-The hash prevents a task branch from changing code run as root. After a reviewed-Taskfile change reaches the default branch, update both environment commands;-the settings change invalidates the cache.-The agent remains root. Toolchain-sensitive Rustup and pre-commit steps run as`ubuntu`; the Cargo wrapper also runs builds and tests as `ubuntu` under `tini`,matching the suite's permission and child-reaping assumptions.diff --git a/scripts/codex-cloud/Taskfile.yaml b/scripts/codex-cloud/Taskfile.yamldeleted file mode 100644index 5a1e5f9da..000000000--- a/scripts/codex-cloud/Taskfile.yaml+++ /dev/null@@ -1,151 +0,0 @@-version: "3"--vars:- CODEX_REPO_ROOT: "{{.TASKFILE_DIR}}/../.."- TASK_VERSION: "3.52.0"- PRE_COMMIT_VERSION: "4.6.2"- INSTA_VERSION: "1.48.0"- NEXTEST_VERSION: "0.9.143"- NU_VERSION: "0.115.0"- PWSH_VERSION: "7.6.5"--tasks:- setup-codex:- desc: Setup Codex Cloud universal image (root only)- platforms: [linux]- dir: "{{.CODEX_REPO_ROOT}}"- preconditions:- - sh: test "$(id -u)" = 0 && test "$(id -u ubuntu 2>/dev/null)" = 1000- msg: Codex Cloud setup requires root and the universal image's ubuntu user- env:- DEBIAN_FRONTEND: noninteractive- MISE_HTTP_RETRIES: 6- MISE_NO_CONFIG: "1"- cmds:- - |- set -euo pipefail-- apt-get update -qq- apt-get install -y -qq --no-install-recommends software-properties-common- add-apt-repository -y ppa:git-core/ppa- apt-get update -qq- apt-get install -y -qq --no-install-recommends git zsh fish xz-utils lsof tini-- mise use --global task@{{.TASK_VERSION}}- uv tool install pre-commit=={{.PRE_COMMIT_VERSION}}- install -d /root/.local/bin-- tools_tmp="$(mktemp -d)"- download() {- curl -fsSL --retry 6 --retry-all-errors --retry-delay 2 \- "$1" -o "$tools_tmp/$3"- printf '%s %s\n' "$2" "$tools_tmp/$3" | sha256sum -c -- }- install_binary() {- download "$1" "$2" "$3"- case "$3" in- *.tar.xz) tar -xJf "$tools_tmp/$3" -C "$tools_tmp" ;;- *.tar.gz) tar -xzf "$tools_tmp/$3" -C "$tools_tmp" ;;- esac- install -m 0755 "$tools_tmp/$4" "$5"- }-- install_binary \- https://github.com/mitsuhiko/insta/releases/download/{{.INSTA_VERSION}}/cargo-insta-x86_64-unknown-linux-gnu.tar.xz \- 1c05a480a5a7f755f0ea15b2d8e2f71ad51b9c3a270d38ac72005c57ac0a1487 \- cargo-insta.tar.xz cargo-insta-x86_64-unknown-linux-gnu/cargo-insta \- /root/.local/bin/cargo-insta- install_binary \- https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-{{.NEXTEST_VERSION}}/cargo-nextest-{{.NEXTEST_VERSION}}-x86_64-unknown-linux-gnu.tar.gz \- 66786b9abe23920d022a182d1416b1bbc8130dd4872a9553d76985a1708dcd1e \- cargo-nextest.tar.gz cargo-nextest /root/.local/bin/cargo-nextest- install_binary \- https://github.com/nushell/nushell/releases/download/{{.NU_VERSION}}/nu-{{.NU_VERSION}}-x86_64-unknown-linux-gnu.tar.gz \- da83cfe482060d2c34b6b9af829975a313bce6b92e0398c3b2a59cb38630c7b2 \- nu.tar.gz nu-{{.NU_VERSION}}-x86_64-unknown-linux-gnu/nu /root/.local/bin/nu-- pwsh_archive=powershell.tar.gz- # The universal image supplies libicu; the version probe below fails if that changes.- download \- https://github.com/PowerShell/PowerShell/releases/download/v{{.PWSH_VERSION}}/powershell-{{.PWSH_VERSION}}-linux-x64.tar.gz \- b34ab3b19acac1d3d4d0d3cfdb02acf62f457b0b6a962ff008132033f7566844 \- "$pwsh_archive"- install -d /opt/microsoft/powershell/7- tar -xzf "$tools_tmp/$pwsh_archive" -C /opt/microsoft/powershell/7- chmod 0755 /opt/microsoft/powershell/7/pwsh- ln -sf /opt/microsoft/powershell/7/pwsh /usr/local/bin/pwsh- rm -r -- "$tools_tmp"-- git_version="$(git version | awk '{print $3}')"- dpkg --compare-versions "$git_version" ge 2.54.0- chmod 0711 /root- chown -hR ubuntu:ubuntu "$PWD"- git config --system --add safe.directory "$PWD"-- rm /root/.cargo/bin/cargo- install -m 0755 /dev/stdin /root/.cargo/bin/cargo <<'CARGO_WRAPPER'- #!/bin/sh- set -eu-- if [ "$(id -u)" -ne 0 ]; then- if [ "${CODEX_CARGO_IDENTITY_PROBE:-0}" = 1 ]; then- exec /usr/bin/id -u- fi- cargo_path="$(/root/.cargo/bin/rustup which cargo)"- toolchain_bin="${cargo_path%/cargo}"- PATH="$toolchain_bin:/root/.local/bin:/root/.local/share/mise/installs/task/{{.TASK_VERSION}}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"- export PATH- exec "$cargo_path" "$@"- fi-- exec /usr/bin/tini -s -- /usr/sbin/runuser -u ubuntu -- \- /usr/bin/env HOME=/home/ubuntu USER=ubuntu LOGNAME=ubuntu \- CARGO_HOME=/root/.cargo RUSTUP_HOME=/root/.rustup \- PRE_COMMIT_HOME=/root/.cache/pre-commit PATH="$PATH" \- CODEX_CARGO_IDENTITY_PROBE="${CODEX_CARGO_IDENTITY_PROBE:-0}" \- /root/.cargo/bin/cargo "$@"- CARGO_WRAPPER-- for executable in task pre-commit cargo cargo-insta cargo-nextest git lsof pwsh tini zsh fish nu; do- command -v "$executable" >/dev/null- done- test -x /root/.local/share/mise/installs/task/{{.TASK_VERSION}}/task- pwsh -NoLogo -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'- - task: prepare-codex-- maintain-codex:- desc: Maintain Codex Cloud universal image (root only)- platforms: [linux]- preconditions:- - sh: test "$(id -u)" = 0 && test "$(id -u ubuntu 2>/dev/null)" = 1000- msg: Codex Cloud maintenance requires root and the universal image's ubuntu user- cmds:- - task: prepare-codex-- prepare-codex:- internal: true- dir: "{{.CODEX_REPO_ROOT}}"- cmds:- - |- set -euo pipefail-- chown -R ubuntu:ubuntu /root/.rustup- install -d -m 0755 -o ubuntu -g ubuntu target \- /root/.cargo/registry /root/.cargo/git /root/.cache/pre-commit- find "$PWD" -path "$PWD/target" -prune -o -exec chown -h ubuntu:ubuntu {} +- for cache_dir in /root/.cargo/registry /root/.cargo/git /root/.cache/pre-commit; do- [ ! -e "$cache_dir" ] || chown -R ubuntu:ubuntu "$cache_dir"- done- /usr/sbin/runuser -u ubuntu -- \- /usr/bin/env HOME=/home/ubuntu USER=ubuntu LOGNAME=ubuntu \- RUSTUP_HOME=/root/.rustup \- /root/.cargo/bin/rustup component add rust-docs- /usr/sbin/runuser -u ubuntu -- \- /usr/bin/env HOME=/home/ubuntu USER=ubuntu LOGNAME=ubuntu \- CARGO_HOME=/root/.cargo RUSTUP_HOME=/root/.rustup \- PRE_COMMIT_HOME=/root/.cache/pre-commit PATH="$PATH" \- pre-commit install-hooks- test "$(command -v cargo)" = /root/.cargo/bin/cargo- test "$(CODEX_CARGO_IDENTITY_PROBE=1 cargo)" = 1000- cargo --version- cargo fetch --lockeddiff --git a/scripts/codex-cloud/codex.sh b/scripts/codex-cloud/codex.shnew file mode 100755index 000000000..07e34289a--- /dev/null+++ b/scripts/codex-cloud/codex.sh@@ -0,0 +1,163 @@+#!/usr/bin/env bash+# Codex Cloud environment for worktrunk's test suite.+#+# The universal image is missing the shells, tools, and git version the suite+# needs, and it runs the agent as root while the suite assumes a non-root UID+# 1000 whose children are reaped by tini. `setup` installs the tools and+# replaces cargo with a wrapper that drops to `ubuntu`; `maintain` re-runs only+# the ownership and cache preparation that a cached environment still needs.+#+# Both commands are typed into the Codex Cloud environment settings, so they+# stay short and fixed across changes to this file. See README.md.++set -euo pipefail++TASK_VERSION=3.52.0+PRE_COMMIT_VERSION=4.6.2+INSTA_VERSION=1.48.0+NEXTEST_VERSION=0.9.143+NU_VERSION=0.115.0+PWSH_VERSION=7.6.5++cd "$(dirname "${BASH_SOURCE[0]}")/../.."++require_root_on_universal_image() {+ if [ "$(id -u)" != 0 ] || [ "$(id -u ubuntu 2>/dev/null)" != 1000 ]; then+ echo "Codex Cloud $1 requires root and the universal image's ubuntu user" >&2+ exit 1+ fi+}++download() {+ curl -fsSL --retry 6 --retry-all-errors --retry-delay 2 \+ "$1" -o "$tools_tmp/$3"+ printf '%s %s\n' "$2" "$tools_tmp/$3" | sha256sum -c -+}++install_binary() {+ download "$1" "$2" "$3"+ case "$3" in+ *.tar.xz) tar -xJf "$tools_tmp/$3" -C "$tools_tmp" ;;+ *.tar.gz) tar -xzf "$tools_tmp/$3" -C "$tools_tmp" ;;+ esac+ install -m 0755 "$tools_tmp/$4" "$5"+}++setup() {+ export DEBIAN_FRONTEND=noninteractive++ apt-get update -qq+ apt-get install -y -qq --no-install-recommends software-properties-common+ add-apt-repository -y ppa:git-core/ppa+ apt-get update -qq+ apt-get install -y -qq --no-install-recommends git zsh fish xz-utils lsof tini++ uv tool install pre-commit=="$PRE_COMMIT_VERSION"+ install -d /root/.local/bin++ tools_tmp="$(mktemp -d)"++ install_binary \+ "https://github.com/go-task/task/releases/download/v$TASK_VERSION/task_linux_amd64.tar.gz" \+ 02c679ffae53dca791804847d78b31731615894e292948397c971c87ac9e95bd \+ task.tar.gz task /root/.local/bin/task+ install_binary \+ "https://github.com/mitsuhiko/insta/releases/download/$INSTA_VERSION/cargo-insta-x86_64-unknown-linux-gnu.tar.xz" \+ 1c05a480a5a7f755f0ea15b2d8e2f71ad51b9c3a270d38ac72005c57ac0a1487 \+ cargo-insta.tar.xz cargo-insta-x86_64-unknown-linux-gnu/cargo-insta \+ /root/.local/bin/cargo-insta+ install_binary \+ "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-$NEXTEST_VERSION/cargo-nextest-$NEXTEST_VERSION-x86_64-unknown-linux-gnu.tar.gz" \+ 66786b9abe23920d022a182d1416b1bbc8130dd4872a9553d76985a1708dcd1e \+ cargo-nextest.tar.gz cargo-nextest /root/.local/bin/cargo-nextest+ install_binary \+ "https://github.com/nushell/nushell/releases/download/$NU_VERSION/nu-$NU_VERSION-x86_64-unknown-linux-gnu.tar.gz" \+ da83cfe482060d2c34b6b9af829975a313bce6b92e0398c3b2a59cb38630c7b2 \+ nu.tar.gz "nu-$NU_VERSION-x86_64-unknown-linux-gnu/nu" /root/.local/bin/nu++ pwsh_archive=powershell.tar.gz+ # The universal image supplies libicu; the version probe below fails if that changes.+ download \+ "https://github.com/PowerShell/PowerShell/releases/download/v$PWSH_VERSION/powershell-$PWSH_VERSION-linux-x64.tar.gz" \+ b34ab3b19acac1d3d4d0d3cfdb02acf62f457b0b6a962ff008132033f7566844 \+ "$pwsh_archive"+ install -d /opt/microsoft/powershell/7+ tar -xzf "$tools_tmp/$pwsh_archive" -C /opt/microsoft/powershell/7+ chmod 0755 /opt/microsoft/powershell/7/pwsh+ ln -sf /opt/microsoft/powershell/7/pwsh /usr/local/bin/pwsh+ rm -r -- "$tools_tmp"++ git_version="$(git version | awk '{print $3}')"+ dpkg --compare-versions "$git_version" ge 2.54.0+ chmod 0711 /root+ chown -hR ubuntu:ubuntu "$PWD"+ git config --system --add safe.directory "$PWD"++ rm /root/.cargo/bin/cargo+ install -m 0755 /dev/stdin /root/.cargo/bin/cargo <<'CARGO_WRAPPER'+#!/bin/sh+set -eu++if [ "$(id -u)" -ne 0 ]; then+ if [ "${CODEX_CARGO_IDENTITY_PROBE:-0}" = 1 ]; then+ exec /usr/bin/id -u+ fi+ cargo_path="$(/root/.cargo/bin/rustup which cargo)"+ toolchain_bin="${cargo_path%/cargo}"+ PATH="$toolchain_bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"+ export PATH+ exec "$cargo_path" "$@"+fi++exec /usr/bin/tini -s -- /usr/sbin/runuser -u ubuntu -- \+ /usr/bin/env HOME=/home/ubuntu USER=ubuntu LOGNAME=ubuntu \+ CARGO_HOME=/root/.cargo RUSTUP_HOME=/root/.rustup \+ PRE_COMMIT_HOME=/root/.cache/pre-commit PATH="$PATH" \+ CODEX_CARGO_IDENTITY_PROBE="${CODEX_CARGO_IDENTITY_PROBE:-0}" \+ /root/.cargo/bin/cargo "$@"+CARGO_WRAPPER++ for executable in task pre-commit cargo cargo-insta cargo-nextest git lsof pwsh tini zsh fish nu; do+ command -v "$executable" >/dev/null+ done+ pwsh -NoLogo -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'+}++prepare() {+ chown -R ubuntu:ubuntu /root/.rustup+ install -d -m 0755 -o ubuntu -g ubuntu target \+ /root/.cargo/registry /root/.cargo/git /root/.cache/pre-commit+ find "$PWD" -path "$PWD/target" -prune -o -exec chown -h ubuntu:ubuntu {} ++ for cache_dir in /root/.cargo/registry /root/.cargo/git /root/.cache/pre-commit; do+ [ ! -e "$cache_dir" ] || chown -R ubuntu:ubuntu "$cache_dir"+ done+ /usr/sbin/runuser -u ubuntu -- \+ /usr/bin/env HOME=/home/ubuntu USER=ubuntu LOGNAME=ubuntu \+ RUSTUP_HOME=/root/.rustup \+ /root/.cargo/bin/rustup component add rust-docs+ /usr/sbin/runuser -u ubuntu -- \+ /usr/bin/env HOME=/home/ubuntu USER=ubuntu LOGNAME=ubuntu \+ CARGO_HOME=/root/.cargo RUSTUP_HOME=/root/.rustup \+ PRE_COMMIT_HOME=/root/.cache/pre-commit PATH="$PATH" \+ pre-commit install-hooks+ test "$(command -v cargo)" = /root/.cargo/bin/cargo+ test "$(CODEX_CARGO_IDENTITY_PROBE=1 cargo)" = 1000+ cargo --version+ cargo fetch --locked+}++case "${1-}" in+ setup)+ require_root_on_universal_image setup+ setup+ prepare+ ;;+ maintain)+ require_root_on_universal_image maintenance+ prepare+ ;;+ *)+ echo "usage: ${BASH_SOURCE[0]} setup|maintain" >&2+ exit 1+ ;;+esacdiff --git a/tests/integration_tests/readme_sync.rs b/tests/integration_tests/readme_sync.rsindex 1826ef4e5..968d63144 100644--- a/tests/integration_tests/readme_sync.rs+++ b/tests/integration_tests/readme_sync.rs@@ -1572,36 +1572,6 @@ fn test_taskfile_llm_commands_match_config_example() {);}-#[test]-fn test_codex_cloud_launchers_match_taskfile() {- use sha2::{Digest, Sha256};-- let project_root = Path::new(env!("CARGO_MANIFEST_DIR"));- let taskfile = fs::read(project_root.join("scripts/codex-cloud/Taskfile.yaml")).unwrap();- let taskfile_text = std::str::from_utf8(&taskfile).unwrap();- let readme = fs::read_to_string(project_root.join("scripts/codex-cloud/README.md")).unwrap();-- let digest: String = Sha256::digest(&taskfile)- .iter()- .map(|byte| format!("{byte:02x}"))- .collect();- let task_version = Regex::new(r#"(?m)^ TASK_VERSION: "([^"]+)"$"#)- .unwrap()- .captures(taskfile_text)- .unwrap()[1]- .to_string();-- for task in ["setup-codex", "maintain-codex"] {- let launcher = format!(- "TASKFILE_SHA={digest}; printf '%s %s\\n' \"$TASKFILE_SHA\" scripts/codex-cloud/Taskfile.yaml | sha256sum -c - && MISE_NO_CONFIG=1 MISE_HTTP_RETRIES=6 mise x task@{task_version} -- task -t scripts/codex-cloud/Taskfile.yaml {task}"- );- assert!(- readme.lines().any(|line| line == launcher),- "Codex Cloud {task} launcher in scripts/codex-cloud/README.md is stale; replace it with:\n{launcher}"- );- }-}-#[test]fn test_config_source_templates_are_in_sync() {let project_root = Path::new(env!("CARGO_MANIFEST_DIR"));