Skip to content

perf(sessions): read transcript anchors and readiness through the history reader - #164747

Merged
steipete merged 17 commits into
mainfrom
dbasync/transcriptfacts
Oct 4, 2026
Merged

steipete merged 17 commits into
mainfrom
dbasync/transcriptfacts

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Turn completion and chat reply observation still read durable transcript anchors and projection readiness on the Gateway thread.

Why This Change Was Made

Extend the existing transcript/history reader with a typed anchor operation. Capture the physical database before discovery yields, read readiness, active anchors, and optional reply-tail facts in one snapshot, and refuse stale projections without rebuilding them on the host. Consume final delivery facts while the existing writer FIFO and reader custody remain retained, checking native mutation and current run authority after awaits. Incognito stays with its native owner. Duplicate acknowledgments retain the normalized writer authority selected by persistence and recheck it, together with the explicit caller guard, after the asynchronous anchor read.

Bundled Codex finalization now awaits anchor preparation through the documented SDK before releasing its turn lease. Interactive plugin hooks remain nonblocking. The shipped synchronous SDK helper stays compatible and is deprecated until the next Plugin SDK major. Its dated compatibility record lives with the session-persistence records; the SDK type test preserves its void result alongside the additive awaited helpers.

Context/watermark migration remains excluded: #119055 owns SessionManager.openModelContextAsync and transcript hydration/context validation. Integration preserves main’s shared asynchronous context-engine finalization from #158891/#164647 and its user-turn recorder cleanup. This PR changes only the awaited agent-end helper in that finalizer. #162433 remains the standing exempt umbrella draft.

