Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Keep execution policy out of document state (#11252)

Trevor Manz0b05b5d8eb4d
diff --git a/marimo/_core/protocol.py b/marimo/_core/protocol.py
index 2a313322b9..3845d7cfb0 100644
--- a/marimo/_core/protocol.py
+++ b/marimo/_core/protocol.py
@@ -466,7 +466,7 @@ class RunRequest(Struct, frozen=True):
Annotated[
tuple[RequestedCell, ...],
Meta(
- description="Cells of the document to run, in no particular order. What depends on them runs too, under the document's policy.",
+ description="Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.",
min_length=1,
),
]
diff --git a/protocols/host/openapi.yaml b/protocols/host/openapi.yaml
index ef1b779b78..90c6bc1ff9 100644
--- a/protocols/host/openapi.yaml
+++ b/protocols/host/openapi.yaml
@@ -501,9 +501,9 @@ paths:
description: |
Runs `code` in a copy of the notebook runtime's namespace, or runs
`cells` of the document. Scratch code stays out of the graph and
- its execution carries the submitted code. Cells run in the graph
- along with their dependents under the document's policy. Each gets
- an execution with its `cell_id` and no code. The host assigns a run
+ its execution carries the submitted code. The runtime's execution
+ configuration determines whether dependent cells run too. Each cell
+ gets an execution with its `cell_id` and no code. The host assigns a run
id independent of the request's `Idempotency-Key` and answers `202`
with the run `queued` or `running`. The rest arrives on the notebook's
stream with this request's key: executions as they start, console
@@ -1338,9 +1338,10 @@ components:
type: object
description: |
The document as a whole, without its cells, which are their own
- objects: the cell order, the app config, and the policy, which is
- what the notebook's file holds. One per notebook, identified by
- the notebook's id, and removed with it. The order and the app
+ objects: the cell order, app config, and host execution policy.
+ The policy is retained for v1 compatibility and comes from the
+ runtime configuration, not the notebook's app config. One per notebook,
+ identified by the notebook's id, and removed with it. The order and the app
config carry their own etags, so an edit to one does not conflict
with an edit to the other, or with edits to cells.
required: [id, order, app_config, policy, etag, saved_etag, order_etag, app_config_etag]
@@ -1775,7 +1776,7 @@ components:
type: array
minItems: 1
items: { $ref: '#/components/schemas/RequestedCell' }
- description: Cells of the document to run, in no particular order. What depends on them runs too, under the document's policy.
+ description: Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.
RequestedCell:
type: object
required: [id]
diff --git a/protocols/host/spec.md b/protocols/host/spec.md
index a3ee6196bb..18bdcfea67 100644
--- a/protocols/host/spec.md
+++ b/protocols/host/spec.md
@@ -38,8 +38,8 @@ earlier results stale. The notebook presents these relationships alongside its
document and results, allowing clients to follow how changes affect the
computation.
-A **runtime** is the kernel that evaluates cells according to the document's
-dependencies and execution policy. A host can attach a runtime to produce new
+A **runtime** is the kernel that evaluates cells according to their dependencies
+and its execution configuration. A host can attach a runtime to produce new
results or serve the document and retained results from storage.
Hosts advertise their capabilities as a set of operations, which clients use to
@@ -262,10 +262,10 @@ formatting, MUST reach clients through the document stream as well.
### Execution
Clients can request document cells or submit scratch code. Cells execute under
-the notebook's reactive policy, which determines how dependent cells are
-scheduled. Scratch code runs against a copy of the runtime namespace outside
-the document's dependency graph. A client can ask the host to verify that a
-cell's code still matches what it read before executing it.
+the runtime's execution configuration, which determines how dependent cells
+are scheduled. Scratch code runs against a copy of the runtime namespace
+outside the document's dependency graph. A client can ask the host to verify
+that a cell's code still matches what it read before executing it.
An accepted execution request starts a run whose progress and results arrive on
the notebook stream for all attached clients. Clients that need to observe the