Commit Graph

58 Commits

Author SHA1 Message Date
Peter Pistorius 7a06aec813 fix: setup-bun cache collision (#219)
* test: smoke repro for setup-bun cache collision (#212)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: setup-bun fails in bun projects (#212)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 12:21:49 +02:00
Peter Pistorius 66ac2a4b6b test: smoke repro for missing cc in runner image (#207)
* test: add smoke repro for missing cc in runner image

Minimal smoke workflow that calls `command -v cc` and compiles a
trivial C program. Reproduces a cargo/Rust workflow failure where
`linker 'cc' not found` breaks builds under agent-ci-dev because
ghcr.io/actions/actions-runner:latest does not ship build-essential.

CI-only change (no packages/ code modified) — no changeset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: pluggable runner image via .github/agent-ci.Dockerfile (#208)

agent-ci now discovers a user-provided Dockerfile at
.github/agent-ci.Dockerfile (or .github/agent-ci/Dockerfile for builds
with a COPY context), hashes its contents, builds it locally via
`docker build`, and uses the resulting agent-ci-runner:<hash> tag as
the default runner image. Edits trigger automatic rebuilds; identical
contents reuse the cached image.

This closes the gap where the minimal ghcr.io/actions/actions-runner
image lacks build-essential, python3, and other toolchains that
GitHub's hosted ubuntu-latest VM ships preinstalled. Workflows green
on GitHub but failing locally with `linker 'cc' not found` can now
opt into a richer image by dropping a 5-line Dockerfile into .github/.

Resolution order (highest wins):
  1. per-job `container:` (unchanged)
  2. AGENT_CI_RUNNER_IMAGE env var
  3. .github/agent-ci/Dockerfile (directory form, supports COPY)
  4. .github/agent-ci.Dockerfile (simple form, empty context)
  5. ghcr.io/actions/actions-runner:latest (default)

Also adds an error-hint heuristic: when a step fails with "command not
found" for cc/gcc/make/python3/pkg-config and the user is still on the
default image, the failure summary includes a paste-ready Dockerfile
pointing at the fix. Docs at packages/cli/runner-image.md.

Dogfoods the feature by shipping .github/agent-ci.Dockerfile for this
repo, which makes smoke-cc-compiler.yml (the issue #208 reproduction)
pass end-to-end.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: announce first-run runner image build

Print a one-time stderr notice before `docker build` fires so users
understand why the first run pauses for ~60s. The message lives in
stderr so log-update can't clobber it and stays in scrollback after.

Docs updated to match.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: clarify that container: runs verbatim, no Dockerfile layering

Spell out explicitly that a job-level container: directive bypasses
.github/agent-ci.Dockerfile entirely — agent-ci does not layer the
Dockerfile on top. This preserves the "same YAML runs locally and on
GitHub" parity promise.

Also document the two recommended ways to combine a custom base
image with agent-ci's extras.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 20:12:21 +02:00
Peter Pistorius 02741dcf0a fix: mount warm node_modules directly at workspace path (#190)
The previous approach symlinked workspace/node_modules → /tmp/node_modules,
which broke esbuild path resolution in pnpm monorepos. Tools like rwsdk's
directive scanner resolved paths through the symlink incorrectly, producing
paths like apps/web/tmp/node_modules/.pnpm/... instead of /tmp/node_modules/.pnpm/...

Mount the warm cache as a Docker bind mount directly at the workspace
node_modules path. This makes the filesystem layout identical to production
GitHub Actions. The original EBUSY concern is already mitigated by the git
shim (blocks git clean) and checkout patching (clean: false).

Adds a smoke test exercising esbuild resolution through pnpm workspace
symlinks to prevent regression.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 13:13:16 +02:00
Peter Pistorius 912ed83465 fix: preserve git-tracked symlinks in workspace snapshot (#179)
* fix: mount warm-modules at /tmp/node_modules for pnpm TypeScript compat

TypeScript resolves @types/* by walking up from realpath(). With pnpm's
.pnpm virtual store symlinked to /tmp/warm-modules, the upward walk never
finds a node_modules directory. Mounting at /tmp/node_modules instead means
TypeScript's walk from /tmp/node_modules/.pnpm/... naturally finds
/tmp/node_modules/@types/.

Closes #176

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: preserve git-tracked symlinks in workspace snapshot

copyWorkspace was using cp/fs.cpSync which dereference symlinks, causing
git mode 120000 entries to be dropped from the workspace commit. Now we
check lstat() before copying and recreate symlinks via symlinkSync.

Closes #178

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add pnpm symlink smoke test reproducing #176 and #178

Adds a committed fixture at .github/fixtures/pnpm-symlinks/ with a
git-tracked symlink (mode 120000) and a TSX file that requires
@types/react resolution through pnpm's .pnpm virtual store.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 10:30:28 +02:00
Peter Pistorius 789e403c74 feat: support reusable workflow inputs/outputs passing (#173)
Wire `with:` inputs from caller workflows to called workflows via
`inputs.*` context, resolve `on.workflow_call.inputs` defaults, and
propagate `on.workflow_call.outputs` back so downstream jobs can
access `needs.<callerJobId>.outputs.*`. Also fixes intra-workflow
`needs.*` resolution for composite job IDs.

Adds smoke test, unit tests, /validate command, and CLAUDE.md agent rules.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 21:08:59 +02:00
Peter Pistorius cf31ce145a feat: support nested reusable workflows up to 4 levels deep (#172)
Replace the nesting guard in expandReusableJobs with recursive expansion,
cycle detection, and a depth limit of 4 matching GitHub Actions' max.

Closes #167

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 20:13:29 +02:00
Peter Pistorius e9c5df5f6f feat: support reusable workflows (local and remote) (#163)
* feat: support local reusable workflows (uses: ./.github/workflows/...)

Inline called workflow jobs into the caller's dependency graph so that
`jobs.<id>.uses` with local refs works end-to-end. Includes dependency
rewiring, smoke tests, runner seed resilience fix, boot-failure log
surfacing, and dev script improvements.

Closes #149

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update website compatibility matrix for reusable workflows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add section descriptions to website compatibility matrix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add descriptions to compatibility matrix legend items

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add 'not planned' status icon to compatibility matrix

Distinguish architectural limitations (concurrency groups, GitHub
secrets) from features that could be implemented in the future.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: support remote reusable workflows (uses: owner/repo/path@ref)

Pre-fetch remote workflow YAML from GitHub Contents API before expansion,
cache SHA refs forever and always re-fetch mutable tag/branch refs. Also
changes missing workflow files from warn+skip to hard failure.

Closes #165

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: split monolithic smoke-tests.yml into discrete workflow files

Each smoke test area now has its own workflow file for isolated failure
visibility: matrix, artifacts/services, cross-job outputs, job conditions,
reusable workflows (local + remote), and binary smoke.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix formatting in .docs/ files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: clarify agent-ci-dev.sh is for local development only

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 17:07:13 +02:00
Peter Pistorius 1e9d7caa9d feat: support pull_request_target in workflow relevance check (#124)
* feat: support pull_request_target in workflow relevance check

Treat pull_request_target identically to pull_request in isWorkflowRelevant(),
applying the same branch and paths filter logic. This fixes agent-ci --all
skipping workflows that use pull_request_target.

Closes #106

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: Docker container name collision when running multiple workflows via --all

Pre-allocate unique base run numbers per workflow before launching them
in parallel, so job suffixes (-j1, -j2, -j3) never produce duplicate
container names across concurrent workflows.

Closes #125

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: resolveDtuHost test and smoke-tests build

Clear AGENT_CI_DTU_HOST in resolveDtuHost tests so the bridge gateway
test exercises the correct code path when running inside agent-ci's
Docker containers (which inject AGENT_CI_DTU_HOST).

Scope binary-smoke build to @redwoodjs/agent-ci... to avoid building
apps/website which fails due to warm-modules symlink resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 10:16:01 +02:00
Peter Pistorius 2a4bd27a5c feat(website): add Copy Agent Instructions button (#111)
* feat(website): add Copy Agent Instructions button to hero and quick start sections

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: remove retry-proof failure test from CI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 06:19:13 +02:00
Peter Pistorius 8ddffdd1db ci: run checks on PR open for repo members
Add 'opened' to pull_request_target types so checks fire immediately
when a PR is created by an owner/member/collaborator. External
contributors still require the 'safe-to-run' label (handled by the
existing if: condition on each job).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 07:19:22 +11:00
Peter Pistorius d273b76c64 fix: show full per-step log in failure summary
Replace the 20-line tail (with "Last output:" label and indentation)
with the full content of the per-step log file already captured at
failedStepLogPath. Falls back to lastOutputLines when no log file
exists (e.g. container crash).

Adds reporter.test.ts to prove the behaviour, and an end-to-end check
in tests.yml that runs the retry-proof workflow and asserts the step
output appears in stdout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 07:15:11 +11:00
Peter Pistorius ad7482fcac fix: auto-run CI for repo members without requiring safe-to-run label
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 03:29:56 +13:00
Peter Pistorius f80dd3253d fix: remove push trigger from CI workflows to eliminate duplicate checks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 03:23:01 +13:00
Peter Pistorius 1916d5d1ef ci: add binary smoke test to smoke-tests workflow
Build and execute the released binary as part of smoke tests: verify shebang is correct, run built binary directly via node, and run built binary via npx (simulates npx install). Catches shebang issues, broken imports, and bin-field misconfigurations before publishing.
2026-03-18 08:11:25 +13:00
Peter Pistorius ed4a92ebd5 Fix pull-requests. 2026-03-17 21:30:04 +13:00
Peter Pistorius e8e2e823ea chore: update README, add engines field, scope release workflow paths 2026-03-16 21:26:58 +13:00
Peter Pistorius 1ad079b338 chore: remove derive package and clean up references 2026-03-16 10:41:20 +13:00
Peter Pistorius c088fb5063 fix: use Node.js 24 for npm OIDC trusted publishing support
npm OIDC requires npm CLI >= 11.5.1, which is bundled with Node 24.
Node 22's npm doesn't support the OIDC handshake, causing 404 errors.
2026-03-16 07:48:21 +13:00
Peter Pistorius bad063f192 fix: add NPM_CONFIG_PROVENANCE for OIDC npm publishing 2026-03-16 07:26:44 +13:00
Peter Pistorius 9c1a67bf51 fix: restore derive filter in release test step 2026-03-16 07:23:48 +13:00
Peter Pistorius f009084c59 fix: remove derive filter from release test step 2026-03-16 07:21:27 +13:00
Peter Pistorius 399a1972ba fix: add id-token permission for npm OIDC provenance publishing 2026-03-16 07:09:14 +13:00
Peter Pistorius d2023fc9f3 fix: prevent recursive double test execution in pnpm -r test
pnpm -r test was including the root workspace, whose test script
is itself `pnpm -r test`, causing every test to run twice in parallel.
Both runs share /tmp/dtu_cache, and when one run's beforeEach cleanup
deleted temp files the other run's server was using → ENOENT.

Add --include-workspace-root=false to prevent the root workspace from
being matched by recursive test runs.
2026-03-16 07:00:42 +13:00
Peter Pistorius b2c061ba1f fix: capture step outputs via DTU and fix _runner_file_commands path
- Fix extractStepOutputs path: _temp/_runner_file_commands/ (not root)
- DTU outputs endpoint now captures and persists outputs.json
- local-job.ts reads outputs.json from log dir instead of work dir
- Add smoke test jobs for cross-job outputs and if:always()

All 279 tests pass.
2026-03-15 19:22:17 +13:00
Peter Pistorius 24125d64f6 v0.2.0. 2026-03-13 16:11:03 +02:00
Peter Pistorius d20287e73b v0.1.1 2026-03-13 16:03:38 +02:00
Peter Pistorius e2fdc0c359 feat: add paths/paths-ignore filtering to isWorkflowRelevant 2026-03-12 23:33:07 +02:00
Peter Pistorius 5b8acda506 Rename machinen to agent-ci
- Rename package from 'machinen' to 'agent-ci' across all source, tests, scripts, configs, and docs
- Rename CLI binary from 'machinen' to 'agent-ci'
- Rename .machinen → .agent-ci, .env.machinen → .env.agent-ci, MACHINEN_* → AGENT_CI_*
- Rename --runner flag to --name/-n (--runner still accepted for compat)
- agent-ci-dev script now builds DTU before running CLI
- Extract YAML compatibility tables to cli/compatibility.md
- Expand CLI usage docs with per-command flag tables
- Document DOCKER_HOST support for remote Docker
2026-03-12 22:35:26 +02:00
Peter Pistorius 7a5e5d25d7 fix: change retry-proof trigger to workflow_dispatch
This workflow is designed to fail initially (value.txt = 'fail') and
is only meant for local machinen testing, not CI.
2026-03-09 17:15:43 +02:00
Peter Pistorius 290cd13d91 feat: Add releasing workflow. 2026-03-09 16:11:47 +02:00
Peter Pistorius 9dff4b1955 feat: add retry-proof experiment
Minimal vitest test that reads a fixture file and asserts its value,
designed to validate the pause-on-failure retry mechanism end-to-end.

- .github/workflows/retry-proof.yml
- experiments/retry-proof/ (package, test, fixture)
- Added retry-proof to pnpm workspace
2026-03-09 16:09:51 +02:00
Peter Pistorius baabf8e0df Rename supervisor to cli. 2026-03-06 22:57:53 +02:00
Peter Pistorius c4ef2baef3 chore: simplify test workflow, rename to machinen in cache workflow
- Remove get-runner job indirection, run tests directly on ubuntu-latest
- Update cache.yml comment: opposite-actions → machinen
2026-03-06 21:07:12 +02:00
Peter Pistorius a1ba2ca310 ci: add cache workflow 2026-03-05 16:23:35 +02:00
Peter Pistorius f8d699b388 Add matrix support for matrix workflows. 2026-03-03 14:48:13 +02:00
Peter Pistorius a704e35244 Fix test again. 2026-03-03 13:45:05 +02:00
Peter Pistorius 32457ad2cd Fix tests. 2026-03-03 13:26:15 +02:00
Peter Pistorius 73d02497f0 Fix artifact uploading. 2026-03-03 11:29:44 +02:00
Peter Pistorius cad09ac9e2 Add github artifacts DTU and support "needs." 2026-03-02 20:55:09 +02:00
Peter Pistorius 45a0177de6 Fix nodejs cache. 2026-02-25 14:06:24 +02:00
Peter Pistorius 002c979e7b Really, really fix tests. 2026-02-23 23:49:39 +02:00
Peter Pistorius c4eca6e32f Fix tests. 2026-02-23 23:48:36 +02:00
Peter Pistorius 4f5f8692d4 Really fix tests. 2026-02-23 23:47:01 +02:00
Peter Pistorius 6ac88a8a16 Fix tests. 2026-02-23 23:43:59 +02:00
Peter Pistorius f614c5be3a Fix tests. 2026-02-23 23:41:32 +02:00
Peter Pistorius fd085c5c28 Add cache. 2026-02-20 15:08:09 +02:00
Peter Pistorius c763c304df Rename runner to supervisor. 2026-02-20 11:17:49 +02:00
Peter Pistorius 4cb53b4bc4 Stablize. 2026-02-19 21:50:55 +02:00
Peter Pistorius aaf6572f6b Add pre-commit hook using husky and ensure lint fails on warnings 2026-02-19 19:13:34 +02:00
Peter Pistorius 1bc7b6321e feat: Introduce broad updates across SDK, runner components, and build infrastructure, including new git configuration and documentation. 2026-02-19 18:28:06 +02:00