Skip to content

perf(sessions): reuse revision-bound transcript projection status - #165377

Merged
steipete merged 7 commits into
mainfrom
steipete/perf-micro-projection-status-facts-20260919
Oct 5, 2026
Merged

steipete merged 7 commits into
mainfrom
steipete/perf-micro-projection-status-facts-20260919

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Warm disk and actor projection status no longer walk the store to prove there is no work. The existing projection maintenance owner publishes connection-owned, revision-bound facts; status and search consume those facts and schedule bounded maintenance when the revision is unknown or dirty.

What Problem This Solves

A production census found three slow projection-status holds (4.787-second median, 4.916-second maximum) on a 36.88 GiB agent database. The census did not distinguish global from targeted requests. Global status scanned session windows and latest events, then performed negative orphan checks across active events, FTS identities and index state. LIMIT 1 did not bound a clean answer.

The writer now classifies at most 128 candidate sessions and removes at most 512 orphan rows per projection table per transaction. Transactional TEMP facts retain pending sessions, admission progress and completed traversals. Clean reads need no writer transaction or commit grant. The recurring global read-worker scan and duplicate planner scan are removed; actor search uses the same owner so a dirty sibling still schedules store-wide repair while hits remain scoped.

Mutation boundary Invalidation
Append, replace, rewrite, classification Transcript and active-projection triggers queue the affected session.
Session creation, key change, deletion Window and affected transcript/projection mutations.
Projection claim, append, finalize, deletion Active-event, FTS-identity and index-state mutations.
Cold-storage move/restore, raw SQL, cascades The same transactional table triggers.
Foreign commit Fresh PRAGMA data_version observation invalidates clean certification; bounded traversal retains progress under continued writes.
Unknown file, schema change, connection retirement Admission resets tracking; native close discards TEMP state.

Rollback restores source and tracking together. Reconciliation preserves cancellation, live actor authority, native settlement, and committed publication receipts. Moving these paths through queued worker admission exposed a lost async opening context; binding the captured assertion fixes startup without weakening live revocation. Independent requests retain their own cancellation custody.

Production LOC: +667 (1,039 added, 372 deleted), excluding tests/test-support/docs. This exceeds the shrink target: raw-write/savepoint correctness requires transactional tracking (347 lines), bounded foreign admission requires resumable traversal, and search must retain a reader-revision witness. The coordinator also preserves independent caller cancellation and the public read contract when maintenance is refused or its owner retires. The existing synchronous appendSessionYieldContext SDK contract and native operator maintenance retain their native adapter; removing it requires a separate asynchronous SDK cutover. No config, persistent schema, retention, or upgrade behavior changes.

Measurement

Linux rig, Node 26.8.1: 4,000 sessions; 2,000,000 rows each in transcript, active projection and FTS identity tables; 601 MiB. Baseline 989bd3f055fa343632957da15372886c65ee4be6 includes ordered owner-set cleanup. The measured warm clean-status function is unchanged in the final candidate. The final rebase did not change the SQLite, schema-fact, or query-cache modules used by the harness.

Warm native-kernel measurement Before After
Clean-status median 423.848 ms 0.035895 ms
Clean-status maximum 601.329 ms 0.705772 ms
Tiny append median 0.097848 ms 0.149435 ms

Seven baseline/100 candidate status samples; 500 append samples per side. The synthetic append transaction inserts transcript/active rows and updates index state; it omits FTS-content insertion. Its measured bookkeeping increase is about 52 µs. Complete production append latency remains unmeasured. Warm clean status is constant-time. The fixture omits full FTS content; transport/admission and production latency on the 37 GiB store remain unmeasured.

The admission cursor uses five ordered, covering-index seeks, each LIMIT 1; its merge sorts at most five candidates:

SEARCH session_windows USING COVERING INDEX sqlite_autoindex_session_windows_1 (session_id>?)
SEARCH session_transcript_active_events USING COVERING INDEX idx_agent_transcript_active_event_seq (session_id>?)
SEARCH session_transcript_fts_rows USING COVERING INDEX idx_session_transcript_fts_rows_session_message (session_id>?)
SEARCH session_transcript_index_state USING COVERING INDEX sqlite_autoindex_session_transcript_index_state_1 (session_id>?)
SEARCH temp.openclaw_transcript_index_pending USING COVERING INDEX sqlite_autoindex_openclaw_transcript_index_pending_1 (session_id>?)

Per-session orphan cleanup uses indexed transcript existence checks and bounded deletes. Earlier bounded-admission measurements were 14.633 ms median/36.752 ms maximum; a late orphan was cleaned in 32 calls/660 ms despite foreign commits. Regression coverage additionally exercises local/foreign churn, rollback/savepoints, schema invalidation and continued work after traversal completion.

Evidence

Production validation head 9a52ae80a00c93ed5dd5b822101e12d90e061286, base dd09da279cbdad3b6bf34a23220de3307079b80d, tree 78527b9100b8e193ce5ec9c6f34b1e943973408f. The branch contains only lane commits. A conflict-free rebase incorporated the upstream export-guard fixes d5fbbe86 and 8ccf43d1 (#165631); their files are outside this PR's diff.

Production proof uses the authorized Hetzner fallback after Testbox queueing: lease cbx_9cb8b61346f0, run run_ffe39c124884b587d31335a19f7d8972, Node 24.21.0, pnpm 12.5.1, SQLite 3.53.4. The fresh PR checkout verifies the full tree, all 42 changed-file hashes, and absence of other tracked edits. No local suites, builds or typechecks ran.

Command / boundary Result
node --import ./scripts/tsx.mjs scripts/check-deadcode-exports.mts Production, full-tree and script scans passed with zero entries; 166.00 s.
node scripts/run-vitest.mjs <30 focused files> --maxWorkers=1 (exact selection below) 341 passed, 492.93 s wall.
node scripts/run-vitest.mjs src/infra/sqlite-worker-broker-lifecycle.test.ts --maxWorkers=1 10 passed, 29.95 s wall.
Original seven-file Gateway shard, node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway-server.config.ts --maxWorkers=2 … 46 passed, 226.50 s wall. No standalone fallback was needed.
node scripts/check-changed.mjs --staged --base dd09da279cbdad3b6bf34a23220de3307079b80d Passed, 2,966.15 s: core types, all 27 core test graphs, extension types/test types, all unused-export scans, lint and guards. Full tree unchanged.
Independent full-branch review, P0–P2 Three passes scoped-clean; no actionable findings.

The production suites total 397 tests in 38 files. Prior negative controls failed for their intended defects: lost opening context, orphan-only native state, and a live request dropped when its predecessor later cancels. Those repaired behaviors passed again on this head. Coverage includes rollback/savepoints, schema changes, foreign/local mutation progress, bounded orphan cleanup, actor dirty siblings and multi-batch admission, snapshot freshness, cancellation/native settlement, and clean reads without write grants.

The Gateway timeout reproduced in its original shard while the unmodified base passed. Diagnostic evidence identified the lost async opening context. The repaired original shard passes without increased timeouts or weaker assertions. Staged checks also caught the reconciliation line cap, an unbound result generic, and a fixture collector signature; the final code keeps backlog reads with the publication owner and uses the correctly typed result and collector. The shared-traversal regression remains unchanged.

Measured case time in the one-worker focused run: status facts 0.511 s; actor history 3.425 s; actor compute 17.155 s; native memory 5.289 s; continuation 14.506 s; scheduling 5.300 s; readiness 11.976 s; search 29.434 s; query plans 0.860 s. Worker publication, cancellation and snapshot guarantees need their real reader/writer boundary; fixtures are reused. Standalone broker wall time is recorded above; the aggregate wall time includes the selected owners' compilation and setup. All Node test shards, UI shards, build artifacts, and core test-type checks passed on the final head. Main CI is blocked by hosted-runner admission, as detailed below.

Final head 2b43ee3b745d62fc8cf6c815cc9897d10352c436 adds only the five-store search fixture repair; production bytes are unchanged from the validated head above. SQLite TRUNCATE checkpoints can increment a reader's data_version without changing rows. The native executor retains one idle writer; releasing other fixture writers caused those checkpoints during search, correctly invalidating its snapshot witness. The test now holds all five real writer owners through clean-status preparation and the unchanged response assertions, then releases them in finally. The production freshness fence is unchanged.

Final fixture proof on Hetzner cbx_ddaf3003ccb6, run run_6cfdc203b03f321dd3c9861ac582bce0:

Command Result
node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway-methods.config.ts src/gateway/server-methods/sessions-search-scope.test.ts --maxWorkers=1 7 passed; 71.69 s wall (68.78 s Vitest).
Original eight-file methods selection and one isolated file, respective CI configs, --maxWorkers=4 213 passed: 200 methods cases in 132.92 s wall; 13 isolated cases in 70.45 s wall.
node scripts/run-vitest.mjs src/config/sessions/session-transcript-search.worker.test.ts --maxWorkers=1 1 passed, 38.80 s wall. The publication-race freshness assertion remains unchanged.
node scripts/check-changed.mjs --staged Passed, 468.95 s wall: Gateway-methods types, all three unused-export scans (zero entries), lint and guards. Full candidate tree unchanged.
Independent final-fixture review, P0–P2 Scoped-clean, no actionable findings.

CI runner-admission blocker

Final-head CI run 37366923726 passed its Node tests, UI tests, build, core test types and lint. Attempt 1 lost six jobs before execution; each had no runner and zero steps. GitHub reported: “The job was not acquired by Runner of type hosted even after multiple attempts.” The failed jobs were retried once without changing source or rerunning passing tests. Docs and extension lint passed on retry; attempt 2 again cancelled security-fast, check-source-contracts, check-additional-boundaries, and check-prod-types after about 15 minutes, with no runner and zero executed steps.

The required openclaw/ci-gate is therefore blocked. CodeQL, workflow sanity, and PR automation also encountered hosted-runner admission failures. No further identical retry was submitted. The PR remains ready at 2b43ee3b745d62fc8cf6c815cc9897d10352c436; these nonexecuted jobs need a retry when hosted-runner admission recovers. The remote full production gate and final staged fixture gate above both passed. All owned leases are released.

Search-fixture diagnostic runs on Hetzner cbx_ddaf3003ccb6
Run Command / result
run_282cfb284081b32c650ab9eb6674f5b4 Nine-file Gateway selection: 212 passed, 1 failed; standalone scope case reproduced the same indexing assertion.
run_d23d2da898175dfcb141a13e77ffdac2 Original-fixture negative control reproduced; unretained warmup attempt still failed the scope case (six sibling cases passed).
run_f28d9027f26077a6725ea50b77d26946 First scope case with temporary revision diagnostics failed as expected; identical connection/schema witnesses differed in data_version.
run_254e065a92bd5c33010db2b0e2983cd3 First scope case with temporary transaction diagnostics failed as expected; no transcript or metadata mutations accounted for the revision change.
run_e796065a2746f04c20d817310872486c Source-hash check refused the edited fixture before tests; no test result claimed.

Temporary diagnostic changes were restored. The final retained-owner candidate passed the complete focused validation above. The lease is released.

The original fixture failed both in CI run 37358853001 and standalone with the same indexing assertion. An unretained warmup attempt also failed. Diagnostic runs traced the revision change; one later diagnostic stopped before tests because its source hash no longer matched the edited fixture. All proof runs use normal sync and exact source checks. Earlier production validation remains applicable because the final repair is test-only.

Validation attempts on Hetzner lease cbx_83e62537ed93
Run Command / result
run_dacd1b2889e6e9226e0b6fb7f1aba24f Three negative controls confirmed, broker lifecycle 10 passed; focused suites stopped at the actor dirty-sibling regression (113 other cases passed).
run_631700a4bf164b1f9a8a1c43f3540cd6 Original seven-file Gateway shard: 46 passed, 180.08 s.
run_044932ba323a52a2939c306f994e7ec3 Fresh PR checkout failed fetching a blob (curl 65); no validation ran. One fresh-checkout retry succeeded.
run_5120afe7014695b4a126415f99e6b71a Actor suites 46 passed; focused suites 341 passed; Gateway close 1 passed (69.47 s); staged gate stopped at reconciliation line-cap growth.
run_be53fbceceac2da519c33ee361537b60 Staged gate passed the line cap, then found an unbound result generic in core types (249.46 s wall).
run_1a3cbcb07a21e59131304cb0f4744af8 Staged gate passed production types and 23 test graphs, then found the memory fixture collector signature mismatch (1,474.21 s wall).
run_de31611d1eccf09277041e5bb074ae4d Agents/sessions types passed; six suites passed 46/47, exposing the misplaced extraction's bypass of the readiness fixture's injection. The regression stayed unchanged.
run_c94479b7e66d6538bc01cded7d642f9e Final owner placement: targeted types and all 47 reconciliation cases passed; complete staged gate passed production types, all 27 core test graphs and extension types/test types, then stopped on untouched upstream exports (1,933.45 s). Both export fixes are included in the new base.

All runs used normal fresh-PR checkout; uncommitted candidates applied the intended local patch. No run bypassed sync. Final proof verifies full-tree identity, not just the published parent SHA.

Exact focused-suite selection
node scripts/run-vitest.mjs \
  src/agents/sessions/session-manager-incognito.test.ts \
  src/config/sessions/session-accessor.sqlite-cold-read.test.ts \
  src/config/sessions/session-accessor.sqlite-transcript-store.test.ts \
  src/config/sessions/session-transcript-context-eligibility.test.ts \
  src/config/sessions/session-transcript-index-status.test.ts \
  src/config/sessions/session-transcript-projection-catchup.test.ts \
  src/config/sessions/session-transcript-projection-rebuild.test.ts \
  src/config/sessions/session-transcript-reconcile.admission.test.ts \
  src/config/sessions/session-transcript-reconcile.backlog-order.test.ts \
  src/config/sessions/session-transcript-reconcile.bootstrap.test.ts \
  src/config/sessions/session-transcript-reconcile.imports.test.ts \
  src/config/sessions/session-transcript-reconcile.lease.test.ts \
  src/config/sessions/session-transcript-reconcile.lifecycle-phases.test.ts \
  src/config/sessions/session-transcript-reconcile.lifecycle.test.ts \
  src/config/sessions/session-transcript-reconcile.native-exit.test.ts \
  src/config/sessions/session-transcript-reconcile.publication.test.ts \
  src/config/sessions/session-transcript-reconcile.readiness.test.ts \
  src/config/sessions/session-transcript-search.test.ts \
  src/config/sessions/session-transcript-search.worker.test.ts \
  src/state/openclaw-agent-execution-incognito.compute.test.ts \
  src/state/openclaw-agent-execution-incognito.history.test.ts \
  src/state/openclaw-agent-execution.close-wedge.test.ts \
  src/state/openclaw-agent-worker-store.test.ts \
  src/state/sqlite-query-plan.test.ts \
  src/config/sessions/session-transcript-reconcile-memory.test.ts \
  src/config/sessions/session-transcript-reconcile.continuation.test.ts \
  src/config/sessions/session-transcript-reconcile.scheduling.test.ts \
  src/infra/sqlite-worker-broker.test.ts \
  src/infra/sqlite-worker-open-refusal.test.ts \
  extensions/memory-core/src/memory/manager-publication-settlement.test.ts \
  --maxWorkers=1

The Gateway selection is the original seven-file shard:

node scripts/run-vitest.mjs run \
  --config test/vitest/vitest.gateway-server.config.ts \
  --maxWorkers=2 --reporter=verbose \
  src/gateway/server-agent-database-startup.test.ts \
  src/gateway/server-close.board.test.ts \
  src/gateway/server-close.incognito-compute.test.ts \
  src/gateway/server-close.incognito-pending-history.test.ts \
  src/gateway/server-close.queued-heartbeat.test.ts \
  src/gateway/server-maintenance.telemetry.test.ts \
  src/gateway/server-methods.session-scoped-reads.test.ts

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL labels Oct 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed October 5, 2026, 5:29 PM ET / 21:29 UTC (Revision 12).

ClawSweeper review

What this changes

The PR makes transcript search and reconciliation reuse connection-local SQLite readiness facts, bounds projection maintenance, and preserves caller context during deferred worker opening.

Merge readiness

⛔ Blocked before merge - 6 items remain

Keep open: current main still performs store-wide status scans, so the optimization remains useful, but this head is not merge-ready.

Priority: P2
Reviewed head: 693a86cfa94924472098255cdea0ee8909ed4532

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful performance evidence and focused regression coverage are limited by an unresolved SDK incompatibility and scoped authority-proof gap.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: native SQLite measurements support maintained status facts, and remote Gateway runs demonstrate successful opening, but the changed captured-context path lacks production-owner revocation or replacement evidence before native I/O during deferred dispatch. The new regression mocks worker creation and waiting; existing native refusal coverage uses a synthetic admission callback. Connection-local TEMP tracking changes no stored-data contract. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: native SQLite measurements support maintained status facts, and remote Gateway runs demonstrate successful opening, but the changed captured-context path lacks production-owner revocation or replacement evidence before native I/O during deferred dispatch. The new regression mocks worker creation and waiting; existing native refusal coverage uses a synthetic admission callback. Connection-local TEMP tracking changes no stored-data contract. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 10 items Pinned introduction and merge ownership: The original head records parents 2b43ee3 and 0e54386. The verified test merge records the pinned main parent followed by this exact head and retains the introduced SDK type change.
The optimization remains necessary: Pinned main retains session-window enumeration, latest-event checks, and orphan owner-set existence queries. The branch replaces recurring global probes with maintained status facts; the supplied merged media-export PR addresses a separate problem.
Released SDK compatibility contract: In v2026.9.8, OpenClawAgentSqliteWorkerStore requires only run and close; the opener separately returns a richer intersection containing execute. This head instead requires execute and executeExisting on the legacy exported type, breaking assignability for existing adapters.
Findings 1 actionable finding [P1] [P1] Preserve the released run-and-close SDK type
Security None None.

How this fits together

OpenClaw derives searchable transcript projections from canonical session events. The projection maintenance owner repairs those derived rows, while search consumes readiness information to indicate whether results may still be indexing.

flowchart TD
  A[Session events and mutations] --> B[Projection maintenance owner]
  B --> C[Revision-bound readiness facts]
  C --> D{Clean revision?}
  D -->|Yes| E[Transcript search results]
  D -->|Unknown or dirty| F[Bounded reconciliation]
  F --> B
  F --> E
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: native SQLite measurements support maintained status facts, and remote Gateway runs demonstrate successful opening, but the changed captured-context path lacks production-owner revocation or replacement evidence before native I/O during deferred dispatch. The new regression mocks worker creation and waiting; existing native refusal coverage uses a synthetic admission callback. Connection-local TEMP tracking changes no stored-data contract. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • [P1] Preserve the released run-and-close SDK type (P1) - OpenClawAgentSqliteWorkerStore is exported through openclaw/plugin-sdk/sqlite-runtime, and v2026.9.8 requires only run and close. Adding required execute and executeExisting methods makes existing plugin adapters and typed factories source-incompatible. The bundled memory consumer's new Pick avoids its own error but leaves third-party consumers broken. Preserve the legacy type and put the richer methods on the opener's return type or a separate richer type. This prior finding remains unresolved.
  • Resolve merge risk (P1) - Existing plugins implementing the released run-and-close worker-store type will fail typechecking because this PR adds two required methods.
  • Resolve merge risk (P1) - Captured opening context persists across deferred dispatch, but production-owner revocation or replacement has not been shown to prevent native I/O on that changed path.
  • Complete next step (P2) - Preserve the released SDK adapter type and provide a production-path transcript showing current-owner opening succeeds while revocation or replacement during deferred dispatch prevents native I/O. Redacted terminal output or logs are appropriate; remove credentials, IP addresses, phone numbers, private endpoints, and user data. Update the PR body for automatic re-review, or ask a maintainer to comment @clawsweeper re-review.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P1] [P1] Preserve the released run-and-close SDK type — src/state/openclaw-agent-worker-store.ts:65-71
