Run a GitHub Actions workflow on your machine — no Docker — and stop inside it with a debugger.
rehearse run --break-on-fail
rehearse parses a workflow file, expands its matrices and job graph, evaluates
its ${{ }} expressions, and executes the run: steps directly on your host —
then lets you pause between steps, inspect the environment, evaluate an
expression against the live context, rewrite the failing command, and run it
again. No commit, no push, no waiting for a runner, no CI minutes.
Pure Python 3.11+ standard library. No dependencies, not even a YAML parser — it brings its own.
CI is the only place in modern development where the debugger disappeared. A
2026 audit of CI/CD spend put 40–60% of it down to waste, and the single most
expensive line in that audit is not a slow build — it is the human loop:
"CI environments are isolated — you can't SSH in, add breakpoints, and each
retry burns your CI minutes." Two of the most upvoted answers in the September
2026 Hacker News thread "What developer tool do you wish existed in 2026?" ask
for exactly the same missing thing: a local environment mirroring CI, and a CI
runner with breakpoints and rollback. act, the tool everyone reaches for,
closes the feedback-loop half of this (minutes → seconds) but not the
introspection half: it runs your workflow inside a Docker container you still
cannot stop inside, needs a daemon, and only emulates Linux runners.
The insight is that the feedback loop is not actually the expensive part — the
blindness is. Once execution is on the host rather than in a container, the
pause point between two steps becomes free: the filesystem is right there, the
environment is a dict you can print, and re-running a step is just running the
script again. rehearse is the smallest thing that proves it: a workflow
interpreter faithful enough to reproduce the bugs that only bite in CI (bash
-eo pipefail, $GITHUB_ENV precedence, if:'s implicit success() &&,
case-insensitive ==), with a pdb-shaped controller wrapped around the step
loop.
Lane and how it differs from the recent streak. This is developer tools & infra — an interactive execution engine for an everyday, non-agent developer workflow. Experiments 011–044 are offline static/passive auditors of agent and MCP artifacts; #045 executes real user code, is interactive rather than batch, has nothing to do with agents or MCP, and its output is a debugging session rather than a findings report.
Nothing to install — clone it and go:
python -m rehearse plan # what would run, with matrices expanded
python -m rehearse run # run it here
python -m rehearse run --break-on-fail # pause the moment a step fails
python -m rehearse run --debug # pause before every step
python -m rehearse shims # what happens to `uses:` stepsOr install the console script:
pip install -e . # provides `rehearse`
make test # 174 tests
make run # rehearse the bundled demo workflow
make debug # the broken example, pausing on failurerehearse finds .github/workflows/*.yml under -w/--workspace (default .).
Name a workflow if there is more than one: rehearse run release.
| flag | what it does |
|---|---|
-j/--job NAME |
run one job (its needs: are pulled in automatically) |
--matrix k=v |
run only the matching matrix instances |
--event NAME |
set github.event_name (default push) |
--break SPEC |
pause at a step: id, index, name substring, job:id, or * |
--break-on-fail |
pause the instant a step fails, with the workspace intact |
--debug |
pause before every step |
-e K=V, --secret K=V, --var K=V, --input K=V |
fill the env, secrets, vars and inputs contexts |
--secrets-file F |
env-format secrets (default .rehearse/secrets.env if present) |
--on-unsupported skip |
leave un-shimmed uses: steps out instead of stopping |
--json PATH |
machine-readable report |
--keep-temp |
keep the generated step scripts in .rehearse/tmp (they are deleted by default) |
-q/--quiet, --no-color |
quieter output |
Exit codes: 0 success · 1 a step failed · 2 bad workflow or usage ·
3 incomplete (an unsupported uses: step) · 4 aborted.
(rehearse) where # job, step, cwd, shell, matrix, job status
(rehearse) script # the fully interpolated script about to run
(rehearse) env TOKEN # the environment this step will see (masked)
(rehearse) ctx steps.build.outputs.sha # evaluate an expression, live
(rehearse) snap before-build # snapshot the workspace
(rehearse) shell # drop into a shell in the step's cwd
(rehearse) edit # rewrite the script ($EDITOR, or inline)
(rehearse) rerun # try it again
(rehearse) restore # roll the workspace back and try once more
(rehearse) continue
next, continue, skip, break, outputs, breaks, unbreak, quit and
help do what you expect. Without a terminal (CI, a pipe) the debugger says so
and runs straight through instead of hanging.
Rehearsing this repository's own CI workflow, on Windows, for one matrix row — including the step where it rehearses its own bundled examples:
$ python -m rehearse run --no-color --matrix python-version=3.13
rehearsing ci (ci.yml) as event 'push' in .../experiment-045
rehearsal summary
test (3.13): success
ok actions/checkout@v4 148ms
ok actions/setup-python@v5 249ms
ok Install test dependencies 29.5s
ok Run the suite 26.9s
ok Rehearse the bundled demo workflow 2.2s
ok Confirm the broken example still fails 1.3s
annotations
notice: actions/checkout is a no-op under rehearse: the workspace already is
your working tree, so nothing is fetched and nothing is overwritten
result: PASSED (1 job(s))
The bundled demo exercises matrices, needs, job outputs, $GITHUB_ENV
exports, if: gating and continue-on-error:
$ python -m rehearse run -w examples/demo --no-color --quiet
rehearsal summary
build: success
ok actions/checkout@v4 148ms
ok Compute metadata 143ms
ok Use the exported variables 64ms
outputs: version=1.4.2
test (unit): success
ok actions/checkout@v4 148ms
ok Run the suite 72ms
skip Extra pass for the slow suite 0ms -- if: matrix.slow
warn Lint (allowed to fail) 68ms -- exited with code 3 (continue-on-error)
ok Always cleans up 71ms
test (integration, true): success
...
step summaries ($GITHUB_STEP_SUMMARY)
build / Use the exported variables
- built **rehearse-demo** locally
result: PASSED (3 job(s))
And the point of the whole thing — examples/broken contains the classic bug
that only shows up in CI, because hosted bash runs with -eo pipefail and
your terminal does not:
$ python -m rehearse run -w examples/broken --event workflow_dispatch --break-on-fail
=== job ship ===
cat: dist/app.text: No such file or directory
-- paused after step 1: Checksum the artifact -> failure (exit 1)
'edit' the script then 'rerun', or 'continue' to move on
(rehearse) shell # look around: dist/app.txt exists, app.text doesn't
(rehearse) edit # fix the typo
(rehearse) rerun
(rehearse) continue
rehearsal summary
ship: success
workflow.yml
|
v
yaml_mini.py a YAML-subset parser (no PyYAML): block/flow collections,
| block scalars with chomping, YAML 1.2 typing so `on:` stays
| a string. Rejects anchors/aliases/tags loudly.
v
workflow.py model + validation + matrix expansion (include/exclude,
| GitHub's documented order) + topological job ordering.
| Everything static happens here, before anything runs.
v
runner.py <----> StepController <---- debugger.py (the seam, see below)
| expressions.py lexer -> parser -> evaluator for ${{ }}
| shell.py shell keyword -> real argv, incl. -eo pipefail
| shims.py what to do about `uses:`
| commands.py ::error::, $GITHUB_OUTPUT/ENV/PATH, masking
v
report.py plan view, live log, summary, JSON, exit code
The seam. The runner knows nothing about the debugger. Before and after each
step it asks a StepController a question and gets back one verb — run /
skip / abort, then continue / rerun / abort — and the controller is
handed a mutable StepPlan. That is the entire interface. NullController
answers "always continue"; Debugger answers by opening a REPL. Breakpoints,
edit-and-rerun and workspace rollback all fall out of those two hooks without a
single UI concern leaking into the engine, and the controller is trivially
scriptable, which is how the debugger is tested.
A. Containers (what act does) |
B. Host execution (chosen) | |
|---|---|---|
| fidelity | high — the runner image is the environment | medium — your toolchain, not the runner's |
| requirements | a Docker daemon and multi-GB images | a Python interpreter |
| memory / CPU | container overhead per job | a subprocess per step |
| pausing between steps | needs an exec-into-container protocol and a live shell inside the image | free: the filesystem and env are already yours |
| rollback | container layers, or nothing | copy the workspace |
| maintenance | tracking runner images as they drift | tracking the expression language and spec |
B was chosen because the debugger is the product, and every debugger
affordance is cheap on the host and expensive in a container. Fidelity is where
B pays for it, and the honest answer is to be loud about the gap rather than
paper over it: rehearse reports which steps it could not run faithfully and
refuses to call such a run a clean pass (exit code 3, and an explicit
"this rehearsal did not run every step" banner).
rehearse will not fetch or execute a third-party action. That is a deliberate
boundary — running arbitrary network-fetched JavaScript would undo both the
"fast" and the "offline" halves of the tool. Instead:
- built-in shims cover what almost every workflow uses —
actions/checkoutis a no-op (your working tree is the checkout),actions/cachereports a miss so the fallback path gets rehearsed,actions/setup-*verifies the local toolchain and warns when the version differs,actions/upload-artifact/download-artifactcopy through.rehearse/artifacts/; - your own shims go in
.rehearse/shims.yml(seeexamples/demo), and receive the step'swith:inputs asINPUT_*variables exactly like a real action; - anything else is reported as unsupported — never silently as a pass.
These are the parts that exist because they are the parts that actually bite:
bashruns as--noprofile --norc -eo pipefail {0}, so a failure on the left of a pipe fails the step here just as it does on GitHub (sh,pwsh,powershell,python,cmdand customshell: prog {0}too).if:gets the implicitsuccess() &&unless it names a status function, so steps after a failure skip, andif: always()/if: failure()still fire.==on strings is case-insensitive;&&/||return an operand, not a boolean;null == 0and1 == '1'are true; a missing property isnull.$GITHUB_ENVexports reach later steps, but a declaredenv:still wins.$GITHUB_OUTPUT,$GITHUB_PATH,$GITHUB_STEP_SUMMARY,$GITHUB_STATE, heredoc syntax included;::set-outputstill works but is reported as deprecated.::error/warning/notice::withfile=/line=properties,::group::,::add-mask::,::stop-commands::.- matrix
include/excludein GitHub's documented order;needsordering,needs.*.outputs, and dependants skipping when a dependency fails. continue-on-error(outcome vs conclusion),timeout-minutes,working-directory, workflow/jobdefaults.run, joboutputs.- secrets are masked everywhere they appear in output, including values a step
registers at runtime with
::add-mask::.
Stated plainly, because a rehearsal you trust too much is worse than none:
- Your toolchain, not the runner's.
ubuntu-latestis ignored: steps run on whatever this machine has.actions/setup-*warns when the requested version is not what it finds. If your workflow depends on a hosted-runner preinstallation, rehearse it and you will find out — which is the point. - Steps run in your working tree, not a fresh clone. A step that deletes
files deletes your files. Use
snapbefore a destructive step;--debugmakes that a one-word habit. There is no sandbox here at all: the workflow you rehearse can do anything you can do. uses:is shimmed, never fetched (above). Composite and reusable workflows (jobs.<id>.uses:) are rejected with a clear message rather than half-supported.- Jobs run sequentially, in dependency order.
strategy.max-parallelandfail-fastare parsed but not acted on; a matrix instance failing does not cancel its siblings. - Services, containers, permissions, concurrency and environments are parsed and ignored.
- The YAML subset is a subset. Anchors, aliases, merge keys, tags, multiple
documents and multi-line plain scalars raise an error with a line number
instead of being guessed at. GitHub Actions does not support anchors either.
Unquoted
3.10becomes3.1— the same footgun as on GitHub — but rehearse warns you about it, which GitHub does not. - The expression language is the documented one, minus
vars/secretsinheritance rules for reusable workflows.hashFilesglobbing isfnmatch-based, so it handles**/*.txtand*.lockbut not full.gitignoresemantics. - Snapshots are a directory copy excluding
.gitand.rehearse. Fine for a source tree; not for a workspace holding gigabytes. - Windows notes.
bashresolves to Git Bash if present;pwshfalls back topowershell. Paths handed tobashare converted to forward slashes. - Steps' output is captured with stderr merged into stdout, so interleaving is faithful but the two streams are not distinguishable in the report.
$ python -m pytest
174 passed
tests/ covers the YAML parser (block scalars, chomping, flow collections, the
error cases), the expression evaluator (case-insensitive equality, operand-
returning &&/||, coercion, every function, arity and syntax errors),
workflow validation and matrix expansion, workflow commands and env-file
parsing, secret masking, and the runner end to end — outputs, exports,
precedence, if: gating, continue-on-error, timeouts, shims, unsupported
uses:, snapshots, and the debugger driven by a scripted keyboard.
Runner tests use shell: python rather than bash so the suite behaves
identically on every host.
rehearse/ yaml_mini · expressions · workflow · shell · commands
shims · runner · debugger · report · cli
tests/ 174 tests
examples/demo/ a workflow exercising matrices, needs, outputs, gating
examples/broken/ the pipefail bug, for the --break-on-fail demo
.github/workflows/ this project's own CI — which rehearse can rehearse
MIT.