Repository navigation
FIX-1788 P1: check every session at create; server-owned session data - #2850
Conversation
…a out of callers' hands (FIX-1788 P1) A flow can declare `session.createCheck` and `session.serverOwned`. Every path that writes a new session record (the create route, an action on an unused id, a webhook delivery, `fsdev run`, a dispatch into a key-derived child) goes through one birth function that runs the check, reclaims the id's resource-state tombstones and writes create-if-absent. The check's answer is stored as the record's `link`, which nothing writes afterwards; a create that seeds a server-owned state field is refused with a 400 naming it. The client takes `worker` on `createSession` and `listSessions` (sent as `link`), `useFlow` passes it to both, `fsdev run` takes `--worker`, the session listing filters on `link` in all four store adapters, flow code reads `ctx.session.link`, and `requireRequestHost(ctx).sessionFacts(id)` reads one of the caller's own sessions' server-written facts by id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 7f857766-4cd1-4c28-bee0-dff99d98fb8a) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 54ecec4b-1ab1-4280-89d3-0f55a72a7c6e) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Code Snob — already tight. No POC.
I read packages/engine/src/context/session-birth.ts, ensure-session-record.ts, packages/core/src/types/session-create.ts, the five birth call sites (session-routes.ts, createExecutionContext.ts, runAction.ts, transports/webhook/session-resolver.ts, create-request-host.ts), packages/cli/src/commands/run.ts, packages/client/src/session-client/sessions.ts, packages/react/src/hooks/useFlow.ts, and the link predicate in the memory, filesystem, sqlite, and postgres session stores.
The shared contract is already one function. Each caller only keeps what differs: 409 versus adopt versus evaluateAdoption, and an HTTP status versus a CLI error versus DispatchRefusal. Folding those policies into birthSession moves the branches; it does not delete them. readCollectionItem is a point read before any session row exists. getPersistedData loads a whole scope off a session and is the wrong call. The four list filters are one equality in each store's existing dialect. Client worker mapped to wire link is the name split this PR already recorded. The admission checkSessionCreate in runAction is the refuse-before-a-request-is-written path; dropping it changes when the 400 happens.
A rewrite would not shrink the contract.
Sent by Cursor Automation: Code Snob
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97894aa55c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Simplify / architecture review
Verdict: The multi-path problem (create route, action, webhook, CLI, dispatch child) really does want a single write funnel. Centralizing tombstone purge → create check → CAS create in birthSession / ensureSessionRecord is the cleaner alternative to sprinkling createCheck at each call site; I would not recommend “check only on POST /sessions” or a thinner wrapper without that funnel.
What looks like the right tradeoff
- Core owns the contract (
session-create.ts); engine owns enforcement (session-birth.ts). That split is easy to navigate. runAction’s earlycheckSessionCreate(action path,link: undefined) is a deliberate “refuse at the door” gate before registration; keeping birth as the only writer of new rows is coherent.- Tests that pin “only
session-birthdoesset(..., "absent")” match the intent.
Where complexity crept in (worth trimming in this PR or a fast follow-up)
-
Parallel “initial session state” stories — Create route parses caller state through the flow schema; dispatch children use
resolveSessionStateDefaults; CLI birth usesstate: seedData ?? {}without defaults. Same invariant (“typed reads never see missing keys”), three implementations. A sharedresolveInitialSessionState(flow, callerState?)would shrink mental load across route / dispatch / CLI. -
ensure-session-record.tsvssession-birth.ts—ensureSessionRecordmoved intosession-birth.tswhile the old file is now mostlypurgeStaleResourceState+ essay. New readers grep the wrong module. Rename or colocate purge with birth. -
sessionFactsorg gate — Same file already usesmatchesOrgFilterfor descendant checks (BP-030 null/omit semantics).sessionFactsuses strictrecord.orgId !== identity.orgId, which can disagree with dispatch/adoption for legacy rows. Align before callers rely onsessionFactsin production. -
Duplicated HTTP mapping —
SessionCreateRefusedError→ JSON appears in create, action, and webhook routes. A smallroute-utilshelper (like existing concurrency refusals) would be a one-time simplification. -
readCollectionItemAt— Reasonable for v1, but it re-implements a slice of resource-route scoping. If a second consumer appears, extract a principal-scoped collection read next toresources/internalrather than growingsession-birth.ts. -
Performance (non-blocking) —
runAction→createExecutionContext→birthSessioneachsession.geton first touch; passing the already-loaded miss into birth would be a larger API change. Fine to defer; worth a one-line comment atbirthSession’s leadinggetthat callers often just missed. -
Nits —
Object.freezeon create-check input (alloc every create); webhookversion: 1vs0on other birth paths (confirm intentional).
Third-party packages: Nothing here obviously replaces custom logic; Zod already covers session state on the create route. createCheck is policy + scoped reads, not schema validation.
Tests: Ran pnpm --filter @flow-state-dev/engine test -- session-birth — passed.
I’m leaving comment-only (not blocking merge): the funnel is the right shape; the items above are simplifications and one consistency fix I’d prefer before heavy sessionFacts / workforce adoption, but they don’t overturn the approach.
Sent by Cursor Automation: Review For Best Approach
| | `retention` | `{ maxItems?, maxAge? }` | unbounded | Bounds the persisted item log. `maxAge` is milliseconds or a duration string (`"7d"`). Oldest completed requests evict first. A request stays until its run has finished, `onFinished` and any background work it started included, and for twice the configured `LIVE_TAIL_LIVENESS_MS` after (one minute by default), so a busy session can briefly exceed its limits; a request kept this way still counts toward `maxItems`, so older history is evicted in its place. Deleting a request also removes its stream events and cached step results. See [Deleting requests](/docs/persistence/overview#deleting-requests) for the edge cases and what a custom store must support. | | ||
| | `historyWindow` | `{ turns: number }` | `50` | Caps cross-turn history loaded per request. `0` or a negative number disables it. Per-call `history({ limit })` can only shrink this window. | | ||
| | `cas` | `CASOptions` | — | Optimistic-concurrency options for this scope. | | ||
| | `createCheck` | function | none | Runs before a session of this flow is written, on every path that creates one: the create request, an action sent to a session id that doesn't exist yet, a webhook delivery, `fsdev run`, and a dispatch into a child session. It receives the verified caller and the create's `link` input, and can read items of the flow's user- or org-scoped collections at that caller's own scope. It refuses the create, or returns the value stored as the session's `link`, which nothing changes afterwards. A create with no `link` input is refused. A turn on an existing session never calls it. | |
There was a problem hiding this comment.
We need a proper example showcasing how all this works, because this doesn't really make a lot of sense to me from a docs perspective.
There was a problem hiding this comment.
Agreed. This section explains the mechanism but never shows it in use. The next push changes the API slightly: the check only accepts or refuses, and a dispatcher can pass its input. After that push, a worked example goes in, written from the public API alone and then edited. It will show:
- a flow declaring a create check;
- creating a session with the value it checks;
- a block reading
ctx.session.link; - listing sessions by it;
- what a refused create looks like to the caller.
I'll leave this thread open for you to resolve.
Generated by Claude Code
There was a problem hiding this comment.
The worked example is in, as of da53df6, but its shape has changed from what my earlier reply described: there is no link any more.
It's at Fundamentals → State and scopes → "Example: one session per project". It shows:
stateSchema: z.object({ projectId: z.string().readonly() }). A readonly field is set when the session is created and never changes, and most flows need only this.- An optional
createCheck, used only for "this project is yours or shared with you". createSession({ state: { projectId } })andlistSessions({ state: { projectId } }).- A block reading
ctx.session.state.projectId. - What a refused create looks like to the caller.
This section of configuration/flow.md now points to the example. I'm leaving this thread for you to resolve.
Generated by Claude Code
…8 P1)
- The create check now accepts or refuses, and an accepted link is stored
as the create sent it, so callers create, list and compare by one value.
- `dispatcher()` takes `session: { key, link }`, so a public dispatcher can
create a child on a flow that checks its creates.
- `useFlow` drops the active session when its worker changes.
- `readCollectionItem` takes parameter values for a parameterized collection.
- One `resolveInitialSessionState` for the create route, a dispatched child
and `fsdev run --seed-session`; webhook-born sessions start at version 0.
- The tombstone reclamation moves beside the birth function; one route
helper answers a refused create.
- `ctx.session.lineageId` beside `ctx.session.link`; the request host's
`sessionFacts` verb is removed.
- Docs follow the editor pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: f93fc0ce-771d-4ec7-b368-d62021b6ecd3) |
|
@codex review 715ef49 changes the create-check contract: a check now accepts or refuses, and the stored link is always the input. It also adds Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 715ef495a6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…spatches (FIX-1788 P1) - `dispatcher()` gains a first signature for an internal dispatcher that declares `inputSchema`, so `key`, `link` and `id` see the schema's input (they were `unknown`, for `key` too). A type test pins it. - A task dispatcher takes `link`, a string or `(task, ctx) => string`, and the dispatcher and the task board's hand-off create each child with it. - The create route and the listing take a link exactly as sent, untrimmed. - `fsdev run` checks a session another run created first (owner and worker) before running on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 62c9f5ae-d419-4eb6-ab1f-c11d85ba3dea) |
…nk (FIX-1788 P1)
A session's binding is now ordinary session state in a field the flow's
session stateSchema declares .readonly(). Every create path goes through the
one birth function, which parses the initial state through the schema and
refuses a state it rejects (never stored raw), refuses caller-seeded
serverOwned fields, and runs the optional session.createCheck on the parsed
state with the caller's identity. A readonly field is fixed for the
session's life: the session state operations refuse any mutation that
changes one (ReadonlySessionStateError), and fsdev run --seed-session
refuses the same change.
listSessions({ state }) and the list route's state.<field> filter select
sessions by a readonly field, filtered in each store's query. dispatcher()
takes session: { key, state } and a task dispatcher takes state.
Removed with no alias: the link container (SessionRecord, SessionTarget,
ctx.session.link, the ?link= filter), the client's and useFlow's worker
option, and fsdev run --worker.
Docs lead with the schema and add createCheck only for a rule that depends
on the caller or the store.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
…at bind sessions (FIX-1788 P1) A flow binds its sessions when it declares a top-level .readonly() session-state field or a session.createCheck. Only such a flow refuses, at create, an initial state its stateSchema rejects. Every other flow keeps the state as sent, as before, and its actions validate it when they run: the workforce mailbox and project rooms create sessions half-filled on purpose. Widening the refusal to every flow waits on FIX-1792. Adds the off-state test (a flow with neither keeps a rejected state raw, through the create route) and narrows the docs to say it in those terms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 03e1fe46-c51a-4e0a-910c-49f769c2dcac) |
Shows where a task dispatcher's `state` goes (beside `session`, with every policy) and points the internal dispatcher's row at it; gives the client's `state` a referent; defines "binds its sessions" where it is first used; matches the refusal body to the table; drops a repeated point; writes `createCheck`'s signature with its Promise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 728d6126-20b5-4a60-8052-726e30fc5d42) |


