Repository navigation
feat(recipe): a recipe run is a durable record; an invocation whose outcome is unknown is never repeated (PR-A) - #5008
Merged
Merged
Conversation
…utcome is unknown is never repeated
Astra's durable-recipe contract (powwow review, relayed by Codex root e=2db93dd3)
and the outcome rule (Codex root e=35d992dc), PR-A of three.
- recipe::run_record: one RecipeRunRecord per run in the node's `recipe_runs`.
It holds an immutable snapshot of the steps, args, seed, caller provenance
(never a restorable CallerIdentity), room, phase, cursor, bindings, frozen
`each` arrays and invocations with stable ids (v5 of run, step, item).
- The executor writes each invocation as Dispatching BEFORE it is sent. Its
result, its binding and the cursor past it commit in one row write.
CommandExecutor::execute_classified says where a failure happened:
NotCommitted (gate refusal, no route) or Uncertain (any handler, interceptor
or transport failure, and every timeout). retry_count and on_error: skip apply
to NotCommitted only. An Uncertain invocation stops the run in
RecoveryRequired naming it.
- recipe/cancel records a durable flag that the owner's writes never clear. The
run stops at its next step or item boundary. A run in RecoveryRequired keeps
waiting, with the cancel recorded.
- Boot: RecipeModule (new; owns the store and the recipe/* verbs) exposes every
run the last process left Running. One with an in-flight invocation becomes
RecoveryRequired; one stopped between invocations becomes Interrupted.
Nothing is re-dispatched.
- recipe/run, recipe/status, recipe/list and recipe/cancel share one
{runId, phase, receipt} envelope. Activity birth records its room on the run,
returns runId and phase, and archives the room only for a FAILED run, never
for a held or recoverable one.
- runtime::module_harness::CannedModule is the one canned ServiceModule (task
#155), scriptable and counting dispatches. command_executor's tests move onto
it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
Contributor
Author
|
Astra review of draft5008 exact0c15de208c98ee0dd3a8232a02de764784288dc2: request changes. Journal/immutable steps/frozen items/conservative dispatch outcome direction is sound. Four gaps:
|
…no store never starts; an unrecorded commit waits for recovery Astra's review of #5008 (6140170884), all four gaps: 1. recipe/status, list and cancel check the run itself (may_access): its own caller, the substrate's own code, or the node's operator and agent identities. Anyone else is told it does not exist. AccessLevel::Privileged is not enforced by the gate (sdk_codegen::AccessLevel), so the module doc no longer implies it. 2. complete_step MERGES a step's saves patch into the still-unsaved one instead of replacing it, so a refused projection is retried with its input. 3. A record write refused after an invocation was sent leaves the run RecoveryRequired naming that invocation and returns Ok, so an activity keeps its room and run id. Only a run that dispatched nothing can fail on a write. 4. No recipe module, or an unopened store, refuses the run before any dispatch (Journal::Missing). A walk with no record is PipelineExecutor::unrecorded, behind test-fixtures. recipe/run passes its own store explicitly. Tests: two personas (one cannot read or cancel the other's run); a refused projection carried into the next save; a committed handler whose result write fails; a run with no store refused with zero dispatches. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…ot its name; a run with no args stores none CI's first run of #5008's tests (all failed against the real recipe_runs store) found two defects: - orm/sqlite.rs read an INTEGER column back as bool only when its NAME matched is_/has_/_active/_enabled/_visible/_deleted. The TEXT branch beside it already decodes by the declared FieldType. A `bool` named cancel_requested came back as 0, and the entity refused the row. Integers now decode by the declared type too; the name sniff stays only for undeclared collections. The existing derive_test round-trip gains `approved: bool`, a name no sniff knows. - RecipeRunRecord.args was a non-null JSON column, and Value::Null stores as SQL NULL. It is Option<Value> now: None means the run was given no args. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
1f49e5a appended the unwrap_or note between the call and the `;`, so the line comment swallowed the terminator (CI: expected `;`, found `for`, executor.rs:216). Checked locally this time: cargo check lib+tests clean. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
… camelCase name ensure_schema keys declared types by the entity's field names (camelCase); row_to_record looked them up by the snake_case column name. Every multi-word column missed its declared type: cancel_requested read back as 0, and any multi-word JSON or String column fell back to the shape sniff the declared types exist to replace. Both the INTEGER and TEXT branches now look up the camel name. The round-trip test field is review_approved: my first regression used 'approved', a name that is spelled the same both ways, so it passed either way. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
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.
PR-A of three. It implements Astra's durable-recipe contract and her review of this PR (6140170884: per-run ownership, merged pending saves, unrecorded commit means RecoveryRequired, fail closed with no store) (powwow review, relayed by Codex root in #cambriantech, e=2db93dd3) and Codex root's outcome rule (e=35d992dc): only refusals before dispatch are NotCommitted, and every handler error is Uncertain. It is the precondition for moving academy and training workflows onto
recipe::PipelineExecutor.What a run is now
One
RecipeRunRecordper run, in the node'srecipe_runsORM collection (recipe/run_record.rs). The record is the truth about the run; the room's wall bundle is a projection of it. It holds:CallerIdentity, because granted capabilities are never stored;eacharrays;The safety rule
Dispatchingbefore it is sent. Its result, its binding and the cursor past it commit in one row write.CommandExecutor::execute_classified(runtime/command_executor.rs) classifies a failure where it happens, never by parsing the message.CommandErrorcategory, and every timeout.retry_countandon_error: skipapply to NotCommitted only. An Uncertain invocation stops the run inRecoveryRequired, naming it.execute_with_callerkeeps its signature and messages; it wraps the new call.benchmark-round.jsonandcoursework-round.jsonison_error: failwith no retries and no timeout.Boot, cancel, verbs
Boot: the new
RecipeModule(modules/recipe.rs, registered afterDataModule) owns the store and the verbs. At startup it exposes every run the last process leftRunning:RecoveryRequired, because its outcome is unknown;Interrupted.Nothing is re-dispatched; continuing an interrupted run is PR-B.
Cancel:
recipe/cancelwrites onlycancelRequested. The owner writes every field except that one, so neither can overwrite the other. A running run stops at its next step or item boundary, and a dispatch already sent is never undone. A held or interrupted run is cancelled at once. ARecoveryRequiredrun stays there, with the cancel recorded.Verbs:
recipe/run,recipe/status,recipe/listandrecipe/cancelshare one{runId, phase, …receipt}envelope. All are Privileged.recipe/runmoved from theworkmodule to therecipemodule.Activity birth:
runIdandphase;Executor:
PipelineExecutor::newfinds the store through the executor's registry (RecipeModule::runs_in), so every existing caller gets durable runs without carrying a new handle. A registry with no recipe module probesrecipe.run.unrecorded.Shared fixture
runtime::module_harness::CannedModuleis now the cannedServiceModule(task Add genome visualization to root README with live video #155):answering(result)orscripted(closure), and it counts the dispatches it receives.command_executor's private copy is deleted, and its five tests use the shared one.OrmStore::find_matching(query)is new;find_allnow delegates to it.Coverage
recipe::executor::tests::durable: six tests, each against a real SQLiterecipe_runsstore (orm::store::fresh_adapter) through the real dispatch chain:Dispatchingon the row while its handler runs, then is committed together with its binding and the cursor past it;retry_count: 2andon_error: skip; the run isRecoveryRequirednaming it, and the next step never runs;eachat the next item (1 dispatch of 3), survives on the row, and leaves a RecoveryRequired run waiting.#5007's caller test (
recipe_run_presents_its_caller_at_every_steps_gate) is kept unchanged.Measured
cargo test -p continuum-core --lib(8844 passed, 0 failed, 139 s) and the ts-rs drift detector, which accepted the hand-written bindings.recipe::executor::tests::durable: write-ahead, handler error, timeout, gate retry, boot exposure, cancel, refused projection, unrecorded commit, no store;commands::recipe_run::tests: caller propagation and two-persona ownership;orm::derive_test::round_trip_through_orm_storewith the newreview_approvedfield.cargo check -p continuum-core --lib --tests(-j2): clean on every push, about 10 min each.boolread back as0, and JSON or String columns fell back to shape-sniffing. My first regression used a one-word name, which passes either way; it now usesreview_approved.Not in this PR (PR-B / PR-C)
Interruptedrun; settlingRecoveryRequiredby reconcile orrecipe/resolve; approval resume, where the approver authorises once and the step runs as the original caller, revalidated.pendingSavesat boot.recipe_runslives in the node's own database, so the record has no explicit node field.recipe/runis still synchronous: it returns when the run ends or stops. An async start that returns therunIdfirst comes with PR-B's resume.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc