Each appended batch queues for the next group commit; the yield before a
group lets batches other writers append in the same turn share one
transaction, so a checkpoint costs one commit and one fsync per group
instead of per writer, and the synchronous transaction is bounded by an
event cap. A batch failing on its own terms rolls back to its savepoint
and rejects alone; an error that ends the transaction rejects the group.
A writer that checkpoints step after step runs its whole append path on
settled promises and a synchronous transaction, so the process never
returns to the I/O phase: timers, other writers waiting on a lease, and
the UI starve until the writer stops. Yielding once per commit bounds
that stall to one commit.
The SQLite plugin validates its own Config: the JSONL fields plus
frameEvents, the maximum events per new frame, defaulting to 64. Imported
histories reach the cap; larger frames compress a few percent better and cost
proportionally more to decode for a tail read.
The plugin's compression setting now also selects the physical encoding of
new frames: zstd compresses a frame when that shrinks it, none stores the
text. Stored frames decode by their own codec. A read decodes eight frames
at a time on the thread pool and yields between groups.
Each durable write stores one frame of JSON lines, Zstandard-compressed when
that is smaller than the UTF-8 text, in a rowid table keyed by Segment and
start sequence; the Segment event count is the last frame's end. Reads select
the frames overlapping the requested range and decode their slices, yielding
between frames. The schema version advances to 2; a version 1 database is
refused as before.
* test(session): cover SQLite persistence and document the provider
* test(session): align coverage with the latest SQLite implementation
* test(session): adapt storage coverage to the current SQLite backend
* feat(session)!: pass fork source through agent creation
* refactor: prepare forks privately and append child segment events
* refactor: choose fork sharing in SQLite creation transaction
* fix(session): preserve caller-prepared fork seeds
* feat(session): flush fixed fork prefix before child creation
* fix(session): persist fork sources and await parent drain
* chore: remove test and documentation changes from fork PR
* refactor(agent-loop): reuse agent fork source type
* fix(session): retain SQLite handle and JSONL errors after rebase
* perf(session): create forks from the caller's history without reloading the parent
The fork source carries the complete child history from seq 0. A live
parent's log supplies the shared prefix; a cold parent's prefix is used as
persistence returned it to the caller. The factory no longer reopens the
parent, and the JSONL backend copies the supplied history instead of
decoding the parent log again. The SQLite backend drains a live parent
writer before sharing its persisted prefix, so the factory no longer flushes
the parent or tracks owner disposal during that wait; its fork creation
serializes child events without the read-side validation and reports
publication failures through the shared wrapper.
* refactor(session-query): report the persisted prefix length on live observations
A live observation reports its event count as the persisted prefix, so the
fork command's boundary fallback only covers observations from other
producers.
* test(session): exclude the SQLite POSIX lease from Windows coverage
The SQLite copy of the session write lease executes its POSIX face only off
Windows, matching the JSONL exclusion.
* test(session): report legacy opener failures on stderr
The two-process suite asserts only the error name; the message and cause now
reach the inherited stderr so a CI failure identifies the SQLite error.
* refactor(agent): keep seed as the constructor input and narrow the fork source
CreateAgentOptions.seed stays the only constructor history; source names the
parent and cut a seeded fork shares. The factory stores the constructed log
with that source at creation, so no fork-only seed selection remains in the
loop.
* test(session): complete fork regressions and documentation
* test(session): propagate current SQLite fixtures through fork regressions
* test(session): describe fork creation from the caller's history
The fork source now carries the complete child history and the factory no
longer reopens or flushes the parent, so the fake factories, source
expectations, and cancellation cases follow that flow: a sharing backend
drains the parent writer itself, JSONL copies the supplied history, and
observations always report the persisted prefix. Documentation, the upgrade
guide, and the generated catalogs describe the same behavior.
* test(session): cover fork creation without a factory flush
The in-process fork provider's cases no longer wait for a parent flush: the
live log supplies the completed prefix and cancellation is exercised while
child storage is pending. The Remote fork command's boundary fallback is
covered by an observation that omits its persisted count.
* test(session): drop redundant observation assertions in the fork fallback case
* test(session): describe fork creation with seed beside a parent source
The agent factory keeps seed as the constructor history and source names
only the parent and cut, so the fakes, source expectations, and documentation
follow that split; the case where a live parent replaced the supplied prefix
no longer applies.
* refactor(session): name the fork parent option parentSource
`CreateAgentOptions.source` and `SessionPersistenceCreateOptions.source`
become `parentSource`: the field names the parent Session a seeded fork
shares its prefix with, and the shorter name read as a generic origin.
* refactor(session-query): report persistedEventCount on cold observations only
A live observation holds the Session's own events, none of them read-time
repairs, so its stored prefix is its whole log and the field said nothing;
only a cold read appends interrupted-turn closers in memory and needs to
tell the fork cut where the stored prefix ends.
One ENOENT helper, one routing-database check owned by the store, one
routing-record reader that validates identity, and one publication failure
wrapper replace the copies spread across the store and the service.
Fork creation lands with its own creation flow; the pending-create fork
record, handle cut offsets, and seed marker checks that flow would replace
are removed. The Segment schema stays, and cut() locates a fork attachment
through the segment_ancestors index instead of walking the parent chain.
The new schema starts at version 1, and the busy timeout and live batching
limits are named constants.
Write paths serialize already-typed in-process events without re-running the
read-side envelope validation. Listing checks routing records by their hashed
file names instead of reading each one and scans SQLite concurrently with the
JSONL listing. Reads decode long histories in yielding chunks. Create checks
only the retained JSONL identity before SQLite's own existence check, and a
queued legacy open no longer repeats the routing check its caller just made.
- document the exported SqliteStore prefix/suffix loaders (verify-export-jsdoc)
- share createStoredEventRead from session-persistence so the standalone
SQLite store stops duplicating the service helper (duplication gate)
- route replaceStored header upserts through writeRow (duplication gate)
- move replacement/conflict test SQL into closed test resources so the
SQLite SQL resource boundary test passes
SessionPersistence.readRaw previously used undefined for two unrelated states: a supported backend could not find the requested session, or the backend had no per-session artifact concept at all. The export endpoint consequently reported an existing SQLite-backed session as HTTP 404, which falsely diagnosed storage capability as session absence.
Make raw-artifact support an explicit backend capability. Unsupported backends now fail their inherited readRaw path loudly and the host answers 501 before reading, while undefined retains the single meaning of an absent artifact on a supporting backend. First-party backends, test providers, generated API catalogs, bilingual persistence docs, and export error contracts now state that distinction; focused tests cover both the 501 and the inherited rejection.
Old runtimes meeting a newer session format now fail loud instead of
misreading: version refusal names the direction (newer: upgrade the
harness; older: no upgrade path) and points at the raw JSONL log, and an
event type outside the generated known vocabulary refuses resume unless
its envelope carries the new ignorable: true marker (default: required,
so a forgotten marker over-refuses instead of silently resuming a gutted
session). gen-persistence-catalog now also emits
KNOWN_SESSION_EVENT_TYPES; SQLite stores the marker in a dedicated
column (SCHEMA_VERSION 15). The versioning design (monotonic integer,
n->n+1 upgrader chain, migrate-on-continue) is recorded in the
session-log-version-mechanism Agent Note.
Machine-produced by `pnpm run rescope-vendor --apply` plus the regeneration it
prints: `pnpm install` for the lockfile, `pnpm run gen-third-party-notices`,
`verify-translation-pairing --write` for the touched bilingual pairs,
`gen-doc-graphs`, and one typert snapshot whose ids embed character offsets.
`pnpm run rescope-vendor --check` verifies the result.
Renames nine vendored packages (cordis, cosmokit, schemastery and the six
@cordisjs plugins) and every reference that resolves them: manifest names and
dependency keys, module specifiers including declare-module merges, cordis.yml
plugin names, tsconfig paths, every Markdown fence, and `docs/` prose.
Directory names, upstream versions, and dependency ranges are unchanged, so
vendor/README.md still reads as an upstream snapshot; its manifest table gains
an upstream-name column so THIRD_PARTY_NOTICES keeps MIT attribution pointed
at each fork's origin.
The tutorial tier follows the rename end to end: its yaml fences named plugins
the Loader can no longer resolve, its `ts ignore-check` fences disagreed with
the compiled fences beside them, and its prose quoted both. The contracts that
told readers to keep upstream names — the root convention and the vendoring
cookbook's tree comment and manifest invariant — now say to rescope instead.
Two rules read `@deepseek-ai/` as "another workspace plugin": the client bundle
purity gate now names the vendored libraries a browser bundle inlines, and the
files where a bare `cordis` is an agent-preset id keep that product data.
git mv the 12 packages from session-persistence/, session-projection/,
session-title/, and telemetry/ into one session/ group per the
regrouping RFC; merge the four group READMEs into one bilingual
triplet; rewrite the group segment in tsconfig references (intra-group
references shorten to ../<pkg>), tsconfig.base.json paths/globs,
knip.json keys, vitest include, gate scripts, and authored doc/note
citations; regenerate module graph, doc graphs, catalogs, and the
lockfile importer keys. No npm names change.
Full unit suite: 8779 passed; the 18 reported failures reproduce as
env flakes (ambient-proxy IPv6 tunneling, watched-dir inotify
timeouts under parallel load) — each passes in isolation with
NO_PROXY set, matching their known pre-existing behavior on master.