Skip to content

run events: chant run events replays a run and --follow tails one on this host (#4042) - #4060

Merged
lex00 merged 2 commits into
mainfrom
feat/4042-run-events-replay
Oct 17, 2026
Merged

lex00 merged 2 commits into
mainfrom
feat/4042-run-events-replay

Conversation

@lex00

@lex00 lex00 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Closes #4042

chant run events <run> [--json] [--follow] replays a run's event stream, and --follow tails a run in progress on this host.

  • Storage: one file per run at <git-common-dir>/chant/run-events/<run id>.jsonl, beside the in-flight records in chant/runs/, outside the working tree and off chant/lifecycle. The lines are byte for byte what the one writer produced. Nothing prunes them yet; the docs name retention: how long stored change sets, run events and releases are kept, and garbage collection #4036 for retention.
  • Which runs keep events: a local chant run <op> keeps them whenever it records to the ledger, with or without --events-json (--no-record keeps nothing). run --components, promote, rollback, redeploy, fan-out, pr-plan and pr-apply keep them only under --events-json, writing each line to stdout and the file.
  • <run> is a run id, or an Op or component name, which picks the newest kept run of that name. The exit code is the run's verdict (0 ok, 1 failed, 3 gated or waiting); replaying a run still going exits 0.
  • --follow polls every 100 ms, ends at run-settle, and waits up to 5 s for a file that isn't there yet. A run killed with SIGKILL never settles, so following it waits until interrupted (SIGINT and SIGTERM settle the run failed first).
  • Requirement 3: events is reserved as a chant run subcommand rather than extending run log, because run log lists an Op's history from its runtime and takes --on, while run events reads one run's local stream. --on other than local is refused, pointing at epic: workspace read contracts for behold's default view (runs, waves, events, drift, change sets, metrics, alerts) #3990 for remote --follow.
  • Tests can't write the real repository's store: CHANT_RUN_EVENTS_DIR overrides the root, and the vitest per-run setup points it at a temp dir. (An earlier local run of this branch wrote test streams under the shared .git/chant/run-events/; those were removed, and a before-and-after snapshot shows the fix holds.)

Level-0 output changes

On the exceptions page and #2525: events is now a reserved chant run subcommand, so an Op named events can't be started as chant run events; a local chant run <op> that records to the ledger writes a file under .git/chant/run-events/ (stdout, stderr, exit codes and the ledger are unchanged); --follow is a recognised flag. No golden moved.

Acceptance

  • Replay of a settled run and of an in-flight run, with tests (run-event-store.test.ts "a run that records to the ledger keeps its stream, and it replays as the writer wrote it" and "replays what has been written so far, and not a half-written last line"; run-events-cmd.test.ts "--json replays a settled run's lines and exits with its verdict" and "--json replays a run in progress up to now and exits 0").
  • Local --follow streams each event of a run in progress, with a test ("--follow streams each event as it is written and ends at run-settle"; "--follow prints each event of a run in progress, then the verdict").
  • epic: workspace read contracts for behold's default view (runs, waves, events, drift, change sets, metrics, alerts) #3990's in-flight item is cross-referenced, with remote --follow left to it (comment posted).

Checks

  • npx tsx scripts/typecheck.ts: no regressions (26 baselined)
  • npx tsx scripts/check-lexicons.ts: no untracked tier-1 failures
  • run-event store and command tests, handlers, local executor, run-event, level-0 goldens, boundary roster: 792 passed with GITHUB_SHA, GITHUB_RUN_ID and CI set, after rebasing on main; the real chant/lifecycle and .git/chant were unchanged by the run
  • Full vitest: only the 3 known local op/factory.e2e.test.ts failures and load timeouts that pass alone
  • lint-docs-sentences (no regressions), lint-prompts, check-docs-diataxis, ./scripts/build-docs.sh: pass

@lex00
lex00 force-pushed the feat/4042-run-events-replay branch from 0533b79 to 30d86d2 Compare October 17, 2026 03:59
@lex00
lex00 merged commit 54a0302 into main Oct 17, 2026
11 checks passed
@lex00
lex00 deleted the feat/4042-run-events-replay branch October 17, 2026 04:11
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.

run events: chant run events <run> --json replay and --follow

1 participant