Repository navigation
fix(sessions): publish complete rewrites without reset amplification - #138984
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 7, 2026, 1:47 PM ET / 17:47 UTC. ClawSweeper reviewWhat this changesPublishes conversation-history rewrites atomically and preserves the selected conversation across resets, bounded reads, later messages, and session branching. Merge readiness⛔ Blocked before merge - 2 items remain This remains a distinct, necessary repair: current main and the latest release still publish rewrites incrementally. No actionable introduced defect was found. The recorded scope decision resolves the previous blanket rollback hold; the protected PR remains under owner-controlled landing. Priority: P1 Review scores
Verification
How this fits togetherTranscript maintenance replaces stored messages during compaction and recovery. SessionManager and SQLite preserve the conversation history that subsequent agent turns and memory preparation read. flowchart TD
A[Compaction or recovery] --> B[Prepare replacement conversation]
B --> C[Validate live writer and snapshot]
C --> D[Atomic SQLite commit]
C --> E[Reject stale or revoked work]
D --> F[Publish committed conversation]
F --> G[Agent context and memory readers]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +513, Tests +690, Other -1. Total +1202 across 17 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the atomic writer and selected-reader repairs together, with compatible-build recovery and the accepted rollback limitation documented. Do we have a high-confidence way to reproduce the issue? Yes: current main still mutates the live branch and persists its suffix incrementally, exposing interruption between entries; supplied before/after evidence also demonstrates reset amplification. This read-only review did not execute tests. Is this the best way to solve the issue? Yes: preparing a detached replacement and committing it through the existing SQLite and custody owners repairs the publication boundary, while matching reader changes preserve its interpretation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c79ad267ba62. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (16 earlier review cycles; latest 8 shown)
|
3a129fe to
33cda55
Compare
|
@clawsweeper re-review The five findings on Authority-chain evidence, from production admission + SessionManager + SQLite fixtures ( Closed/replaced cases assert rejection before transcript rows or the live branch change; active admission publishes. Before/after regressions also cover receipt-backed retries, second rewrites, commit-observer reentrancy, dirty bounded projections, side ancestry, and stale snapshots. All 301 focused/sibling tests passed. A separate child running real production SessionManager/SQLite was SIGKILLed during a reset-containing suffix replay: reopening retained all six original rows and the latest conversation, then a successful retry preserved those rows. The bounded proof rewrites 32 loaded events against 2,048 archived events (17,131,376 stored bytes) and retains only 64 loaded entries. These are real local process/storage proofs, not an authenticated-provider or UI recording. The updated PR body records scope/LOC justification and proof limits. Independent local P0–P2 review is clean. Please review this new revision; do not merge or enable auto-merge. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review current head Reconciled #139002 without a parallel custody path: use its transaction-local relocation staging and remove the obsolete rewrite callback collector. The current diff stays in 12 production session/transcript files plus three tests (production net +472, tests net +536). After reconciliation: 321 focused/sibling tests, core and core-test typechecks, lint/format, fresh independent P0–P2 review, real-process SIGKILL/reopen/retry and bounded-history proofs all passed. The active/closed/replaced admission evidence in my prior comment still passes. Full local checks/build refresh is blocked by the newly inherited pnpm 12.3.4 minimum-release-age policy; no safeguard was weakened. Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/33968647101 Please review only. The operator explicitly requested no merge and no auto-merge. Follow-up noted outside this repair: a body-only PR edit can cancel the synchronize Labeler run and replace it with a skipped run ( |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
1eff1c8 to
2ff8e87
Compare
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: d85e8c08-bb42-4d76-8731-9b7f9d42c0c0
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 160a4dea-5bbf-465d-8b49-974e1db38451
Keep interrupted rewrites from activating partial history. Publish input custody and the manager view before commit observers, retain original writer authority, and fence stale cached data with transaction-produced transcript versions. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
Reuse selected-path adoption for the new detached bounded reader used by memory flushing. Reconstructing selected side entries without their omitted leaf controls otherwise drops the rewritten suffix or revives a pre-reset prefix. Preserve the existing owned-payload optimization and detached writes. Extend the existing reset/no-reset rewrite cases through detached reads and appends, later persisted turns, and session branching. Both cases fail before the owner repair; 261 focused tests and a scoped P1 autoreview pass afterward. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
2ff8e87 to
c573697
Compare
|
Follow-up attribution and repair: #141718 is now merged (merge commit). It fixes two session-handoff bugs: preflight accounting after lane release, and yield cleanup handing off before its deferred projection rebuild settles. Neither was introduced by #138984. All four new regression cases also fail with the same errors on |
…penclaw#138984) * fix(sessions): publish transcript rewrites atomically Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> * fix: interrupted transcript rewrites preserve active history Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: d85e8c08-bb42-4d76-8731-9b7f9d42c0c0 * fix(sessions): fence transcript rewrite snapshots Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> * Publish openclaw/openclaw-openclaw-vacinc-issue-138965 Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 160a4dea-5bbf-465d-8b49-974e1db38451 * fix(sessions): bind atomic rewrites to committed owner snapshots Keep interrupted rewrites from activating partial history. Publish input custody and the manager view before commit observers, retain original writer authority, and fence stale cached data with transaction-produced transcript versions. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> * fix(sessions): prevent reset-crossing rewrite amplification Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> * fix(sessions): preserve selected ancestry through later turns Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> * fix(sessions): preserve rewritten context in detached snapshots Reuse selected-path adoption for the new detached bounded reader used by memory flushing. Reconstructing selected side entries without their omitted leaf controls otherwise drops the rewritten suffix or revives a pre-reset prefix. Preserve the existing owned-payload optimization and detached writes. Extend the existing reset/no-reset rewrite cases through detached reads and appends, later persisted turns, and session branching. Both cases fail before the owner repair; 261 focused tests and a scoped P1 autoreview pass afterward. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: VACInc <[email protected]>
Summary
High Level TLDR
Transcript maintenance could lose the current task when interrupted, or repeatedly duplicate active history even when it succeeded. Publish the complete replacement branch atomically, preserve its explicit ancestry across resets, and make bounded/model-context readers retain that selected branch through later messages and session branching. An unchanged replacement now does no rewrite work.
Closes #138965. Closes #139201. Related to #119720; this does not close the Gateway starvation umbrella.
Current scope decision — September 6, 2026, 20:43 UTC
At the owner's direction, drop the custom old-stable-release rollback test and its associated blanket landing hold as requirements for this PR. This supersedes earlier hold wording in this body. The instruction is to finish CI and ClawSweeper review, not to merge or enable auto-merge.
The optional review rank-up request for an additional custom rollback build is declined under this scope decision. Known limitations remain explicit rather than being hidden or relabeled as passing tests. Please assess current code/evidence and this recorded decision, rather than the superseded blanket hold.
September 7 post-interruption conflict refresh
Current head:
c57369780ff3cffbd7fed54cd9bfd6c435175ac2, rebased onto7600a4f571b10aaba679dba0f61100ea8c75fc5e. The preceding2ff8e87fc967b5fc3b494b1a2ffdea4f9d0e9369completed CI and review, but the resumed final-state check found a real new merge conflict after main changed identity publication in #138451. This refresh resolves that conflict; it is not a rebase merely to chase main movement.The sole overlapping PR file was
session-accessor.sqlite-transcript-write.ts. Branch replacement now returns both main's prepared identity-publication callback and the PR's transaction-produced transcript version. RetainedassertActivechecks run before mutation and before commit; manager adoption still precedes the publication callback infinally. Main's manual-compaction publication change is retained too. No new schema, storage format, configuration, or rollback policy is introduced. The earlier detached-reader repair and regression file remain byte-identical.All eight commits retain their original authors and author dates (compared in order), exact
VACIncco-author trailers, and orderedWorked on byblocks. No new fix commit or replacement PR was created.Refresh validation
113 focused tests passed on this rebased candidate: branching/observer ordering and failed-write preservation, rewritten reset/no-reset readers, detached memory-flush snapshots, retained admission, and SQLite transaction ordering. The earlier 261-test run remains evidence for its original head below; it is not relabeled as a new 261-test run.
Writer type-aware lint, formatting for all changed TypeScript files, whitespace, and native schema guards passed. Fresh independent full-branch P1 autoreview against
7600a4f571b10aaba679dba0f61100ea8c75fc5e, with the new publication-owner contract supplied, was scoped-clean: no P0/P1 finding. Local typecheck/full-build dependency restrictions are unchanged; hosted exact-head build and typecheck gates have now passed. Full PR versus this base: production +672/-159 (net +513), tests +701/-11 (net +690), other -1.Terminal refresh verification: CI run 34147175344 passed on exact head
c57369780ff3cffbd7fed54cd9bfd6c435175ac2. The September 7, 17:39 UTC observation recorded 137 successful checks, 42 skipped, 1 neutral, zero failed or pending checks. Hosted build and production/test typecheck gates passed.The fresh ClawSweeper review, reviewed September 7 at 17:27 UTC (worker 34147349101), covers this exact head and reports no actionable findings, proof 5/6, quality 4/6. Its remaining risk banner records the already accepted incompatible older-reader recovery limitation, not an outstanding code repair or a reinstated custom rollback hold. No manual duplicate review was requested.
The owner decision above remains authoritative: no custom old-stable drill or blanket rollback hold is reinstated. Keep the writer and repaired readers together; incompatible older-reader rollback stays unsupported. No merge or auto-merge authorized.
Earlier September 7 rebase and integration verification
Earlier verified head:
2ff8e87fc967b5fc3b494b1a2ffdea4f9d0e9369. Rebased the seven existing commits ontod234f9d4d09273615508d34bb1b098e803630165, preserving their original authors and exact contribution trailers, then added one credited integration-fix commit. All eight published commits retain the requiredVACIncco-author and orderedWorked on byblock. The same PR branch is retained. A later main snapshotba2a9af314262b2d2598db5dbbe82bc04ea911f2merged cleanly in a non-publishing merge-tree check; no repeated rebase was done solely to chase unrelated main movement.Rebase conflicts and newly exposed reader regression
Two import conflicts in
session-manager.tsandsession-manager-branching.tswere resolved by retaining both main's current-header validation / inherited branch-header version and this PR's transcript version receipts. Main still performs incremental suffix replay, so the atomic repair is not superseded.Main also added
SessionManager.openDetachedBoundedfor memory flushing. After the PR's side-entry rewrites, it fed the selected payload into the generic constructor without the omitted leaf controls. The extended existing regression failed in both reset/no-reset rows: without reset, the detached view retained onlyprefixand omitted the replacement/suffix; with reset, it exposedprefixinstead ofcurrent task.The fix routes detached bounded snapshots through the same selected-path constructor used by synchronous/asynchronous model-context readers, renamed
fromSelectedEntries. It retains the owned-payload optimization and leaves publicfromEntriescloning semantics unchanged. No new storage query, schema, migration, configuration, or compatibility fallback is added. The two existing cases now also verify detached append isolation, later durable appends, and session branching; no duplicate test cases were added.Fresh proof
Node v26.7.0. 261 focused tests passed: 69 across rewrite, bounded/context-snapshot/branching and actual memory-flush preparation; 192 across shared rewrite callers, initial admission lifecycle, pending-input custody and SQLite transaction ordering. The two new failing assertions were reproduced before the owner repair.
Changed-file type-aware lint/format, whitespace, conflict-marker, size, assertion-safety, native-state-schema and database-first guards passed. Fresh independent
$autoreview --mode local --max-priority P1was scoped-clean, reviewing the new repair with full owner/caller context supplied. Local typecheck/full-build gates were not rerun in the shared-dependency checkout; hosted exact-head CI supplies those gates, without bypassing checkout-local dependency boundaries.New repair: production +5/-5 (net 0), tests +14/-0. Full PR against the rebase base: production +667/-153 (net +514); tests +701/-11 (net +690); other -1. The production increase remains the existing atomic publication/retained authority/selected-reader repair, not a new framework.
Terminal exact-head verification: CI run 34141522987 passed on
2ff8e87fc967b5fc3b494b1a2ffdea4f9d0e9369, including hosted build, production/test typechecks, Linux test shards, and both Windows test shards. The final observed rollup had 1 neutral, 42 skipped, 137 success, with zero failed or pending checks.The fresh ClawSweeper review, completed September 7 at 16:12 UTC (worker 34141736325), reviewed this exact head and reports no actionable findings, proof 5/6, quality 4/6. It confirms the detached-reader integration repair and accepts the recorded rollback scope decision. Its remaining pre-merge notes are the documented unsupported older-reader recovery path and the absence of merge authorization—not an outstanding code repair or reinstated custom rollback drill. No manual duplicate review request was posted.
Historical evidence below retains its original SHA and is not relabeled as this head's test result.
The September 6, 20:43 UTC owner decision above remains authoritative: no custom old-stable drill or blanket rollback hold is reopened. Keep writer and repaired readers together; known incompatible code-only downgrades remain unsupported. No merge or auto-merge requested.
Historical stable-release rollback preflight — not a PR gate
On September 6, 2026, the requested real-release drill was stopped at its schema compatibility gate.
v2026.9.2plus only transcript reader/branch fixes is not a supported rollback target for this candidate's complete state directory. This is separate from the earlier transcript-only compatibility proof below.Pinned revisions:
v2026.9.2: annotated tag87d32a44ab9744903d36a33b399c26cfc2b078d6, peeled commit3928bad9badfcb6c7d140530435e806fb8092190; shared schema 15, agent schema 19.1eff1c8e8c50685cc9f2769ef8738f762b393bf2; shared schema 16, agent schema 19.openOpenClawStateDatabaseimplementation. The candidate used its existing installed development dependencies. No copied storage methods, mocked version labels, packaged Gateway deployment, or operator databases were used.user_version=15, metadata schema 15user_version=16, metadata schema 16SqliteSchemaVersionError:uses newer schema version 16; this build supports 15The stable refusal left the closed SQLite file byte-for-byte unchanged: SHA-256 before/after
8769c6535f60f54a5b646d4f8f4b1a296583a0511b26d180ae227d2764b4ca06. The version change is real shared-state migration already on the candidate base (Skill Workshop directory ownership), not a change introduced by this transcript PR.src/state/openclaw-state-db-schema-version.tsrejects the newer version before exposure; the release's startup preflight enforces the same schema boundary.Scope and decision: no positive stable downgrade / keep-chatting / re-upgrade outcome is claimed. Reset/no-reset transcript fixtures, four-reader comparisons, and a reader-only stable backport were not executed because the prerequisite complete-state downgrade is incompatible. A reader-only backport cannot change shared-state schema support. No schema number was lowered, guard bypassed, database modified for downgrade, dependency patched, release published, or production source changed. Reopening the candidate is the demonstrated safe recovery from this refusal. Restoring a pre-upgrade backup would not establish preservation of post-upgrade conversation history.
This drill is retained as historical evidence of the inherited schema boundary. The owner has withdrawn a custom stable-release downgrade drill and its associated blanket hold as prerequisites for this PR; see the current scope decision above. No compatible rollback build is being manufactured or claimed.
Reproduce the actual-release schema gate
Create clean source checkouts pinned to the two full commits above. Install the stable checkout with
pnpm install --frozen-lockfile; give each checkout its own compatible dependencies. Save this temporary probe outside both source trees, choose an absolute path to a new empty synthetic state directory, and run the four commands below. This is storage-owner execution, not a packaged full-Gateway or model-provider round trip.Expected observations are the table above. The probe prints a typed refusal rather than presenting a successful round trip; inspect its JSON outcomes, not only shell exit codes. Both tracked source trees remained clean.
September 6, 2026 rebase verification
Rebased the existing branch onto
856c5f518723d1c974024cf3e2811d50fbe655fb; reviewed rebase head:6a882af1269b7fcf2b845d1cf8a004c0a4518b7e. Current attribution-normalized head:1eff1c8e8c50685cc9f2769ef8738f762b393bf2. All seven commits now contain the exactVACIncco-author trailer and ordered multiline contribution block. Original authors, author dates, publication trailers, and every commit tree are preserved. The final tree is identical to the reviewed rebase head (2e83b13a657498e54652748bdf8d01a821163d3b). The prior merge resolutions were reconciled while retaining main's completed-turn anchors, transaction-local input custody, and compaction accounting. The atomic publisher and selected-reader/branch implementation remain byte-identical to the previously reviewed head.Local proof: 236 distinct focused tests passed (rewrite 30; pending inputs 38; attempt lifecycle 21; bounded/context-snapshot readers 15; SQLite transaction 23; shared rewrite callers 109). The rewrite suite was rerun after the first main refresh; the final refresh changed only
docs/docs.json. Changed-file format and type-aware lint, whitespace/conflict, size/assertion, native-schema, and database-first storage guards passed.Commands used the repository
node scripts/run-vitest.mjsrunner for the named suites and direct repository guard/lint wrappers. Local production typecheck stopped before checking code becauserun-tsgo.mjsrejects an external dependency symlink; a freshpnpm installis blocked by this host's minimum-release-age policy for pnpm 12.3.4. Core-test typecheck and a fresh local full build were not run. Hosted exact-head CI passed those lanes, including build-artifacts, check-prod-types, check-test-types and both core test-type shards; no local typecheck pass is claimed.Terminal verification on final head
1eff1c8e8c50685cc9f2769ef8738f762b393bf2: CI run 34052609433 passed. Final observed rollup: 137 success, 42 skipped, 1 neutral, zero failures or pending checks. Hosted build, production types, test types, and relevant test shards passed.The fresh ClawSweeper review also covers this exact final head, reviewed September 6 at 18:50 UTC (run 34052721734): no actionable findings, proof 5/6, quality/readiness 4/6. The automatic push event requested this review; no manual repeat review was posted. Its three remaining before-merge items all concern the explicit owner landing/rollback decision, not a current patch defect.
The preceding rebase head
6a882af1269b7fcf2b845d1cf8a004c0a4518b7ealso passed CI run 34051686376 and received the no-actionable-findings review at 18:33 UTC. The attribution rewrite preserved every commit tree, original author and author date; the earlier compatibility matrices retain their original candidate revisions.Historical hold superseded by the current scope decision above. No merge or auto-merge is requested. The selected-reader/branch fixes must remain present wherever candidate-written histories are consumed; unpatched older-reader compatibility is not claimed.
Previous-head verification and rollback decision
Head
a9b90278f1dd1e3e1687f17409d9fb633fabe93d: CI gate passed, with no failed or pending checks when verified. The ClawSweeper review of this head confirms the previous reader finding is addressed and reports no actionable findings (quality/readiness 4/6, proof 5/6). The complete compatibility table resolved its prior excerpt-coverage concern; the historical request for a custom rollback build is superseded by the current scope decision above.Complete final-format compatibility outcomes
Real production SessionManager/SQLite, two populated synthetic stores, with and without a reset. Candidate = the head above; older =
5eff5797bd53d3073ac241d36dbef4920c3f176f.prefix, replacement, suffix, next turn.current task, next turn.rollback turn.prefix, next turnprefix, next turnprefix, next turnprefix, next turnnext turnnext turnRead-only phases preserved every stored history record. The older-code append preserved every pre-existing history record and added the requested turn. The earlier head received only the three-file reader/branch backport reproduced below; its rewrite publisher stayed unchanged. Source records were not migrated, deduplicated, deleted or rewritten.
Decision boundary: this proves old→new and new→backported-old→new interoperability for the named revisions. It explicitly disproves safe rollback to the unpatched older readers. Retain/backport the reader repair when rolling back the writer. Older stable-release executables were not run; no blanket downgrade-compatibility claim is made. This is a required rollout/rollback condition, not an unresolved current-head code finding.
The requested scope remains code repair and proof. No merge or auto-merge is requested. Historical blanket rollback-test hold wording is superseded by the current scope decision above.
Root Cause
Two failures share the transcript rewrite owner:
5eff5797bd53d3073ac241d36dbef4920c3f176f: ordinary suffix appends cross an existing reset. The canonical navigation owners normalize those parents onto the old active leaf, retaining the old suffix and appending its replacement. A five-entry active branch became nine after one successful rewrite; the no-reset control passed. This is [Bug]: Reset normalization turns a successful transcript rewrite into active-suffix duplication #139201, not another interrupted write.SessionManager.prepareTranscriptRewritenow publishes copied entries using the existingappendMode: "side"contract followed by one explicit leaf selection, all in the same transaction. This preserves the intended parent links without weakening reset protection for ordinary appends. Selected bounded/model-context readers must take their leaf from the already-selected projection/path: leaf controls are omitted from those payloads, so rescanning side entries alone previously selected obsolete context.The follow-up to the review at
7353a58aa69fixes the rest of selected-path reconstruction. Ina,b,c, rewritingband then appendingdyieldeda,din selected readers because the omitted leaf control left a stale logical parent. After a reset, this could replace the current task with an old prefix. Both cases failed in the extended existing regression. One session-manager hydration helper now installs the already-resolved ancestry and active append cursor, resolving omitted parents through the bounded reader's existing links. Reset fences and raw stored entries stay intact.The same test then exposed context loss when forking this history into a new session: copied entries retained inactive-side flags although their navigation controls were omitted. The branch-copy owner now removes those flags from the copied, selected path. The source session's rows remain unchanged.
The generic rewrite helper compares normalized replacement bytes before preparing the rewrite. An identical replacement returns unchanged without cloning or appending another suffix.
Owner boundaries and retained behavior
session-manager.tsprepares only the loaded view;session-accessor.sqlite-branch-rewrite.tsvalidates source/version/authority and commits through existing message/event appenders.transcript-tree.tsandsession-entry-navigation.tsalready define side entries and explicit leaf controls. No new event type or schema is introduced.e09a265b111still lacks this complete atomic rewrite repair. Existing reset protection is intentional; removing it would revive the historical failure tracked by #132586/#132606.Removed from the earlier candidate: partial staging, per-entry leaf restoration, separate input-key transfer, and full-archive hydration/comparison during preparation. This update also removes unchanged-message replay. No configuration, dependency, schema, migration, protocol, or release changes.
Coverage of the reported system gaps
Reviewed the current #119720 and #138984 bodies, their description revisions, VACInc's updates, and linked reports. Similar visible hangs have different owners:
Planner-statistics fixes #133925/#134062 are already merged; #119739/#119884 are historical context, not reasons to redo that work. Historical path-resolution, skills-snapshot bloat, heartbeat-labeling and permanent-delivery retry reports (#120074, #126663, #126841, #126844) are distinct. Memory reindex/plugin-state work (#137525), configurable SQLite knobs (#138326), and broader stream-resume policy (#126845) are not implemented by this PR. The #126848 settled-turn recovery closure is not proof that every transport-recovery case is fixed. Concurrent full-replacement races (#124393/#124899) remain distinct from this version-fenced append publication.
Verification
Real behavior proof
Real production SessionManager and SQLite, isolated synthetic stores, Node v25.9.0:
Result: 30 passed. The earlier amplification update added three cases. This reader follow-up adds zero new cases: it extends the two existing reset/no-reset rows through an ordinary append, all four reader views, and session branching, with source-row preservation.
ERR_PNPM_NO_MATURE_MATCHING_VERSION: pnpm 12.3.4 is younger than this host's minimum-release-age policy. Direct checks above ran without changing that policy.Earlier amplification benchmark at
7353a58aa69: 32 synthetic 2 KiB messages, a reset and current-task message; six successive rewrites of the second active entry. One warmup, three measured samples, same host/dependencies. Each sample reconciles projections and verifies the current task after reopening.This demonstrates removal of repeated active-history amplification, not a bound on Gateway latency under contention. Append-only historical rows still accumulate linearly with real changed suffixes.
Reproduce the benchmark
In each isolated checkout, temporarily save this as
src/agents/embedded-agent-runner/transcript-rewrite.performance.test.ts, then runnode scripts/run-vitest.mjs src/agents/embedded-agent-runner/transcript-rewrite.performance.test.ts --reporter=dot. Remove the temporary file afterward. Baseline:5eff5797bd53d3073ac241d36dbef4920c3f176f; candidate:7353a58aa69cf7cb1a642cf8cd4461067d9a2e76.Final reader proof and compatibility
Reader-fix head:
a9b90278f1dd1e3e1687f17409d9fb633fabe93d.Same-environment before/after reader benchmark (Node v25.9.0, one warmup plus three measured samples): six rewrites of the same 32-message/reset/current-task fixture, then an ordinary next message, projection reconciliation, and full/bounded/sync/async context reads.
7353a58aa69These are observed samples, not a zero-cost or Gateway-latency guarantee. The reader repair adds no storage queries or historical payload acquisition.
Populated-store compatibility was rerun with the final side-entry format and an ordinary next message, with and without resets:
5eff5797bd53d3073ac241d36dbef4920c3f176f.5eff5797bd53d3073ac241d36dbef4920c3f176f. The full reader is correct, but selected readers omit rewritten messages or select the old prefix. Reads leave stored rows unchanged.Rollback requirement: retain/backport the selected-reader fixes when rolling back the writer. A bare older binary is not safe for this history representation; the unchanged SQLite schema does not remove its reader bug. The tested backport provides a concrete path without migrating or rewriting user data. No older stable-release executable was tested; the inspected v2026.9.1 readers lack these fixes too. Support for any additional rollback release needs that version's backport and validation. No data deletion, schema bump, or automatic repair migration is introduced.
Tested reader-only backport onto 5eff579
The rewrite publisher on the older head stays unchanged. Apply with
git applyin an isolated checkout at that head; this is a source backport, not a live-store edit.The P1 reader finding from the ClawSweeper review at
7353a58aa69is addressed by the failing/passing sequence above, including its requested reset/no-reset reader matrix and refreshed populated-store compatibility proof. Personal source/readiness review completed; no independent agent was spawned under the current no-delegation instruction. The exact-head CI gate passed, and the refreshed ClawSweeper review reports no actionable findings. Its historical excerpt-coverage concern is addressed by the complete compatibility table above; the earlier blanket rollback-test hold is superseded by the current scope decision. No merge or auto-merge is requested.What was not tested
No production Gateway restart, deployment, authenticated provider/Telegram round trip, contended multi-session Gateway soak, or recovery of already-damaged live histories. Real SQLite fault/reopen/retry was exercised here; the previous head's separate-process SIGKILL evidence was not rerun on this update. No fresh local full package build was run. Hosted CI, including its build and test jobs, passed on the reader-fix head linked above.
Size
This reader follow-up: production +24/-10 (net +14) across three files; tests +35/-2 (net +33), with no new test cases; assertion-safety baseline -1 after removing an unnecessary cast. The added owner method installs selected ancestry and clears inactive append mode; branch copying replaces its old conditional copy with a canonical selected-path copy. Full PR versus merge base
ac4c669dc5aea980e30bc8ded6a2a3580379cd3c: production +663/-149 (net +514) across 13 files; tests +687/-11 (net +676) across three files. Growth implements the missing atomic owner boundary, retained authority/version receipts, bounded ancestry and correct selected-leaf handling; no alternative storage framework or generic retry layer was added.Worked on by: