Repository navigation
Description
Summary
ConvergeOp (#1484) needs a controller, not a workflow engine. This issue proposes the chant operator: a way to run scheduled, durable, gated convergence ticks locally with no Temporal anywhere — because chant already owns every piece of the controller's substrate. Git is the memory, observation is the clock, PRs are the approval surface, and update-ref is the lock.
The claim underneath: the Temporal dependency is essential for pipeline ops (suspended multi-step code that must resume exactly where it stopped) and incidental for converge ops (level-triggered loops that re-derive everything from observation each tick). For the second kind, durability costs nothing extra, since crash-recovery and normal operation are the same act: re-observe and tick again.
Decomposing the Temporal dependency
The local executor already does phase sequencing, parallelism, per-profile retries and timeouts, outcome capture, and compensation. What it rejects (LocalGateUnsupportedError: "gates and schedules need a durable runtime") is exactly four capabilities:
- Durable state across crashes
- Durable timers (schedules)
- Signals (gates)
- Visibility (search attributes, status queries)
For a pipeline op the rejection is correct. For a ConvergeOp it is not, because a converge tick has no mid-sequence progress worth checkpointing. It is level-triggered in the Kubernetes-controller sense: it cares about the current level of the world versus the declared level, recomputed every tick, and never about the history of edges. This is already the lifecycle philosophy (truth lives in the live system; the snapshot can be deleted between runs with no behavior change), and it is fountain's philosophy too — its Rehydrator does crash-recovery by re-observation at boot. Same belief, three codebases.
The four capabilities, natively
Durable state → the ledger. The chant/lifecycle orphan branch is already an append-only, content-addressed, serverless store written via plumbing with no checkout. Tick records, gate requests and resolutions, flap-damping counts (already placed there by #1484), and leases all become ledger facts. Nothing the operator must remember lives outside git.
Durable timers → symptoms. Temporal models waiting as suspended code; the converge model makes waiting free by re-observing. k8sWait-style steps invert: "rollout incomplete" is not a blocked activity, it is a level the next tick observes, with an age. Anything you would durably sleep on is re-expressible as a symptom.
Gates → facts. Today a gate suspends a workflow until signaled. Proposed semantics, for BOTH executors: on first encounter the run writes a pending-approval fact and ends with status gated; resolution is an out-of-band act that writes the counterpart fact — chant approve <op> <gate>, or a merged PR, which is already the human gate in rollback and reconcile. Gate-as-PR gives approval a URL, a review surface, and CODEOWNERS as the authorization model. This unifies the executors instead of forking their behavior, and it is a semantic change to the existing op model — see open question 1 on whether it lands as its own issue first.
The clock and the lock → any scheduler plus CAS. Single-writer per environment is a lease, and git update-ref is a compare-and-swap chant already uses; cross-machine contention arbitrates through the ledger branch push, and flock suffices purely locally. Once ticks are leased and idempotent, chant does not need to own the clock: cron, a systemd timer, a k8s CronJob, a CI schedule, or the chant operator daemon are all safe invokers of the same tick.
Visibility → the ledger again. Search attributes become tick records; chant operator status is a ledger read; the one-line-per-tick log from #1484 stands.
The operator itself
A deliberately small daemon — a timer, a lease, and the existing local executor in a loop:
chant operator # run ticks for this project's converge ops, per their `every:`
chant operator status # read the ledger: last tick, outcome counts, pending gates
chant run fountain-converge # one tick, by hand — unchanged, and also the test story
chant approve fountain-apply rollout-gate # write a gate-resolution fact
Properties:
- The daemon is a convenience, never a requirement. If it dies, nothing breaks and nothing is lost; the environment stops converging until anything ticks it again. This is what behold's Run button would hold open for a local environment.
- A tick that finds the lease held skips and reports (
converge: skipped=1(lease-held)), never queues. - A tick that ends
gatedis a completed tick. The gate is a fact awaiting its counterpart, not a suspended process.
What this deliberately concedes to Temporal
Long multi-step pipelines with exactly-once step semantics, worker fan-out across task queues, and durable sleeps inside a step remain Temporal's, and the dial keeps that position for enterprise environments. But the converge frame exerts the right design pressure against wanting them: compensation and mid-sequence resumption are workarounds for non-idempotent steps, and the apply contract's whole point (tri-state envelope, owned-only prune, re-apply converges) is that chant verbs should be convergent, so re-running beats resuming. Same declared op, different runtime substrate per environment — the same shape as the observe/reconcile/apply dial.
Where this lives (implementation sketch)
- Operator loop:
packages/core/src/op/operator.ts(timer + lease + dispatch torunOpLocally), CLI verbs incli/. - Ledger record types: tick, gate-request, gate-resolution, lease — alongside the release-ledger types in
packages/core/src/lifecycle/, same orphan-branch plumbing (lifecycle/git.ts). - Lease:
update-refCAS on a dedicated ref under the ledger branch namespace;flockfast-path when no remote is configured. Leases carry an expiry and a fencing token (see open question 2). - Gate semantics: change to
GateStephandling in bothop/local-executor.tsand the generated Temporal workflow, so the two executors agree. - Docs: extend the ops guide with the pipeline-vs-converge distinction and the dial position table.
Acceptance criteria
-
chant operatorruns scheduled ticks for converge ops locally, no Temporal installed - All operator state (ticks, gates, leases, damping) lives on the ledger branch;
rm -rfof any local scratch changes nothing - Gate-as-fact semantics in both executors:
gatedis a terminal tick status;chant approveand PR-merge both resolve - Lease prevents concurrent ticks across two operator processes against the same environment (test: two operators, one remote)
- A killed operator mid-tick leaves the environment consistent; next tick (from cron or a restarted operator) converges with no manual repair
-
chant operator statusreports last tick, outcomes, pending gates from the ledger alone - Docs page: pipeline ops vs converge ops, and when to reach for Temporal
Open questions
- Sequencing: does the GateStep semantic change (suspension → fact) land as its own issue first? It touches the existing Temporal codegen and is the one part with migration impact on shipped ops. Leaning: yes, split it out and make this issue depend on it.
- Lease hygiene: expiry length, and fencing when a tick outlives its lease (the tick holds a token; ledger writes carry it; stale tokens are refused). This is the genuinely subtle part of the design and deserves its own test matrix.
- Gate authorization: PR-merge delegates to CODEOWNERS; what authorizes a bare
chant approve? Options: nothing in v1 (local trust), or a signed resolution record. Leaning: local trust in v1, signature as an additive follow-up. - Does the operator also tick
WatchOp/ReconcileOpschedules locally (subsuming their Temporal-only scheduled forms), or converge ops only in v1? Leaning: converge only, then generalize. - Remote-less projects: with no git remote, the ledger branch is local-only and the lease is
flock— is that stated loudly enough in docs that nobody mistakes single-machine durability for team-visible durability?
Activity
fix(ops): ConvergeOp honors the epic's autonomy table — no silent aut…
feat(ops): ConvergeOp — an executable runbook composite for per-envir…
feat(k8s): OperatorStack — the operating loop as a declared estate (#…
feat(ops): chant operator — native durable ticks for ConvergeOp, no T…
lex00 commentedon Aug 26, 2026
Landed via #1959: chant operator — durable ticks from git primitives alone. A per-op lease on refs/chant/lease/ acquired and renewed by git update-ref compare-and-swap (with failure classification: a genuine CAS conflict is verified by re-reading the ref, a stale .lock from a killed process surfaces as its own diagnostic naming the fix, and neither masquerades as "lease held"); fencing tokens checked against a stolen lease; reads fetch remote state into a side ref so a same-clone status read can never clobber a just-acquired lease. Ticks run ConvergeOps through the existing local path on an interval (--once for CronJob-style single ticks), crash recovery is re-acquire-and-re-tick over the idempotent tick design, and gates resolve as facts: a gated dispatch records a terminal "gated" outcome and chant approve appends a GateResolutionRecord to _gates/.jsonl (local-trust-only in v1). writeBlobToPath is now CAS-guarded with path-aware internal retries, so every ledger writer survives concurrent operators without silent clobbers. No Temporal, no new service, no new state store.
feat(core): the gate fact carries its address, and the resolution's l…