Agent review details

Security

None.

PR surface

Source +667, Tests +1016, Docs +32. Total +1715 across 43 files.

View PR surface stats
Area Files Added Removed Net
Source 26 1039 372 +667
Tests 16 1165 149 +1016
Docs 1 37 5 +32
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 43 2241 526 +1715

Review metrics

Metric Value Why it matters
Production versus test growth production +667, tests +1,016 The PR explicitly justifies production growth through transactional tracking, resumable admission, snapshot witnesses, and cancellation custody.
Legacy SDK requirements 2 newly required methods Adding execute and executeExisting to the released adapter type creates a source-compatibility break.

Stored data model

Persistent data-model change detected: database schema: src/config/sessions/session-transcript-index-maintenance.ts, database schema: src/config/sessions/session-transcript-index-status.worker.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-database-context.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Preserve compatibility and prove opening custody (recommended)
    Retain the released run-and-close type, expose richer methods through the opener's return type, and supply current-owner success plus revoked or replaced-owner rejection before native I/O.

Technical review

Best possible solution:

Keep the bounded maintenance design, preserve the legacy SDK adapter type, and establish production-owner rejection at the native opening boundary.

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

Yes, the SDK regression is source-reproducible: a run-and-close adapter accepted by v2026.9.8 cannot satisfy the branch's newly required methods. No code or tests were executed during this read-only review.