The problem
Today anyone who creates a session decides what is in it. The create request takes the caller's
stateand stores it, falling back to the raw value when the flow's schema refuses it, and an action sent to an unused session id creates one with no questions asked. That is fine for a draft or a preference. It is not fine for the thing the workforce epic needs a session to carry: which worker it runs. A caller who can write that value can point their session at someone else's worker, or move a running session onto another one. Workers can't become private until a session's binding is checked once, when it is created, and can't move after.What this does
The binding is ordinary session state, held in a field the flow's session
stateSchemadeclares with zod's.readonly(). The engine enforces three things on every path that brings a session into existence:.readonly()field or acreateCheck. Its starting state must match the schema or the create is refused with a 400 naming the field, and nothing is written. Most such flows need nothing more than the schema. Every other flow keeps today's behaviour: the state is kept as sent and validated when an action runs.createCheck(optional) is for a rule the schema can't express, one that depends on who is creating the session or on what exists in the store. It runs after the schema, with the parsed state and the verified caller, can read the caller's own user- or org-scoped collections, and accepts or refuses.serverOwnedstill names fields a caller may not seed.The five ways a session comes into existence (the create request, an action sent to an unused id, a webhook delivery,
fsdev run, a dispatch into a child session) all go through one birth function, so none of this can be skipped by adding a sixth. Around it:createSession({ state })is the only way to set the binding;listSessions({ state: { workerId: "w1" } })and?state.<field>=<value>list by a readonly field, filtered in each store's query;dispatcher()takessession: { key, state }and a task dispatcher takesstate; blocks readctx.session.state.<field>. Thelinkcontainer, the client's anduseFlow'sworker, andfsdev run --workerare gone, with no alias (epic D9).flowchart LR A["create request · action on a new id · webhook · fsdev run · dispatcher()"] --> B["one birth function"] B --> S{"stateSchema"} S -->|refused, on a flow that binds its sessions| D["400 naming the field · nothing written"] S -->|parsed| C{"createCheck, if declared"} C -->|refused| D2["4xx · nothing written"] C -->|accepted| E["session · readonly fields fixed for life"] E --> F["every turn reads ctx.session.state · a write that changes a readonly field fails"]What's asked of you
Nothing to decide on direction: this reworks S1 of the approved spec (FIX-1788) to the shape the product owner chose on this PR (binding from initial state, fixed fields declared
.readonly(),createCheckoptional). One thing to know: the create-time schema refusal is opt-in, on flows that bind their sessions. Making it universal broke 53 workforce tests, because the mailbox and project rooms create sessions half-filled on purpose. Widening it is a follow-up below.Parts worth reviewing closely
packages/engine/src/context/session-birth.ts. The birth function: schema parse (refuse on a flow that binds its sessions, keep as sent otherwise),serverOwned,createCheckon the parsed state, tombstone reclamation, create-if-absent. The check runs on a miss only, and a lost race adopts the winner without re-checking.createScopeStateOpstakes aguardthat wraps every session mutation (stores/state-container.ts), wired increateExecutionContextfromgetReadonlyStateKeys(corehelpers/zod-introspect.ts). It compares each readonly field against what the session was created with, on every mutation the session's state operations apply, rather than on one write verb.getReadonlyStateKeysreads zod 3 and zod 4. Core is on zod 3 and an app (the CLI's fixtures) can hand it zod 4. Only a plain object root counts; a union, lazy or wrapped root has no readonly fields, and astatefilter on such a flow is refused rather than guessed.matchesStateFilter; SQLite usesjson_extractwith a bound path, Postgres#>>with a boundtext[]path. The route admits only readonly fields of the named flow, and refuses anything else with a 400.fsdev run --seed-sessionbirths the session through the same function, and on an existing session refuses a seed that changes a readonly field or sets a server-owned one, including after losing a create race.Links: spec
specs/issues/FIX-1788/· FIX-1788 · epic FIX-1786 · stack: P1 of three, based onmain; P2 (the worker model) builds on this branch, then P4 (the switch). Merges.Follow-ups: Widen the create-time schema refusal to every flow once FIX-1792 removes the mailbox's half-filled sessions.
How to review this
Engineering calls
.readonly(), top-level only. A readonly field with a default is still fixed..readonly()deeper inside a field's value doesn't make the field fixed. A non-object root has none.Readonly<Record<string, unknown>>. It accepts or refuses and can't rewrite the state, so what a caller creates with is what is stored and listed by.runAction) on a flow with a check, before anything is registered, so an action on an unused id is a 400 with no 202 first. The birth inside the context runs the same checks again if the session is still absent there."absent".sessionCreateRefusedResponse) turns a refusal into the response for the create, action and webhook routes, withfieldwhen one field was the reason.useFlowsends no initial state. Withworkerremoved, itscreateSessionandautoCreateSessionare refused on a flow whose sessions need a readonly field; the docs say to create through the session client andselectSessionthe result. Workforce's client (P2) maps itsworkertostate: { workerId }.dispatcher()'s{ key }session takesstate, an object or(input, ctx) => object; a task dispatcher takesstatebesidesession, an object or(task, ctx) => objecthanded the row's assignee, id and input (resolveTaskState), and the hand-off forwards it. A target's refusal is theDispatchRefusal"create-refused". An existing child is adopted with no check and keeps its state.dispatcher()session callbacks are typed frominputSchema, by a first overload for an internal dispatcher that declares one; pinned bydispatcher-session-inference.type-test.ts.ctx.session.lineageIdstays, for FIX-1794's partition;session.serverOwnedstays.createTestContext,testFlow) and the DevTeam lab host still seed session records directly; they are fixtures, not creators a caller reaches. The lab host moves in P4.Everything else
Verification (BP-003). Each check was seen red before green, by mutating the code and running the named suite (script kept out of the repo).
serverOwnedandcreateCheckrun on the create route, action path, webhook resolver,fsdev runand a dispatched childpackages/engine/test/session-birth.test.ts(27),packages/cli/test/run-command.integration.test.ts›--seed-sessionsession-birth.test.ts› "keeps a state the schema rejects as sent…"runAction, while other fields still writesession-birth.test.ts› "a readonly state field"fsdev run --seed-sessionrefuses a readonly change, including after a lost racerun-command.integration.test.tssession-birth.test.ts› listing;list-option-wideningsin engine (memory, filesystem), store-sqlite, store-postgresstateasstate.<field>packages/client/test/sessions.test.tsdispatcher()and a task dispatcher create the child with theirstate, and the target refuses without itsession-birth.test.ts› dispatchpackages/core/test/readonly-state-keys.test.tssession-birth.test.ts› "is the only engine source that creates a session record"projectIdwith and without a check, list filter,loadProjectoutputctx.user.identity.idas owner: 404 for the owner, so the page usesuserIdRun locally on
fa76e459b: the engine typecheck, the docs build, and the suites of engine, client, fsdev, store-sqlite, store-postgres, orchestration, workforce (1420/1420), testing and integration-tests, all passing. Core and react, unchanged by the last commit, passed onc5325da38with a fullpnpm typecheck. CI on the current head is the live answer.Docs. "Creating sessions" and the worked example in
apps/docs/docs/fundamentals/state-and-scopes.mdlead with the schema (z.object({ projectId: z.string().readonly() })) and addcreateCheckonly for "this project is yours or shared with you"; thestateSchemaandcreateCheckrows inconfiguration/flow.md; the api pages for the client, React and the CLI;{ key, state }andcreate-refusedinserver/background-work.md; the task dispatcher'sstateinorchestration/task-board.md; README entries in core, engine and client;docs/architecture/state-and-scopes.mdfor the birth function and readonly fields. I can't dispatch the docs-writer or docs-editor agents from here; I wrote these myself and the coordinator runs those passes.Changeset. One fragment,
minorfor engine, core, client, fsdev, orchestration, store-sqlite and store-postgres:linkandworkerare removed andstatefiltering, readonly fields and dispatcherstateare new.Files.
core:types/session-create.ts(the check's types),types/flow.ts(createCheck,serverOwned, readonly fields),types/scope.ts(ctx.session.lineageId),types/dispatch.ts({ key, state? },TaskStateTarget,resolveTaskState,"create-refused"),blocks/dispatcher.ts,helpers/zod-introspect.ts(getReadonlyStateKeys).engine:context/session-birth.ts(birthSession,checkSessionCreate,parseInitialSessionState,ensureSessionRecord,refuseServerOwnedState,refuseReadonlyStateChange,ReadonlySessionStateError,SessionCreateRefusedError),stores/state-container.ts(the guard), the create, action, list and webhook routes, admission, the dispatch seam, and the two in-process stores.store-sqlite,store-postgres: the state filter.client:listSessions({ state });cli:--workerremoved,--seed-sessionthrough the birth;orchestration: the hand-off forwardsstate.reactis back tomain.🤖 Generated with Claude Code
https://claude.ai/code/session_01XMg2dz8sMEdyzCQTRsaMTV
Generated by Claude Code
Note
High Risk
Centralizes session creation and enforces binding/auth rules (createCheck, readonly, serverOwned) across HTTP, CLI, webhooks, and dispatch—incorrect checks or race handling could block legitimate sessions or leak access decisions.
Overview
Adds session binding at create time: flows can declare
session.createCheck, block caller-seeded fields withsession.serverOwned, and fix top-level fields for a session’s life via.readonly()insession.stateSchema. On flows that bind sessions (readonly field or create check), invalid initial state is refused with 400 (andfieldwhen applicable) on every create path; other flows still accept raw state as today.All new session records go through a single
birthSessionpath (session-birth.ts, replacing the oldensure-session-recordhelper): schema parse, server-owned/readonly rules, create check (with scopedreadCollectionItem), tombstone reclamation, and create-if-absent.ensureSessionRecordnow takes aSessionCreateRequestbeside the record builder; exports includeSessionCreateRefusedError,ReadonlySessionStateError, and refusal helpers used by routes, CLI, and execution.Runtime behavior: session state mutations get a guard that blocks changes to readonly fields;
listSessions/GET …?state.<field>=filter only readonly fields (client sendsstate.<field>; memory/filesystem/SQLite/Postgres filter in-query). Dispatchers can passsession: { key, state }or taskstate; refusal surfaces ascreate-refused.fsdev run --seed-sessionbirths sessions through the same checks and refuses bad seeds on existing sessions.Docs, changesets, and tests cover the create route, action admission, webhooks, CLI seed-session races, listing, and dispatcher child creation.
Reviewed by Cursor Bugbot for commit da53df6. Configure here.