What durable wakeup contract serves controllers and Klaus?
State
question or idea
Created
2026-10-31 by contributor
Body
Settle the smallest shared contract by which a durable ref change makes a dependent controller due. This develops ida-14d2a61 for the one-minute outcome oc-0e703d0, with Klaus (oc-0cd4bee) and the valley runtime (oc-740d6a8) as future clients.
Decide and document:
- Which input refs wake the worker and each project's integrator; include policy, identity/signers, evidence and request changes, not just branch pushes.
- How post-receive and integrator-written refs both emit wakeups, since local update-ref does not run post-receive.
- Where due state survives restart, how duplicate notifications coalesce, and how a new wakeup during a running pass remains pending.
- Startup reconciliation and a slow recovery resync; distinguish recovery from normal latency. Infrastructure failures still need bounded retries when no new ref arrives.
- Serialization, resource bounds, observability, and refusal of stale work. Wakeups carry no execution arguments, credentials or authority; controllers reread durable state.
- A local host implementation using the existing publish-queue/path-unit precedent, and how authenticated JetStream delivery can later use the same contract. Existing NATS is localhost, unauthenticated and publish-only; remote consumers retain prerequisite oc-82586b3.
- How the contract supports worker results and future Klaus job completion without requiring the whole runtime migration now.
Done when a reviewed design is recorded in the source's architecture/reference layers and this question links that change. Compare concrete alternatives and state crash/race acceptance scenarios before implementing. Baseline evidence comes from oc-28b1c77. Do not install or deploy a new runtime as part of answering this question.
Comments
contributor2026-10-31 21:21 UTC
Design review started on 2026-10-31. A read-only panel is comparing two concrete approaches: durable local due state with host wakeups first, or authenticated JetStream subscriptions first. Both must keep durable refs authoritative, preserve updates arriving during a pass, and cover cross-project policy/identity dependencies. Panel input: session-20261031-1741-78ca0541/workspace/wakeup-design-consult.txt. The session's ongoing event watch reports completion.
Additional source finding: the host worker has CPUAffinity=0 and max-jobs=1; worker-e2e explicitly tests serial builds. attest's parallel support therefore does not imply parallel host-worker execution. Keep this resource policy unchanged in the first wakeup slice; revisit separately with measured host capacity and fairness.
contributor2026-10-31 21:24 UTC
Coordinator source review found a dependency the wakeup design must cover: integrator/refs.go:handle keys its memo only by request head, target tip and evidenceState. answered retains stale/reject verdicts indefinitely when those three stay fixed. A floor or known-signers change can therefore wake a controller without causing it to reconsider a remembered answer. integrator/main.go also loads signerProjects once at process startup. The design must specify input fingerprint/reload semantics as well as wake routing, or explicitly bound the first implementation to inputs already tracked. Merely deleting the poll interval does not solve this.
The first panel answer favors local durable due marks with JetStream as a later authenticated delivery adapter. A bounded due->claimed rename under a single consumer lock is preferable to stat-then-unlink acknowledgement, which can lose a producer update between those operations. Keep wake dispatch independent of mirror/network success, and preserve existing per-item retries without turning transient observation failures into an idle acknowledgement.
contributor2026-10-31 21:31 UTC
Both read-only panel members recommend local durable due state first. JetStream authentication remains separate: a durable consumer cannot recover events a best-effort producer never published. The shared contract is an advisory wake followed by reconciliation from current authoritative refs, with bounded coalescing, safe claim/ack, duplicate tolerance, startup/recovery scans and explicit transient retries. It is not historical event sourcing or durable agent-run storage.
First implementation slice: oc-29d5091 makes the check worker wake promptly while preserving build limits and SSH-only repository access. Its brief includes external pushes, local integration/signers writes and cross-project floor inputs; it does not convert integrator, identity or restacker lifecycles. A separate critic is reviewing that bounded brief before dispatch. The production baseline remains open; this slice removes a proven fixed idle delay without changing queue ordering or check rules.
The integrator memo gap is tracked as bd-4619dc1 and blocks the full controller outcome oc-dcdca96. A source change documenting the implemented due contract will be linked here; the question remains open until the remaining controller semantics are recorded clearly. Reject panel details that would leave unbounded marker files, race acknowledgement with producers, or wait behind mirror network work.
contributor2026-11-01 16:18 UTC
Direction update, 2026-11-01: the operator prefers retained history to be authoritative for accepted workflow state. Earlier comments selecting authoritative current refs with advisory wakeups describe the implemented local optimization, not a settled long-term architecture. The design must now define acceptance, retention of referenced objects, replay/recovery, authorization, and handling of external effects before selecting the authoritative store. JetStream remains a candidate, not a decision.
The immediate latency work can use bounded local notifications around the existing reconciler without claiming to resolve this architecture. Keep that optimization and the authoritative-history design separately reviewable. The full question stays open.
contributor2026-11-01 17:27 UTC
The broader platform requirements now live in oc-0bd6677, The valley provides durable operational history and observability, graduated from the operational data warehouse idea ida-ef3cc9b. Resolve authoritative acceptance/history and replay together with that outcome, while keeping this knot's controller delivery/wakeup work scoped and the immediate latency changes independent. The interim telemetry work under oc-8e7e027 is not an answer to either long-term architecture question.
contributor2026-11-02 20:47 UTC
Interim client wake, 2026-11-02. The bus still needs authentication (oc-82586b3), and the host wake marks are local files, so no off-host client can subscribe to either. Klaus is being changed to run `valley telemetry follow` on the integrator and worker sources and to start its valley read at once on a decision, evidence.stored or batch.end record, keeping its one-minute timer as recovery. The records serve only as wakeups: Klaus still reads state from `valley changes`. Measured lag before: 69 to 143 s from landing to Klaus noticing. The durable contract this question asks for should replace that stream.
contributor2026-11-09 00:21 UTC
Direction, 2026-11-09: a change's path to main is one state machine that pushes toward integration. Every step's completion is an event that makes the next step happen, whoever takes it: a host controller (worker, integrator, restacker, follow checks) or a client outside the host (an agent finishing its work, a fix for a failed check or a restack conflict, a review, an approval). Host-internal steps already wake each other (oc-dcdca96). The gap is the client-facing half: the valley publishes no transition a client can subscribe to, so a client learns that a change needs it only by polling and diffing change listings, and a client that stops listening misses the step entirely. Settle this contract with the change's states named, the actor who moves each one, and the event each transition emits, durable enough that a client that comes back catches up.
contributor2026-11-09 00:36 UTC
Decisions, 2026-11-09, after a cross-model panel:
1. A change's position is a few independent parts, not one exclusive stage: the change (draft, ready, withdrawn, landed), each version's checks, approval and integrator verdict, a current restack conflict, and the project's main health. The valley derives from them one answer: the next step and whose move it is. No ordered first-match rule table.
2. The worker publishes a signed failure note when a required check fails on a ready change, as it publishes a passing note today. A failure becomes durable evidence, not local worker state.
3. Durable refs stay authoritative. Each controller that completes a step appends the transition to a per-project journal in project storage. Clients read it from a cursor (valley events --after <cursor> --follow) and get a snapshot when the cursor is lost. A transition is recorded in the same ref transaction as the state change it reports, so a crash never loses one. Telemetry and the bus are not the journal.
4. A project's events are readable by whoever may read its source.
Panel findings verified against source: the restacker polls every 15 s with no wakeup (restack/main.go:212); a failed worker check is recorded only in the worker's failures.json and telemetry (status/worker.go:117).
Per docs/architecture.md, planned work lives in the plan graph: the design is recorded here, and each slice documents its mechanism in the architecture layer as it lands.
contributor2026-11-09 00:38 UTC
Decision, 2026-11-09: reviews and approval are checks with different runners. Policy requires checks. The host worker runs builds, a client runs a review (an agent reviewer, or the coordinator that launched the agent), and a person with their key runs the approval (as approval/v1 models it). A request for changes is a failing check: it loops back to the author, a new version follows, and the review is due again. A build result binds to a tree; a review binds to the delta, so a restack that keeps the delta keeps the review. The host can't run a review: the valley marks it due and publishes that, and a client answers it with a signed record. The next step is always the next unmet check, and the move belongs to its runner.
contributor2026-11-09 00:55 UTC
The design under these decisions is ida-d86bb7a (authored by Astra, codex gpt-6-astra xhigh, 2026-11-09). It awaits the direction owner's shape review before slices are filed.