Incidental file overlap with unrelated cleanup/read changes (#158789, #161286, #164603, #164538, #128845, #164810) is limited to minimal hunks. Shared SDK budget edits in #155860, #154043, #104018, #119023, and #119256 concern unrelated features; this patch changes only its approved numeric allowances.

User Impact

No schema, storage bytes, retention, durability, permissions, configuration, or update-contract change. No new worker service or persistent cache. No new OPENCLAW_* names. Production: +539/-102, net +437, 641 changed lines; the budget script separately changes three numeric limits (+3/-3).

Current landing status: main's inherited directive-tag fixture defect is repaired by 6aefbb11f30aabb872e7fc379e4b97af7217903c and incorporated in the current head. The affected 132 tests, import/build-graph checks, core types/lint, and fresh P2 review pass. The current-head released-SDK comparison is complete. Exact-head CI is green, trusted ClawSweeper review is complete, and native preparation is complete. No admin exception has been submitted.

The moved durable read boundary performs zero caller-thread SQL. This does not claim every runtime anchor read is off-thread. Retained contracts/debt:

  • src/agents/sessions/session-manager-append.ts:585: deprecated synchronous SDK append/idempotency path.
  • src/agents/sessions/session-manager-current-turn.ts:83: shipped synchronous SDK includeOmittedCustomMessages opt-in.
  • src/agents/harness/agent-end-side-effects.ts:74: deprecated synchronous SDK helper; bundled review-source callers await worker preparation.
  • src/gateway/server-methods/chat-send-commentary-media.ts:195: current-anchor predicate inside the native rewrite transaction.
  • src/sessions/user-turn-transcript-annotation.ts:88: native annotation writer authority, checked inside the rewrite callback and around publication; runtime writer debt.
  • src/gateway/internal-source-reply-persistence.ts:82: synchronous committed-message acceptance before media/publication; the writer also checks its typed active-entry predicate.
  • src/infra/heartbeat-session-publication.ts:94: accepted-result authority across preflight, committed-message acceptance, and media/publication settlement; runtime writer debt.

Final delivery consumption also retains the pre-existing session-entry/source authority reads in src/gateway/server-methods/chat-send-reply-dispatch.ts:236 (loadSessionEntry and transcript target resolution). They remain separate-owner migration debt; the zero-caller-SQL boundary covers the moved anchor/readiness operations. The FIFO observation holds no worker write transaction while this callback runs.

Budget change

The bundled Codex extension consumes openclaw/plugin-sdk/agent-harness-runtime, so its awaited replacement must be a documented SDK export. Budget change: Peter’s async-SDK directive plus acceleration takeover authorize better asynchronous SDK calls with deprecated synchronous compatibility (2026-10-02, reaffirmed 2026-10-03). This patch raises only these approved limits by one:

Budget Before After
Public exports 3645 3646
Public callable exports 2110 2111
Deprecated exports in agent-harness-runtime 11 12

Evidence

Current integrated head: f8177d96f47fde49101993b793cad89692f5a3a0. Prerequisite #164490 merged as c828f7ed1d560295f78166a98fb54687dc162b28. Merge commits integrate main without rebasing, most recently d47ee981f47b0cfddec29b2eaacc9c686c2f2902. The main-relative change is 30 files (+989/-160). This integration applies main's existing fixture repair without conflicts or new production edits. The prior SDK-budget conflict preserves main's #164558 source-reply export and adds exactly one allowance for this PR.

  • Fresh isolated Codex P2 autoreview: scoped-clean, with the final commit tree equal to the reviewed index. Current core production types and focused lint pass. pnpm test src/gateway/server-methods/chat.directive-tags.test.ts --maxWorkers=1: 132 passed, 147.80s wall. The explicit runtime-process build graph and reply/history/reconcile import-closure suites pass 14 tests, 15.03s runner wall. The mock-export baseline was canonically pruned by exactly one; no allowance was added.
  • Earlier repair proof on eb0f1675: 226 tests across six files passed, node scripts/run-vitest.mjs <files> --maxWorkers=1, 1472.22s wall on the shared macOS host: Gateway media/directive (148), lifecycle (16), cold-read (27), SDK facade (23), and compatibility registry (12). Earlier 65c14e55 caller/import proof passed 150 tests / 11 files (1162.13s). Duplicate-authority regressions failed before the repair (292.67s) and the full mirror-identity file passed 14 tests (481.02s) afterward, exercising explicit and inherited writer revocation after a real anchor read without changing transcript bytes.
  • Released SDK reports against v2026.9.8 completed locally for eb0f1675 (1214.58s) and 6510a8eb (914.77s, digest 2cd4ec73d1e2a315e722dda534d2098e168a8de7ce55df925a2262c07769df18). They add runAgentEndSideEffectsAsync while preserving the synchronous void and existing awaited declarations. The current-head report completed locally in 369.257s, digest 7bb7d7e1652fa168c976ede459d411e4d40d550ebdd324fb06b97bbd9cd882fb, with the same agent-end compatibility result. This includes cumulative main-versus-release changes outside the PR; the two existing agent-end declaration texts are unchanged. Existing signatures retain a dated readonly deprecation record and type test; approved SDK budgets change exactly +1/+1/+1. The predecessor's hosted SDK type lane passed in 35.3s (job 111409153402; 185s total job).
  • Predecessor exact-head hosted build/check jobs covered the full changed-file gate, including extension declarations/lint that previously hit local 300000ms preparation timeouts. Current-head hosted coverage is now complete, with preserveFullChecks: true confirmed in the check-plan log. One earlier lint command used the wrong production tsconfig; the corrected canonical core invocation passes. No timeout is counted as passing evidence.
  • ClawSweeper completed the predecessor 6510a8eb at 2026-10-04 09:46:57 UTC, with no actionable code findings; the current-head review completed at 2026-10-04 11:30:19.567 UTC, also with no actionable code or security findings. Its request to record the current SDK report is satisfied above; its own technical evidence confirms that the compatibility record changes no stored-data contract. Its migration flag is a path-based false positive: src/plugins/compat/session-persistence-records.ts adds readonly deprecation metadata, with no database writes, schema, backfill, or migration.

Current exact-head CI: run 37198600728 completed successfully: 86 successful jobs, 21 skipped, zero failed or cancelled jobs. Build, production/test types, core/extension lint, extension declaration boundary, ratchets, Windows, all UI shards, both real-Gateway UI shards, and openclaw/ci-gate pass. The full-check plan explicitly sets preserveFullChecks: true, satisfying the hosted alternative to the earlier local check-changed declaration timeout. The first watcher briefly observed a dependency-review failure status that the publisher subsequently replaced with success; no CI rerun was dispatched.

CI failures and their repairs

Run 37189420836 failed on 65c14e55. Main's #164810 removed throughSeq while this PR's extracted helper still forwarded it. The merge-tree ReferenceError broke build/types/lint, cold reads, media rewriting, and speech supplements. eb0f1675 removes the stale argument/parameter and preserves main's simplified query. Its separate mock ratchet failure was repaired with an isolation explanation and shrink-only baseline regeneration.

Linux attribution run 37190658411, Node 24.19.0, pnpm 12.5.1: cold-read, directive-tags, and commentary-media each fail 5/5 on exact CI merge 56d201e7189c028c623f634aa0095223e75e3be2 and pass 5/5 on main parent 302ce3d76565f909e779edd7e28cd5914657471f. Single-file commands used pnpm test <file> --maxWorkers=1; wall times were 22–27s, 28–40s, and 34–41s, respectively. These are PR/main integration defects, not flakes or inherited-red exceptions.

The corresponding real-Gateway speech UI comparison is complete on Linux with the same Node/pnpm versions and documented private-QA runtime build: original merge fails 5/5 with throughSeq is not defined, main parent passes 5/5 (53–58s), repaired 6510a8eb passes 1/1 (57s). It uses ui/src/e2e/chat-tts-supplement.real-gateway.e2e.test.ts with the canonical UI Vitest configuration and one worker. Both real-Gateway UI shards also passed in predecessor hosted CI. Both current integrated-head real-Gateway UI shards passed in CI run 37198600728. A Testbox queue timeout led to the approved AWS fallback; remote compute is stopped.

Run 37192953378, attempt 1, tested 6510a8eb through merge c0ce5cfe1494f7d2b2ddc91e32b11ed59ddd4f9a with main parent e95e11c679301368a2f30f09e13647597c65f730: 81 successful jobs, 21 skipped, no cancelled jobs, with one failed Node job and downstream gate. The 13 directive-tag failures came from main's #164779 fixture, whose old synchronous reader mock no longer intercepted async finalization. Its causal files are unchanged by this PR.

Independent Linux comparison 37193969337: 5/5 focused runs on both the exact merge and main parent reproduce the same 13 failure names, assertions, and locations (28–41s wall, one worker). Both five-file native-plan replays match, using a one-worker ceiling rather than CI concurrency. Main subsequently repaired the fixture in 6aefbb11f30aabb872e7fc379e4b97af7217903c. The current integration includes that repair and all 132 tests pass locally. No assertion, timeout, retry, or allowance was weakened; no inherited-failure admin merge was submitted.

Historical implementation proof for the original approved head 228d95d, including the SQL workload

These measurements retain their original baseline and head identities. Main now supplies the shared asynchronous context-engine flow; this is not a new benchmark of the integrated head.

  • Landing validation rerun at 228d95d9f1d10fc011e464863853b3d232091500: full node scripts/check-changed.mjs --base e1f9a9c53d92b826d953a4fd4237c5b9d76a1306 took 2034.04s wall. Guards, six Doctor contract tests, all selected production/test/script typechecks, SDK export/surface checks, unused-export scans, formatting, and core lint passed. Extension lint again failed before execution because plugin-sdk boundary dts hit its 300000ms managed timeout. The full gate remains incomplete; hosted jobs covering it on the integrated head remain a merge precondition.
  • Anchor/readiness boundary and alias/import regressions: 9 passed, --maxWorkers=1, 394.23s wall. Covers zero caller-thread SQL including cold discovery, missing-store noncreation, stale projection refusal/no repair, physical replacement, incognito exclusion, and close through the original alias. The alias-close test failed before the fix with SQLite still locked and passed after the fix.
  • Focused caller and SHARED-REGISTRY IMPORT RULE suites: 139 passed across 12 files, --maxWorkers=1, 1599.76s wall. Includes runtime-process-build-graph, get-reply.imports, history/reconcile/state/worker import closures, reply dispatch/commentary, turn lifecycle, user-turn persistence, core agent-end, and bundled Codex agent-end context. The unpublished native-append race refuses final delivery certification.
  • check-changed: tooling timeout; merge precondition, 2931.48s wall on final head. All guards, typechecks, unused-export scans, formatting, and core lint passed. Extension lint could not start because its plugin-sdk boundary dts preparation hit the managed 300000ms timeout. Rerun the complete gate, including extension lint, on a host with sufficient capacity before merging. The first completed run (1234.37s) passed core and all core test type graphs, then exposed a missing declared QA Lab workspace devdependency. Installed that dependency through frozen pnpm preparation (6.68s), with no source/lockfile change, before the final rerun. A subsequent strict lint pass found a 702-line worker types file despite the shrink-only ratchet passing; the unchanged progress-card request type now lives with the existing read contracts. Targeted lint passes (59.58s).
  • The checks scheduled after the extension-lint failure were run separately: changed script lint passed (34.14s), Docker E2E boundary guard passed (1.73s), raw HTTP/2 import guard passed (25.71s).
  • Madge: 0 cycles, 147.29s. SQLite worker ratchet: no T1 call-count growth against the pinned baseline, 24.63s. SDK surface gate passes with exactly the approved allowances (15.65s); no new environment names.
  • Released SDK comparison: completed locally against v2026.9.8 on final head 228d95d9f1d10fc011e464863853b3d232091500, canonical temporary root, 2432.58s wall. runAgentEndSideEffectsAsync is added; the declarations of the existing synchronous runAgentEndSideEffects(...): void and awaited helper remain intact. The report includes cumulative main-versus-release changes outside this PR. Comparing the final report with the implementation-commit report shows no new/removed diff rows and no changed export declaration text from the type-only follow-up.
  • Final isolated Codex P2 autoreview: scoped-clean, 448.82s. The earlier alias-custody finding was fixed and exercised. The read contracts remain acyclic; the final type-only lint extraction preserves emitted runtime code.
  • Local source-map runtime build passed (755.19s); unchanged synthetic SQL workload passed (229.47s). Wall times include worker compilation and shared-host contention; hosted CI seconds are not yet available.

Observed Gateway-thread statement executions (preparations counted separately), using the same isolated local mock-provider workload and Node 24 source-map build. All 13 chats, the child run, cron, compaction, and graceful shutdown succeeded before and after. Selected four-site T1 SQL: 28.0 → 0.0 per warmed turn. Overall: 337.2 → 321.4 per warmed turn (ten-turn totals 3372 → 3214). Each selected site fell from 7.0 to 0.0 per turn. Overall counts include unrelated background work and asynchronous phase timing; they are reported without filtering the two higher after-run turns.

Phase Overall before → after Selected sites before → after
01.boot 2924 → 2926 0 → 0
01.connect 50 → 47 0 → 0
02.first-turn 1056 → 852 28 → 0
03.ten-warmed-turns 3372 → 3214 280 → 0
04.second-session 1157 → 1074 68 → 0
05.control-plane 0 → 0 0 → 0
06.cron 513 → 483 8 → 0
07.compaction 203 → 203 0 → 0
08.shutdown 400 → 404 0 → 0

Warmed main-thread totals by turn: before [336, 336, 338, 338, 340, 336, 336, 336, 338, 338]; after [304, 410, 304, 306, 362, 308, 304, 304, 304, 308]. Selected sites are 28 → 0 on every one of the ten turns.

Baseline: e1f9a9c53d92b826d953a4fd4237c5b9d76a1306 (authorized prerequisites combined). Measured behavior commit: 0aef2212c385ca732eef6db8b9e5d830ac394252. Final head 228d95d9f1d10fc011e464863853b3d232091500 only moves an unchanged internal worker request type to meet the absolute lint cap; compiler output for both affected modules is byte-identical. The final SDK comparison and review include that follow-up. The harness code is unchanged apart from absolute import/observer paths for external scratch. The harness’s legacy hardcoded head field is not used as revision evidence.

Refresh freshness at read admission and after BEGIN while reusing
handle-owned facts for runtime schema checks. Validate canonical
triggers before exposing agent readers and classify shared-state
failures only after failed admission.

Focused runtime checks execute zero SQL statements, versus 30 with
the baseline owner. Preserve foreign-commit and snapshot semantics.
Full workload measurement and remote integration checks remain merge
preconditions after remote runner and fleet-capacity admission failed.
Route audited writer claims, live-model-switch bookkeeping, and pending-final
preparation, settlement, and cleanup through the existing agent executor.
Preserve native opaque SDK callbacks and the excluded lifecycle and cron paths.

The paired isolated Gateway workload reduces native patch transactions from
8 to 2 per warmed turn and target-site SQL from 48 to 12. Overall main-thread
SQL averages 648.5 to 493.4 statements per warmed turn. Lifecycle persistence
remains follow-up work after #142236; cron preparation remains with #161105.

Local caller, settlement, error identity, import-boundary, cycle, and database
ratchet proof passes. Full build, changed checks, and released SDK diff remain
explicit merge preconditions under the maintainer's validation instruction.
Integrate the pinned measurement baseline and retain main-key facts through the existing connection and reader-admission owners. Preserve raw writes, foreign commits, transaction snapshots, authorizers, and continuation authority.
Create and read producer-recovery sessions under the same explicit shared-state root as their delivery queue. Worker-backed pending-final settlement correctly rejects the previous fixture ownership mismatch. Preserve durable payloads and all existing assertions.
Use the existing worker generation claim for maintenance metadata instead of
retaining a host read handle. Keep both live ownership checks around the
required transaction-entry freshness probe.

Consolidate shared-state cache initialization, refresh, and terminal failures
in its admission sibling and update the compiled-wrapper inventory. This
keeps the cache within the existing module-size limit without changing stored
schema or quarantine semantics.

Focused maintenance, ownership, schema, worker, wrapper, and quarantine proof
passed. Independent Codex review is clean through P2. Full landing validation
remains required before merge.
Keep the accounting persistence suite within its line cap by moving fixture construction into a dedicated test-support module. Preserve suite-owned state, immediate operation registration, and every test case and assertion.
Refresh canonical readiness when it consumes schema facts. Retention only
holds native lifetime, so cold restore and other worker handoffs no longer
execute host SQLite before dispatch.

Protect foreign schema invalidation at the warm readiness fast path. Tighten
retained-reader budgets to the optimized counts, and require early missing-table
diagnosis before callbacks while preserving handle-cleanup assertions.

Validation: 93 focused tests, production types, state/config test types, and
independent review clean through P2.
Integrate the released-SDK diff tooling fix and the inherited child-coordination fixture correction. The merge preserves every authored source, test, and documentation blob; the wrapper inventory combines both branches.
…basync/schemafacts' into dbasync/transcriptfacts
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling extensions: codex size: XL labels Oct 4, 2026
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Merge current main after the schema-facts prerequisite landed, preserving the
common context-engine finalizer and user-turn recorder cleanup.

Retain duplicate reply identity with the normalized writer authority selected
by persistence. Recheck that authority and the explicit caller guard after the
awaited anchor read so a superseded attempt cannot acknowledge a duplicate.
Reuse the existing database-candidate identity capture helper.

Validation: both new authority regressions failed before the repair; the full
mirror-identity file now passes 14 tests. Core types, focused lint, and fresh
P2 review pass. Caller and import-closure validation continues before landing.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 4, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 7:30 AM ET / 11:30 UTC (Revision 5).

ClawSweeper review

What this changes

Moves durable transcript identity and readiness reads into the existing history worker and makes turn finalizers await preparation while preserving the synchronous Plugin SDK helper.

Merge readiness

⛔ Blocked before merge - 2 items remain

This PR remains useful: current main still performs synchronous anchor preparation. No actionable introduced defect was found, and the completed Linux speech comparison resolves the previous review blocker.

Priority: P2
Reviewed head: f8177d96f47fde49101993b793cad89692f5a3a0

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong production-boundary evidence and a coherent compatibility-preserving implementation; no actionable code findings remain.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The recorded isolated Gateway workload exercises the production transcript-read boundary and observes reduced caller-thread SQL with successful turn and lifecycle outcomes. Real-Gateway Linux speech recovery resolves the previous integration concern; historical source identities remain explicit. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The recorded isolated Gateway workload exercises the production transcript-read boundary and observes reduced caller-thread SQL with successful turn and lifecycle outcomes. Real-Gateway Linux speech recovery resolves the previous integration concern; historical source identities remain explicit. No stored-data contract changes.
Evidence reviewed 10 items Pinned introduction and clean checkout: Reviewed the introduced delta from d47ee98 to f8177d9. Raw head parent records match the supplied original-head identity; the checkout remained clean.
Work remains absent from current main and latest release: Inspected current-main and latest-release agent-end implementations; both still call the synchronous anchor reader. The related merged cleanup does not establish that this worker cutover has landed.
Released synchronous contract: The v2026.9.8 implementation retains runAgentEndSideEffects returning void and awaitAgentEndSideEffects returning a promise. The proposed additive helper preserves those existing signatures.
Findings None None.
Security None None.

How this fits together

Session transcripts record conversation history and identify the messages belonging to the active conversation branch. Turn finalization and chat delivery consume these identities to schedule review work and confirm replies.

flowchart TD
  A[Turn completion or chat reply] --> B[Capture transcript ownership]
  B --> C[Existing history worker]
  C --> D[Read readiness and message identities]
  D --> E[Recheck current ownership]
  E --> F[Schedule review or confirm delivery]
Loading

Before merge

  • Complete next step (P2) - Record completion of the current-head released-SDK comparison already underway before native landing.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +437, Tests +377, Docs +13, Other +2. Total +829 across 30 files.

View PR surface stats
Area Files Added Removed Net
Source 19 539 102 +437
Tests 7 426 49 +377
Docs 2 18 5 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 2 6 4 +2
Total 30 989 160 +829

Review metrics

Metric Value Why it matters
SDK contract 1 callable added; 1 synchronous helper deprecated The additive awaited helper preserves the shipped synchronous contract through a documented next-major compatibility window.
Production growth justification production net +437 lines; tests net +377 lines Growth implements typed snapshot reads and retained ownership in the existing worker rather than introducing another service or persistent cache.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/plugins/compat/session-persistence-records.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Complete the existing history-worker cutover while preserving released SDK behavior, current authority checks, and native incognito ownership.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction: this is a performance cutover, supported by source inspection and a recorded before/after Gateway SQL workload.

Is this the best way to solve the issue?

Yes. Extending the existing history reader preserves one ownership path, and the additive awaited SDK helper avoids breaking published synchronous callers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e318434756f9.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded performance improvement to session finalization and reply observation, with no demonstrated urgent user-facing regression.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The recorded isolated Gateway workload exercises the production transcript-read boundary and observes reduced caller-thread SQL with successful turn and lifecycle outcomes. Real-Gateway Linux speech recovery resolves the previous integration concern; historical source identities remain explicit. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The recorded isolated Gateway workload exercises the production transcript-read boundary and observes reduced caller-thread SQL with successful turn and lifecycle outcomes. Real-Gateway Linux speech recovery resolves the previous integration concern; historical source identities remain explicit. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Reviewed the introduced delta from d47ee98 to f8177d9. Raw head parent records match the supplied original-head identity; the checkout remained clean. (f8177d96f47f)
  • Work remains absent from current main and latest release: Inspected current-main and latest-release agent-end implementations; both still call the synchronous anchor reader. The related merged cleanup does not establish that this worker cutover has landed. (src/agents/harness/agent-end-side-effects.ts:47, e318434756f9)
  • Released synchronous contract: The v2026.9.8 implementation retains runAgentEndSideEffects returning void and awaitAgentEndSideEffects returning a promise. The proposed additive helper preserves those existing signatures. (src/agents/harness/agent-end-side-effects.ts:62, fc23bc864e45)
  • Snapshot consumption and authority: The reader checks captured physical identity and worker ownership after awaiting results, retains writer admission during final consumption, and refuses consumption after an intervening native mutation. Duplicate acknowledgment separately rechecks both the captured persistence authority and explicit caller guard. (src/config/sessions/session-transcript-anchor-read.ts:116, f8177d96f47f)
  • SDK compatibility and storage boundary: The synchronous helper remains available, with a dated deprecation record and next-major removal gate. Tests preserve its void result. The compatibility record is readonly metadata; the introduced changes contain no schema, serialized-format, migration, retention, or configuration change. (src/plugins/compat/session-persistence-records.ts:4, f8177d96f47f)
  • Complete captured proof body inspected: Read the complete GitHub body and verified SHA-256 96acd4d8aea0dee690a99d68b022417e4b29bacac8c98ea228cb944ff3d5cfcd against the supplied snapshot. Its isolated Node 24 Gateway workload reports successful chats, child execution, cron, compaction, and shutdown, with selected caller-thread SQL falling from 28 to zero statements per warmed turn. These measurements remain attributed to their original baseline and implementation revision. (0aef2212c385)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-04T08:44:41.717Z sha 65c14e5 :: blocked before merge. :: none
  • reviewed 2026-10-04T09:34:59.047Z sha eb0f167 :: blocked before merge. :: none
  • reviewed 2026-10-04T09:46:57.274Z sha 6510a8e :: blocked before merge. :: none
  • reviewed 2026-10-04T10:23:54.601Z sha 6510a8e :: blocked before merge. :: none

Merge current main without restoring its retired throughSeq option. Remove the
argument left in the extracted reader, which broke cold reads, media rewrites,
and speech supplements in the GitHub merge tree.

Document the agent-end mock isolation and canonically remove its obsolete
baseline entry. Register the released synchronous agent-end compatibility
window and verify its void return alongside the additive awaited helpers.

Core and SDK test types, focused lint, and independent P2 review pass. Focused
runtime validation and the integrated released-SDK report remain landing gates.
Merge main and preserve its tool-authored source reply helper. Retain exactly
one additional public, callable, and deprecated export for transcript anchor
preparation, with both approved additions reflected in the shared budget.

The SDK surface check, SDK test types, script lint, and independent P2 review
pass. The prior candidate passed 226 focused tests and its released-SDK report;
current-head CI and the refreshed released-SDK report remain landing gates.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Oct 4, 2026
Merge main to include the directive-tag fixture fix for the inherited async reader failure. Preserve the transcript anchor worker cutover and released SDK compatibility.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Integrated main's directive-tag worker-reader fixture repair in f8177d9. The affected 132 tests, import/build-graph checks, core types/lint, and fresh P2 review pass. The historical Linux speech comparison is complete: original merge fails 5/5 with throughSeq undefined, main parent passes 5/5, and repaired 6510a8e passes. Fresh exact-head CI and the local released-SDK comparison are running.

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 4, 2026
@steipete
steipete merged commit f9dfa9a into main Oct 4, 2026
200 checks passed
@steipete
steipete deleted the dbasync/transcriptfacts branch October 4, 2026 11:42
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…tory reader (openclaw#164747)

* perf(state): carry admitted schema facts with database handles

Refresh freshness at read admission and after BEGIN while reusing
handle-owned facts for runtime schema checks. Validate canonical
triggers before exposing agent readers and classify shared-state
failures only after failed admission.

Focused runtime checks execute zero SQL statements, versus 30 with
the baseline owner. Preserve foreign-commit and snapshot semantics.
Full workload measurement and remote integration checks remain merge
preconditions after remote runner and fleet-capacity admission failed.

* perf(agents): run per-turn session-entry patches through the worker

Route audited writer claims, live-model-switch bookkeeping, and pending-final
preparation, settlement, and cleanup through the existing agent executor.
Preserve native opaque SDK callbacks and the excluded lifecycle and cron paths.

The paired isolated Gateway workload reduces native patch transactions from
8 to 2 per warmed turn and target-site SQL from 48 to 12. Overall main-thread
SQL averages 648.5 to 493.4 statements per warmed turn. Lifecycle persistence
remains follow-up work after openclaw#142236; cron preparation remains with openclaw#161105.

Local caller, settlement, error identity, import-boundary, cycle, and database
ratchet proof passes. Full build, changed checks, and released SDK diff remain
explicit merge preconditions under the maintainer's validation instruction.

* test(outbound): align recovery fixtures with queue state

Create and read producer-recovery sessions under the same explicit shared-state root as their delivery queue. Worker-backed pending-final settlement correctly rejects the previous fixture ownership mismatch. Preserve durable payloads and all existing assertions.

* fix(state): preserve worker handoffs during schema admission

Use the existing worker generation claim for maintenance metadata instead of
retaining a host read handle. Keep both live ownership checks around the
required transaction-entry freshness probe.

Consolidate shared-state cache initialization, refresh, and terminal failures
in its admission sibling and update the compiled-wrapper inventory. This
keeps the cache within the existing module-size limit without changing stored
schema or quarantine semantics.

Focused maintenance, ownership, schema, worker, wrapper, and quarantine proof
passed. Independent Codex review is clean through P2. Full landing validation
remains required before merge.

* test(agents): extract accounting persistence fixture

Keep the accounting persistence suite within its line cap by moving fixture construction into a dedicated test-support module. Preserve suite-owned state, immediate operation registration, and every test case and assertion.

* fix(state): keep retained handles free of schema probes

Refresh canonical readiness when it consumes schema facts. Retention only
holds native lifetime, so cold restore and other worker handoffs no longer
execute host SQLite before dispatch.

Protect foreign schema invalidation at the warm readiness fast path. Tighten
retained-reader budgets to the optimized counts, and require early missing-table
diagnosis before callbacks while preserving handle-cleanup assertions.

Validation: 93 focused tests, production types, state/config test types, and
independent review clean through P2.

* perf(sessions): read transcript anchors and readiness through the history reader

* refactor(sessions): group history read request types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant