Repository navigation
feat(op): gate-as-fact in the local executor — a gate ends the run pending chant approve (#2119) - #2139
Merged
Conversation
This was referenced Sep 6, 2026
lex00
force-pushed
the
feat/2121-op-runtime-seam
branch
from
September 6, 2026 15:38
842d4d5 to
b81cac8
Compare
lex00
force-pushed
the
feat/2119-gate-as-fact
branch
from
September 6, 2026 15:38
8ed94f7 to
b05a320
Compare
…nding chant approve (#2119) A gate was a wait, which meant a runtime that cannot wait had to refuse the whole op before its first step. It is a fact now. Reaching a `gate`, the executor reads the gate ledger: a resolution newer than the gate's newest pending fact lets the step pass and lands the approver on its record; otherwise the pending fact is recorded and the run ends with status `gated`. No later phase runs, and no `onFailure` phase runs either — nothing failed, so there is nothing to compensate for. The next run re-evaluates from the ledger, so `chant approve <op> <gate>` followed by `chant run <op>` is the whole loop. - `lifecycle/gate-ledger.ts` gains `PendingGateRecord`, written to the same `_gates/<op>.jsonl` as the resolutions and told apart by `kind`. A live pending fact is reused rather than re-appended, so an operator ticking every minute against an unapproved gate does not grow the ledger by a line a minute; past its expiry (the gate's `timeout`, 48h default) it is stale and the next run records a fresh one. - `op/gate.ts` is the one place that decides a gate, shared by the Op executor and the component driver so the two cannot drift. Ledger access goes through a `GateLedgerPort`, so a test drives the decision without an orphan branch. - `OpRunResult.ok` becomes a three-state `status: "ok" | "fail" | "gated"` with `startedAt` and the pending fact on `gate`. #2118: written to the run ledger. - `renderHuman`/`renderJson` print the gate, its description, the `chant approve` line and the expiry; the CLI exits 3 for a gated run so CI can tell "waiting on a human" from "broken". - `LocalGateUnsupportedError`, `findGate` and `DriverGateUnsupportedError` are deleted along with the `--temporal` hints they printed. `isGated` walks the phases itself; `findPolicyGateStep` stays. - `chant run --components` behaves identically: a gate stops the component pending approval, with no saga unwind and no `rollback` phase. - `chant approve --expire` clears a standing pending fact without approving it, and `chant operator status` lists pending facts from every discovered op, not only from a converge tick's `gated` outcomes. - `convergeTick` reads the gate off `chant run --json`'s exit-3 result instead of matching a refusal message, and no longer writes the pending fact the executor already wrote. - COMP004's message says a gate ends the run pending approval rather than needing another backend (the rename is #2116). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JH1b63nCr6fXETJYMvL4xK
…#2119 over #2121) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JH1b63nCr6fXETJYMvL4xK
…eleted ok boolean (#2119) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JH1b63nCr6fXETJYMvL4xK
…us (#2119) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JH1b63nCr6fXETJYMvL4xK
lex00
force-pushed
the
feat/2119-gate-as-fact
branch
from
September 6, 2026 16:04
0d3c5ff to
03ae984
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2119. Sub-issue 3 of #2114. Stacked on #2137 (retarget to
mainonce that merges).A gate is a fact, not a wait. Reaching one, the local executor reads the gate ledger: a resolution newer than the gate's newest pending fact lets the step pass carrying the approver; otherwise the run records a pending fact, ends
gated(exit 3), runs no later phase and noonFailure.chant approve <op> <gate>writes the counterpart fact, and the next run walks through. The same decision (packages/core/src/op/gate.ts) drives the component driver, sochant run --componentsbehaves identically.chant approve --expireclears a standing fact;chant operator statuslists pending facts for any op.Merged over #2121's runtime seam by the orchestrator: the progress callback rides
RunOpOptions.onRecord, the local runtime maps the three-state result and no longer refuses gates, andchant runexits 3 for a gated run on any runtime.Acceptance
chant run <gated-op>with no resolution endsgated, exit code 3, appends aPendingGateRecord, prints the approve line and expiry, and runs no phase after the gate.chant approve <op> <gate>followed bychant run <op>completes the op; the step record carries the approver andurl.onFailurephases do not run ongated.chant run --components <name>with agatebehaves the same way;driver.test.tscovers it.LocalGateUnsupportedErrorandfindGateare gone from core and from theop/index.tsbarrel; nothing inpackages/prints--temporalas a hint for a gate.chant operator statusshows pending facts for a non-converge op;local-executor.test.tsandgate-ledger.test.tscover the three-state outcome.Gates
npx vitest run packages/core lexicons/temporal lexicons/terraform lexicons/fly: 452 files passed, 2 skipped.npx tsx scripts/typecheck.ts: 44 known failures, no regressions.npx tsx scripts/check-lexicons.ts: no untracked tier-1 failures.node scripts/lint-docs-sentences.mjs: 4218 findings, 3 below baseline, no regressions.node scripts/check-docs-diataxis.mjs: no failures.Note for #2122: TMP014's rationale ("the local executor refuses any gated op outright") is now stale; the port to OPS014 re-argues the refusal.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JH1b63nCr6fXETJYMvL4xK