Is this the best way to solve the issue?

The maintained-facts approach fits the existing projection owner, but the public adapter type should remain compatible while the opener exposes richer methods separately.

Full review comments:

  • [P1] [P1] Preserve the released run-and-close SDK type — src/state/openclaw-agent-worker-store.ts:65-71
    OpenClawAgentSqliteWorkerStore is exported through openclaw/plugin-sdk/sqlite-runtime, and v2026.9.8 requires only run and close. Adding required execute and executeExisting methods makes existing plugin adapters and typed factories source-incompatible. The bundled memory consumer's new Pick avoids its own error but leaves third-party consumers broken. Preserve the legacy type and put the richer methods on the opener's return type or a separate richer type. This prior finding remains unresolved.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This addresses substantial transcript-status latency with a bounded maintenance optimization.
  • merge-risk: 🚨 compatibility: The exported worker-store type no longer accepts existing run-and-close adapters.
  • merge-risk: 🚨 security-boundary: Deferred opening now restores authority-bearing context, and production-owner invalidation before native I/O remains unproven.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: native SQLite measurements support maintained status facts, and remote Gateway runs demonstrate successful opening, but the changed captured-context path lacks production-owner revocation or replacement evidence before native I/O during deferred dispatch. The new regression mocks worker creation and waiting; existing native refusal coverage uses a synthetic admission callback. Connection-local TEMP tracking changes no stored-data contract. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Pinned introduction and merge ownership: The original head records parents 2b43ee3 and 0e54386. The verified test merge records the pinned main parent followed by this exact head and retains the introduced SDK type change. (src/state/openclaw-agent-worker-store.ts:64, 693a86cfa949)
  • The optimization remains necessary: Pinned main retains session-window enumeration, latest-event checks, and orphan owner-set existence queries. The branch replaces recurring global probes with maintained status facts; the supplied merged media-export PR addresses a separate problem. (src/config/sessions/session-transcript-index.ts:481, 0e54386a4634)
  • Released SDK compatibility contract: In v2026.9.8, OpenClawAgentSqliteWorkerStore requires only run and close; the opener separately returns a richer intersection containing execute. This head instead requires execute and executeExisting on the legacy exported type, breaking assignability for existing adapters. (src/state/openclaw-agent-worker-store.ts:52, fc23bc864e45)
  • Public SDK export: The released sqlite-runtime SDK exports both the worker-store type and its opener. Narrowing the bundled memory consumer to Pick<..., 'run' | 'close'> repairs that consumer but does not preserve the public type contract. (src/plugin-sdk/sqlite-runtime.ts:16, fc23bc864e45)
  • Authority-bearing context change: captureSqliteWorkerOpen now restores captured async context when invoking opening assertions. Those assertions are consumed during queued admission, worker creation, dispatch, and native open grants. Live checks remain present, but the supplied proof does not exercise production-owner revocation or replacement during this deferred opening path. (src/infra/sqlite-worker-broker-admission.ts:73, 693a86cfa949)
  • Scoped authority coverage gap: The new lifecycle regression supplies a synthetic AsyncLocalStorage owner and mocks worker creation and Atomics.wait. Existing native refusal coverage observes a real factory marker, but uses a synthetic admission callback rather than revoking the production opening owner after context capture. Neither establishes the requested production-owner final-effect case. (src/infra/sqlite-worker-broker-lifecycle.test.ts:26, 693a86cfa949)

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore legacy run-and-close adapter assignability while retaining a separately typed richer opener.
  • Show a current production opening owner succeeding and revocation or replacement during deferred dispatch preventing native I/O.

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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-05T14:25:37.097Z sha dd09685 :: blocked before merge. :: [P1] Preserve the released run-and-close SDK type
  • reviewed 2026-10-05T15:02:41.908Z sha fd6e5f8 :: needs real behavior proof before merge. :: [P1] Preserve the released run-and-close SDK type
  • reviewed 2026-10-05T15:13:25.587Z sha fd6e5f8 :: needs real behavior proof before merge. :: [P1] Preserve the released run-and-close SDK type
  • reviewed 2026-10-05T15:35:18.532Z sha fd6e5f8 :: needs real behavior proof before merge. :: [P1] Preserve the released run-and-close SDK type | [P2] Retain fresh coalesced requests when the original caller cancels
  • reviewed 2026-10-05T15:55:12.095Z sha 5502d95 :: needs real behavior proof before merge. :: [P1] Preserve the released run-and-close SDK type
  • reviewed 2026-10-05T17:47:56.019Z sha 9a52ae8 :: needs real behavior proof before merge. :: [P1] Preserve the released run-and-close SDK type
  • reviewed 2026-10-05T19:01:06.629Z sha 9a52ae8 :: needs real behavior proof before merge. :: [P1] [P1] Preserve the released run-and-close SDK type
  • reviewed 2026-10-05T20:33:51.261Z sha 2b43ee3 :: needs real behavior proof before merge. :: [P1] [P1] Preserve the released run-and-close SDK type

