feat(state): kernel budgets and lifetime visibility (#233 items 3-4) - #268
Merged
Conversation
… the state kernel (#233) defineState resolves configurable runtime budgets (maxEventBytes, maxStateBytes, maxRevisions, maxCommitMs) with sane defaults; both the memory and node:sqlite drivers enforce identical typed budget-exceeded semantics inside their atomic commit boundaries. Reads, change cursors, exact-revision replay, and committed idempotent results stay available after lowering a budget, and kernel migration commits enforce state bytes only so a full journal cannot brick open. The shared conformance suite pins the behavior across drivers.
…ore inventory (#233) agent-bundle inspect gains a --state focus reporting the declared definition id, lifetime, driver kind, provenance, and statically extracted budgets (defaults/declared/dynamic, never fabricated), plus a state line in the default human output. agent-bundle doctor inventories workspace-durable SQLite stores per installed bundle by filesystem metadata only (AB7316 warning on unreadable metadata; databases are never opened). Documents the previously undocumented AB4821.
🦋 Changeset detectedLatest commit: 1791401 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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. |
This was referenced Sep 2, 2026
Generated plugin contract matrix: catch source→artifact→dev→installed-host drift before release
#218
Closed
This was referenced Sep 3, 2026
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.
Summary
Closes the remaining scope of #233 (items 3–4 of the #98 remainder; items 1–2 landed in #251).
Item 3 — kernel-contract budgets (
packages/rsc-runtime)defineStateaccepts optionalbudgetsruntime policy, resolved over fail-closed defaults:maxEventBytes256 KiB (canonical-JSON bytes per validated payload),maxStateBytes1 MiB (per committed state),maxRevisions100 000 (caller-initiated journal revisions),maxCommitMs5 000 (validation start → pre-append wall clock). Invalid budgets and an over-cap initial state failinvalid-definition.node:sqlite) enforce identical typedbudget-exceededsemantics inside their atomic commit boundaries: payload bytes at validation; state bytes, revision cap, and elapsed time immediately before append (SQLite rolls back). Cancellation budgets already existed (AbortSignal →aborted); this completes Provide an optional durable Agent state kernel #98's "cancellation, size, time, and retention budgets".AGENT_STATE_DEFAULT_BUDGETS,AgentStateBudgets(Input),expectCommitWithinBudgets,expectMigrationWithinStateBudget.Item 4 — lifetime visibility (
packages/agent-bundle, read-only surfaces only)agent-bundle inspect --state: declared definition id, lifetime, driver kind (memory/sqlite, mirroring entry codegen), provenance/source, the notice-ledger co-mount note, a described (never fabricated) durable location, and budgets asdefaults/declared(resolved numbers) ordynamic(statically unreadable — extraction stays parse-only, no new build error). Default human output gains a one-line state summary.agent-bundle doctor: read-only durable-state inventory per installed Cursor bundle and per--frombundle —state/*.sqlitestores by filesystem metadata only (sizes include-wal/-shmsidecars, mtime); databases are never opened, so Doctor cannot disturb SQLite locks. NewAB7316warning for unreadable metadata; also documents the previously missingAB4821.Test plan
pnpm build,pnpm lint,pnpm typecheckon the rebased treepnpm test:unit(all rsc-runtime tests incl. conformance on both drivers + extract/doctor/inspect/cli) — 270 passed, 1 expected durable-only skippnpm test:route-unit,pnpm test:projection@agent-bundle/runtimeminor,agent-bundleminor