@steipete
steipete force-pushed the steipete/perf-micro-projection-status-facts-20260919 branch from cf97282 to d58a1f0 Compare October 5, 2026 12:58
@steipete
steipete marked this pull request as ready for review October 5, 2026 13:00
@steipete
steipete enabled auto-merge (squash) October 5, 2026 13:01
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 5, 2026
@steipete
steipete marked this pull request as draft October 5, 2026 14:15
auto-merge was automatically disabled October 5, 2026 14:15

Pull request was converted to draft

@steipete
steipete force-pushed the steipete/perf-micro-projection-status-facts-20260919 branch from d58a1f0 to dd09685 Compare October 5, 2026 14:16
@openclaw-barnacle openclaw-barnacle Bot added the extensions: memory-core Extension: memory-core label Oct 5, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Oct 5, 2026
@steipete
steipete force-pushed the steipete/perf-micro-projection-status-facts-20260919 branch from dd09685 to fd6e5f8 Compare October 5, 2026 14:56
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Oct 5, 2026
Inject the synthetic deletion failure on the real SQLite worker connection
with a TEMP trigger, preserving storage admission and planner schema cookies.
Rename the private error constructor to avoid shadowing its exported binding.

On base a9f4080, Testbox passed
277 focused tests and four regression negative controls on the exact tree.
Keep the legacy incognito handle fence at write execution so readiness can
observe disposal and scheduled successors remain joined to old settlement.
Narrow the memory publication consumer to the run/close contract it uses.

Capture queued worker-opening assertions in their caller context, preserving
live revocation before dispatch and native open grants. This fixes the lost
startup preparation authority exposed by the projection queue changes.

Validation: independent review is clean. The memory lifecycle and scheduling
suites pass (33 tests), as does extension typechecking. The original Gateway
shard failure and a diagnostic stack establish the queued-open defect; the
unmodified base passes. Broker regression and fixed Gateway proof are pending
Testbox sync recovery, with full validation tracked in the PR.
…equests

Clean native orphan-only projections before reporting readiness. Coalesce
requests only when they share caller authority, and separate native settlement
from the public handoff promise so a canceled successor cannot drop prior work
or create a promise cycle.

Extend the existing memory and scheduling regressions for orphan-only stores,
both cancellation arrival orders, and a canceled distinct memory successor.
Independent P0-P2 review is clean; remote runtime proof is pending source-sync
recovery and remains tracked in the draft PR.
Use the shared maintained facts to schedule store repair for dirty siblings
while keeping search hits scoped. Carry bounded preflight and sweep work
through actor reconciliation, and keep admission traversal in its existing
maintenance owner.

Preserve the reconciliation result type through cancellation settlement.
@steipete
steipete force-pushed the steipete/perf-micro-projection-status-facts-20260919 branch from 5502d95 to 9a52ae8 Compare October 5, 2026 17:37
@steipete
steipete marked this pull request as ready for review October 5, 2026 18:49
@steipete
steipete enabled auto-merge (squash) October 5, 2026 18:53
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Oct 5, 2026
@steipete
steipete merged commit 359eb9c into main Oct 5, 2026
225 of 229 checks passed
@steipete
steipete deleted the steipete/perf-micro-projection-status-facts-20260919 branch October 5, 2026 21:43
steipete added a commit that referenced this pull request Oct 6, 2026
359eb9c (#165377) validates the search reader revision after checking
index status. Releasing the status writer can close and checkpoint it
before that validation, invalidating the search's own snapshot even when
all transcript projections are complete. Real command-palette searches
then show "Indexing older messages" for an already indexed corpus.

Retain the canonical lazy execution across the hit read, status read, and
revision validation. Release it after the history read settles. Preserve
authorized read-only hits if maintenance admission fails, and keep the
existing stale-snapshot and incognito handling.

Remove the scoped-search fixture's artificial execution hold while keeping
all assertions. Extend the worker availability check to cover early writer
admission failure. The real-Gateway e2e file remains unchanged. Database
work stays in its existing workers; no schema or stored-data change.

Validation: unchanged real-Gateway file before fails, after passes with all
15 searches complete; seven scoped RPC cases and the worker safety case
pass. Type-aware/boundary lint, core types, both changed-test type graphs,
and independent P2 review pass.

Testbox-congestion exception: the lease timed out after 15 minutes queued,
before sync or execution. The authorized ready-PR fallback leaves Linux
3x e2e, owning configurations, whole architecture, and full check-changed
unrun. This real-Gateway suite is hourly-only under current CI policy.
steipete added a commit that referenced this pull request Oct 6, 2026
Transcript projection preflight now uses the canonical agent executor even
for clean stores. The divergent secondary-agent scenarios reached real
startup maintenance from Vitest threads, where the host-owner guard
correctly refused admission. Route the unchanged suite through the existing
isolated infrastructure forks. Keep all 13 cases and every assertion.

Production startup already runs this path on the host; no runtime, schema,
permission or timeout behavior changes.

Validation: Linux admission 13/13; targeted routing 484 assertions; isolated
tooling 367 assertions; lint, boundary lint, script types, check-changed,
four real preflight manifest shapes, and P2 review passed. Broader Linux
coverage: 40/49 normal CI groups and all 17 release-only tooling files passed.
Nine groups remain unfinished after Testbox transport termination; AWS was
refused by the shared fleet cap (21/20). Use the authorized ready-PR fallback.

Refs #165377 and hourly 37382954831.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…enclaw#165377)

* perf(sessions): reuse revision-bound transcript projection status

Let the projection publication owner maintain transactional clean and pending
facts, invalidate them on local and foreign mutations, and advance bounded
orphan cleanup. Remove the recurring global status scans and pass the owner's
worklist to reconciliation.

Preserve search snapshot consistency, missing-store behavior, and committed
results across continuation retirement. Clean reads avoid write grants.

* test(sessions): isolate projection cleanup failure injection

Inject the synthetic deletion failure on the real SQLite worker connection
with a TEMP trigger, preserving storage admission and planner schema cookies.
Rename the private error constructor to avoid shadowing its exported binding.

On base 7a63692, Testbox passed
277 focused tests and four regression negative controls on the exact tree.

* fix(sessions): preserve projection and worker admission custody

Keep the legacy incognito handle fence at write execution so readiness can
observe disposal and scheduled successors remain joined to old settlement.
Narrow the memory publication consumer to the run/close contract it uses.

Capture queued worker-opening assertions in their caller context, preserving
live revocation before dispatch and native open grants. This fixes the lost
startup preparation authority exposed by the projection queue changes.

Validation: independent review is clean. The memory lifecycle and scheduling
suites pass (33 tests), as does extension typechecking. The original Gateway
shard failure and a diagnostic stack establish the queued-open defect; the
unmodified base passes. Broker regression and fixed Gateway proof are pending
Testbox sync recovery, with full validation tracked in the PR.

* fix(sessions): retain orphan cleanup and independent reconciliation requests

Clean native orphan-only projections before reporting readiness. Coalesce
requests only when they share caller authority, and separate native settlement
from the public handoff promise so a canceled successor cannot drop prior work
or create a promise cycle.

Extend the existing memory and scheduling regressions for orphan-only stores,
both cancellation arrival orders, and a canceled distinct memory successor.
Independent P0-P2 review is clean; remote runtime proof is pending source-sync
recovery and remains tracked in the draft PR.

* fix(sessions): retain actor projection maintenance status

Use the shared maintained facts to schedule store repair for dirty siblings
while keeping search hits scoped. Carry bounded preflight and sweep work
through actor reconciliation, and keep admission traversal in its existing
maintenance owner.

Preserve the reconciliation result type through cancellation settlement.

* test(gateway): retain settled writers in search scope fixture
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…65879)

2eb7cdf (openclaw#165377) validates the search reader revision after checking
index status. Releasing the status writer can close and checkpoint it
before that validation, invalidating the search's own snapshot even when
all transcript projections are complete. Real command-palette searches
then show "Indexing older messages" for an already indexed corpus.

Retain the canonical lazy execution across the hit read, status read, and
revision validation. Release it after the history read settles. Preserve
authorized read-only hits if maintenance admission fails, and keep the
existing stale-snapshot and incognito handling.

Remove the scoped-search fixture's artificial execution hold while keeping
all assertions. Extend the worker availability check to cover early writer
admission failure. The real-Gateway e2e file remains unchanged. Database
work stays in its existing workers; no schema or stored-data change.

Validation: unchanged real-Gateway file before fails, after passes with all
15 searches complete; seven scoped RPC cases and the worker safety case
pass. Type-aware/boundary lint, core types, both changed-test type graphs,
and independent P2 review pass.

Testbox-congestion exception: the lease timed out after 15 minutes queued,
before sync or execution. The authorized ready-PR fallback leaves Linux
3x e2e, owning configurations, whole architecture, and full check-changed
unrun. This real-Gateway suite is hourly-only under current CI policy.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
)

Transcript projection preflight now uses the canonical agent executor even
for clean stores. The divergent secondary-agent scenarios reached real
startup maintenance from Vitest threads, where the host-owner guard
correctly refused admission. Route the unchanged suite through the existing
isolated infrastructure forks. Keep all 13 cases and every assertion.

Production startup already runs this path on the host; no runtime, schema,
permission or timeout behavior changes.

Validation: Linux admission 13/13; targeted routing 484 assertions; isolated
tooling 367 assertions; lint, boundary lint, script types, check-changed,
four real preflight manifest shapes, and P2 review passed. Broader Linux
coverage: 40/49 normal CI groups and all 17 release-only tooling files passed.
Nine groups remain unfinished after Testbox transport termination; AWS was
refused by the shared fleet cap (21/20). Use the authorized ready-PR fallback.

Refs openclaw#165377 and hourly 37382954831.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: memory-core Extension: memory-core gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant