Repository navigation
perf: reduce SQLite work during chat turns - #167263
Merged
Merged
Conversation
Merge main at cbfbdc8 while retaining the selected session execution owner. Preserve transcriptOwner alongside the consolidated sessionPreparation input. Seed the queued-reader freshness fixture through the existing synchronous writer so unrelated automatic maintenance cannot occupy its controlled race window. Preserve the original snapshot, queued-write, and event-order assertions. The original head reproduced the fixture failure in all five runs; the merge base passed all five. A diagnostic proved that consumption preceded the queued write, and the corrected fixture passed all seven tests. Production and core test types, Madge, and independent P2 review passed on the integrated tree.
Merge main at e1dbb59 after #166698 landed. Keep the selected session execution and foreground fact implementation, and its freshness-fixture correction, unchanged while incorporating the canonical TEMP generation admission fix. The integration required no conflict resolution or additional product changes. Fresh P2 review is clean; affected checks and alternating statement measurements remain required before landing.
Merge main at 0abba2b while preserving both required-worker selection and the retained session reader. Keep main's reply-input and classification helpers alongside the cohort fingerprint path. Reuse main's sessionTarget object while carrying the reader, lifecycle facts, abort check, and acknowledged initialization handoff through their existing owners. Fresh independent P2 review found no actionable defects in the integrated tree. Exact-head runtime, SDK, CI, and statement proof remain landing gates.
Merge current main into the turn-budget step-one branch without rebasing. Preserve main's native writer claim and empty-maintenance completion alongside retained session-reader authority and the extracted preparation regressions. Route the two model-selection consumers to the existing host-owned test project after main moved placement reads to the shared-state worker. The three missing-broker cases reproduce before the routing repair and pass through the normal test router afterward. Post-integration production and core test types pass; Madge reports no cycles. Fresh independent P2 review found no actionable correctness findings.
Complete the async placement-reader cutover for the mixed-inline consumer, matching the entry already landed on main. The normal threaded test project reproduces five missing-host-broker failures; the existing host-owned infra project passes all 26 cases without assertion, fixture, or runtime changes. Focused proof: pnpm test src/auto-reply/reply/directive-handling.mixed-inline.test.ts --maxWorkers=1 Wall time: 104.621 seconds. Fresh P2 review is clean.
Merge current main without rebasing. Preserve its identity-preserving publication facts and fences alongside retained cohort reads and prepared execution. Keep main's close-wedge test consolidation and migrate each retained operation to the internal batched request/result contract. Fresh P2 review is clean. Core and core-test types pass, Madge reports no cycles, and 155 focused publication, cohort, authority, close/recovery and import/wrapper tests pass (1366.158 seconds including runtime preparation).
Close session database owners before deleting native-slash fixtures. Verify compressed transcript previews without requiring expanded SQLite TEXT, while retaining zero-payload title-only reads.
Integrate the iOS manual connection initializer repair and current session owner changes. Preserve the explicit worker request boundary, admitted-connection lookup, transcript sequence tracking, and retired lifecycle-count routing alongside retained cohorts.
Retain main cold-registration joins, schema generation receipts, and request-owned command cleanup alongside the turn-budget reader. Resolve the single test helper import overlap by preserving both promise helpers and all cases.
Consume main nonblocking title-deletion coverage and compressed-payload controls. Preserve complete decoded payload checks together with per-row preview markers; retain the current retry continuation and prepared runtime behavior.
Merge main at 6fc16a8 without rebasing. Preserve restart-safe chat's physical write-target callback in the extracted writable reader, carry the retained cohort reader separately, and keep membership projection independent from participant suppression. Extend the existing cohort flow to write through the captured physical target and reject reads after release. The case passes with the target handoff and fails when that handoff is deliberately omitted. Core and core-test types, import-cycle checks, and independent P2 review pass on the merged tree. The PR-specific changes preserve public SDK signatures, schemas, stored bytes, and configuration.
Merge main at bf67191 without rebasing. Adopt main's independent 3deadc1 cleanup fix: close each fixture's agent database owners and clear retained test trust before removing its directory. Keep every existing native command and initialization assertion; this file now matches main. All 49 native-slash cases, production and core-test types, import-cycle checks, and fresh independent P2 review pass on the merged tree.
Resolve the worker-operation type imports while preserving main retained transcript reads, generation-pinned execution settlement, and asynchronous memory capture. Retain the turn-budget cohort admission changes.
Transfer the retained reader from the committed predecessor to its accepted successor using the existing same-generation handoff. Preserve reset rejection, cancellation, and release settlement in embedded and preflight compaction without adding a persisted guard read. Recognize the combined data-version freshness query in the cohort regression while retaining the exact one-probe assertion. Both compaction entry paths failed before the repair and pass afterward; focused and sibling runtime checks, type lanes, cycle checks, and P2 review passed.
Integrate main with a merge commit, preserving the read-only maintenance adoption race and the age-settlement boundary. Tool-authority snapshots now resolve the reader through their captured admission owner for each fingerprint phase. Preserve frozen classification identity, old-view revocation, and rejection after close or replacement. Real handoff regressions fail before the repair and pass afterward; focused runtime, types, cycle checks, and full P2 review passed.
Bring in the five unused test-helper export removals already fixed by f6c34cd and #167160 so the inherited full-tree export scan passes. The helper types, fixture values, and test behavior are unchanged. Co-authored-by: Shakker <[email protected]>
Contributor
|
🦞👀 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. |
Contributor
|
Preserve current main lifecycle, authority, Doctor reader, and ACP batching changes while retaining selected-session preparation and Memory execution lifetime. Resolve the parent squash and reply cleanup overlaps without rebasing. Fresh P2 review is clean; focused ACP, process graph, and schema-cache proof passes. Broader landing checks remain in progress.
Exclude the execution-retention borrow from publication-store probes so the cleanup regression faults the actual publication owner. Preserve all exact count, released-capacity, retry, and search assertions. The original fixture fails in CI and locally; the repaired file passes all eight cases. Fresh P2 review is clean.
Preserve both main runtime-target facts and auth-source presence in the existing cohort snapshot. Keep both optional request/result fields and the existing membership and bounds checks. Focused cohort tests, affected production/test types, Madge and fresh P2 review pass; existing paired SQL proof is reused.
Require the optimized zero-or-one marker query count without changing any snapshot-value or post-snapshot freshness assertion. Exact-head CI exposed the old uncached expectation; both repaired cases and the affected state test types pass. Test-only P2 review is clean. Correct the schema reference to describe the same admitted-revision reuse.
Retain prepared placement release while adopting main’s extracted settlement helper and pending-result preparation. The stable zero-context patch ID remains a63acf7003b1e7038b9b8f3111017d7dfdce210f, so existing clean P2 reviews are reused for this mechanical merge. Five focused launcher cases, affected types and Madge pass. Prior head401ef5b passed CI.
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 9, 2026
* perf(agent-db): retain selected session execution across turn phases * perf(sessions): reuse empty pending-history counts * refactor(agent-db): keep cohort scope within its reader module * refactor(agent-db): make lazy cohort imports explicit * refactor(agent-db): preserve session callback receivers * test(agent-db): route mixed model directives through the host worker Complete the async placement-reader cutover for the mixed-inline consumer, matching the entry already landed on main. The normal threaded test project reproduces five missing-host-broker failures; the existing host-owned infra project passes all 26 cases without assertion, fixture, or runtime changes. Focused proof: pnpm test src/auto-reply/reply/directive-handling.mixed-inline.test.ts --maxWorkers=1 Wall time: 104.621 seconds. Fresh P2 review is clean. * test: repair session fixture cleanup and payload assertions Close session database owners before deleting native-slash fixtures. Verify compressed transcript previews without requiring expanded SQLite TEXT, while retaining zero-payload title-only reads. * test(sessions): remove unused cohort writer import * fix(sessions): retain admitted reads across compaction successors Transfer the retained reader from the committed predecessor to its accepted successor using the existing same-generation handoff. Preserve reset rejection, cancellation, and release settlement in embedded and preflight compaction without adding a persisted guard read. Recognize the combined data-version freshness query in the cohort regression while retaining the exact one-probe assertion. Both compaction entry paths failed before the repair and pass afterward; focused and sibling runtime checks, type lanes, cycle checks, and P2 review passed. * perf(sqlite): reduce auth and warmed skill preparation envelopes * perf(agent-db): share turn preparation within admitted owners * refactor: simplify retained turn preparation lifetimes * fix(memory): preserve publication cleanup receiver * perf(auth): reuse selected owner for web search preparation * chore(agent-db): reconcile placement type import after rebase * test(state): preserve per-read schema version floors after integration * chore(test): inherit main's private fixture exports Bring in the five unused test-helper export removals already fixed by 83800a4 and openclaw#167160 so the inherited full-tree export scan passes. The helper types, fixture values, and test behavior are unchanged. Co-authored-by: Shakker <[email protected]> * test(memory): target publication cleanup failure injection Exclude the execution-retention borrow from publication-store probes so the cleanup regression faults the actual publication owner. Preserve all exact count, released-capacity, retry, and search assertions. The original fixture fails in CI and locally; the repaired file passes all eight cases. Fresh P2 review is clean. * test(state): align marker probes with snapshot caching Require the optimized zero-or-one marker query count without changing any snapshot-value or post-snapshot freshness assertion. Exact-head CI exposed the old uncached expectation; both repaired cases and the affected state test types pass. Test-only P2 review is clean. Correct the schema reference to describe the same admitted-revision reuse. --------- Co-authored-by: Shakker <[email protected]>
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #166703
Landing integration: Parent #166703 is merged. Merge commit
8b14a0b0324708ba1368bc3e6da10432f7895703integrates main8879e5ef4b98e7ff17b0ac04e7695f66f3e143b2without rebasing. Current main lifecycle, authority, Doctor-reader and ACP batching changes are preserved. The incidental overlap with reply cleanup #167236 keeps its refactoring intact. The original paired SQL, SDK, package and update evidence below remains pinned to its stated revisions; landing does not claim a new SQL measurement.What Problem This Solves
Chat turns repeat SQLite preparation for auth, policy, workspace, and placement. Accepted Memory sync can also reopen its agent database after shutdown starts retiring idle owners.
User Impact
This reduces repeated database preparation and keeps accepted Memory work attached to its existing executor through provider waits and cleanup. Chat behavior, audit and trajectory recording, placement claim/release, and live authorization remain intact. No migration or operator action is required.
Why This Change Was Made
Preparation uses Step 1's selected execution owner and typed session cohort reader. It carries explicit presence and absence facts, checks physical owner/state-root compatibility, and rechecks policy predicates after asynchronous preparation. Workspace preparation reuses known bootstrap status. Auth timeout setup uses the native constructor option; admitted schema facts stay with their handle. Schema content markers are retained independently of each caller's published version floor.
Accepted Memory sync holds a SQL-free borrow of the existing executor across provider waits, publication cleanup, and fallback lock acquisition. Concrete publication stores retain their policy and cleanup responsibilities. Integrity admission still runs when a physical database is opened. Write transactions remain synchronous, and FIFO admission and write-capable work settlement remain enforced.
The parent already contains the WAL-capability and duplicate-skill optimizations; they remain present and receive no marginal credit in this comparison.
Evidence
Candidate:
a991a9ae36814c2b8fed2287cf52af88ab3f2574. Pinned Step 1 base:1cc4c619cb5c87859661920acd1d016581acf14b. These results compare the stacked branch with its base, not current main.Six alternating pairs reduce warmed all-thread statements 1250.3→1240.1 per turn (−10.2) and independently selected request medians 239.7→237.65 (−2.05). First-turn statements decrease 3430→3423; warmed MAIN statements remain 0→0.
The campaign’s total-under-500 target remains open, and this PR does not achieve or certify the step-5 semantic allocation of 125 statements / 17 requests. The original disjoint “other” type bucket is 259.8→249.8 statements and 52.5→51.4 requests per warmed turn. Type buckets do not establish semantic owner allocation, and independently selected group medians need not sum to the total median. Earlier source comparisons are historical only and are not mixed into these six pairs.
Statement counts
Values are medians [min–max] across six runs per revision; each warmed sample is the mean of ten turns. The first three pairs had invalid shutdown/combined duration skew. Three additional alternating pairs were declared in advance; all six pairs are retained. All final phase ratios are valid (maximum 1.139). The workload is unchanged (SHA-256: 1de5109a7b89eaf8c10ef943bde724a89bd44772b7d70419bd344caf18d92cd1), on the same macOS host with Node 26.10.0. This is execution-count evidence, not an unloaded-host latency claim. All threads, helper processes, native/unassigned statements and background work remain included. Every run passes calibration, exact phase/thread/SQL conservation and warmed-request completion. Request phase is dispatch time; SQL phase is execution time. Failed native attempts are retained separately below.
First and warmed turns pass their raw strict medians; no startup/noise exception is used. Control (+3) and shutdown (+8) require the unchanged-owner attribution below. Combined control+cron decreases by 12.5 statements; compaction+shutdown rises by 3 (+0.191%). No statements are subtracted or moved between phases.
The additive warmed ledger uses the actual two middle SQL contributors on each side (base pairs 4/6; candidate pairs 6/1):
Replacement cohorts add five requests per turn; removed standalone policy/placement readers, placement discovery/projection/release and workspace preparation remove seven. Auth helpers still issue three requests per turn; no isolated auth-cohort transfer saving is claimed. The SQL-median contributor runs have a request delta of −2.3/turn; the independently selected request medians give −2.05/turn. WAL capability and duplicate-skill reuse are already in the base and receive no marginal credit.
Owner attribution and remaining diagnostics
The statement gate is accepted. Control’s +3 statements/+1 request are one existing scheduled outbound retry scan. Every SQL/native/caller tuple has an exact baseline counterpart; its unchanged scheduler runs every 5000 ms. No new median cron preparation appears: auth remains three requests; entry cohorts remain five; workspace registration falls from three to two; placement projection falls from eight to seven.
The positive cron marker reads touch the changed cache, so each median-contributing miss was checked against every version probe on its connection, including nested snapshot probes. All five candidate misses follow actual data_version handoff changes since the preceding marker read. Numeric versions and the specific writer were not captured. The evidence does not attribute these additions to a mere pinned/unpinned cache-slot replacement.
Unknown queued transport ancestry remains explicitly unknown. Exact-entry requests remain 12 in every cron run; the outlier subgroup change does not create new total requests. One extra target-inventory request in candidate pair 3 has an unknown upstream caller, but the unchanged native owner’s median remains seven. No tolerance is granted on a guessed caller.
Table abbreviations identify changed production files: schema marker = src/state/openclaw-state-db-schema-version.ts; auth cell = src/agents/auth-profiles/sqlite-json.ts; entry cohort = src/config/sessions/session-entry-cohort.worker.ts; tool preparation = src/agents/embedded-agent-runner/run/attempt-tool-prepare.ts; sandbox policy = src/agents/sandbox/runtime-status.ts; tool carrier = src/agents/tool-construction-preparation.ts; reply admission = src/auto-reply/reply/get-reply-run-admission.ts; skill snapshot = src/auto-reply/reply/session-updates.ts; placement admission/launcher = the corresponding files under src/gateway/worker-environments/. A changed frame is not itself proof of additional work.
First-turn positive SQL and request groups
Pins
1cc4c619cb5c87859661920acd1d016581acf14b→a991a9ae36814c2b8fed2287cf52af88ab3f2574; all six pairs. SQL medians use all first-turn work of the displayed type, not just its positive subgroups. Positive subgroup IDs, full native/caller/parent stacks, request worker/timestamps and exact source hashes are retained in the JSON files. Request-stack positives are included even when type totals do not rise. No raw work is reclassified out of the phase.Coverage: 326 positive SQL/native/caller-stack groups and 33 positive request/caller-stack groups across 36 types. The complete phase SQL median is 3430 → 3423 (−7), from M3/M6 and C3/C6 at weight 0.5 each. The type decomposition including negatives is in first-exact-median-types.json.
agentDatabaseDeletion.snapshot— Agent deletion journal; session registry maintenance/admissionauth-profile-rows— Auth profile read helper; agent/shared auth cellsbootstrap.prune— Device pairing bootstrap completion expirycatalog— Prepared model catalog worker and auth-source lookupchannelIngress.failedHealth— Gateway health collector; failed ingress queuechannelIngress.pressureHealth— Gateway health collector; ingress pressurecloseResource— Session transcript reader resource settlementcron.loadMutable— Cron mutable-store/receipt authority ownercron.planStartup— Cron startup plannerdeliveryQueue.countFailed— Gateway health collector; failed outbound queuedeliveryQueue.mediaRetentionSnapshot— Gateway outbound media GC retention snapshotdeliveryQueue.pruneTombstones— Gateway outbound media GC tombstone pruningdevicePairing.list— Node catalog RPC and device-pair notifier readsexec-approvals.read— Exec-default/sandbox policy preparation for skills/toolsgeneratedHtmlProvenance.list— Outbound-media GC; generated HTML provenancemanagedImages.entries— Gateway managed outgoing-media GCmentions.snapshot— Mention inbox synchronization/maintenancemodelCatalog.remote.read— Configured model-runtime remote catalog refreshopen— Admitted native database owner / scheduled WAL maintenancepluginCatalog.read— Prepared model catalog; agent plugin-model entriespluginState.entries— Plugin-state entries; health quarantine and pairing notifierpluginState.sweep— Gateway scheduled plugin-state expiry sweepplugins.catalogSnapshot.write— Hosted official external plugin catalog snapshotsession-entry-list— Session registry maintenance and cron session reapersession-exact-entries— Session exact-entry reader; queued upstream sometimes unavailablesession-pending-archives— Session pending-archive reader; upstream transport onlysession-row-facts— Session-row projection refreshsession-store-target— Session transcript store-target/reader admissionsession-target-inventory— Session store-target inventory; queued upstream sometimes unavailablesession.entry.read— Selected execution owner; foreground entry cohortssession.maintenance.read— Session reclamation write-owner read phasesessionRows.sharedFacts— Session-row projection shared ACP/placement factsskillLibrary.read— Skill-library selection during session creationunassigned— Native owner determined per SQL stack; transport sender absentuserProfiles.authority.resolve— Session-creation user-profile authorityworkers.placementProjection— Turn placement preparation/claim authorityThe new foreground cohort requests are counted replacement preparation, not unchanged background. Exact-entry reads drop while entry-cohort reads rise; no isolated auth-transfer saving is asserted. File intersection identifies changed code on a captured stack, not a causal increase. Raw first-turn SQL falls without requiring a startup/noise exception. Native unassigned work and transport-only callers remain explicitly identified, never assigned an invented upstream request.
Control/cron positive request-owner groups
Pins
1cc4c619cb5c87859661920acd1d016581acf14b→a991a9ae36814c2b8fed2287cf52af88ab3f2574; all six pairs. Every group with a positive request or SQL delta in any individual pair/phase is included, even if its median falls. SQL/request samples in JSON retain pair order 1–6. Native/caller stacks and every request key, worker and timestamp are retained. Source hashes cover every captured source file.open— Admitted native database owner / scheduled WAL maintenancecloseResource— Session transcript reader resource settlementbootstrap.prune— Device pairing bootstrap completion expirycron.loadMutable— Cron mutable-store/receipt authority ownercron.maintainHistory— Cron run-history retention maintenancedatabase.domain.publish— SessionManager transcript persistence/domain publicationdeliveryQueue.countFailed— Gateway health collector; failed outbound queuepluginState.entries— Plugin-state entries; health quarantine and pairing notifierpluginState.sweep— Gateway scheduled plugin-state expiry sweepsecrets.purge— Expired secret-store cleanupsession.maintenance.read— Session reclamation write-owner read phasesessionUpstream.listWatched— Watched session-upstream synchronizationworkerPlacements.read— Placement retirement reconciliationworktrees.findLiveByOwner— Placement orphan-result cleanup; managed-worktree registryagentDatabaseDeletion.snapshot— Agent deletion journal; session registry maintenance/admissionchannelIngress.failedHealth— Gateway health collector; failed ingress queuechannelIngress.pressureHealth— Gateway health collector; ingress pressurecron.observeRunRecovery— Cron timer; run-receipt recovery proposalsdeliveryQueue.outbound— Gateway scheduled outbound-delivery retry scandevicePairing.list— Node catalog RPC and device-pair notifier readssession-entry-list— Session registry maintenance and cron session reapersession-exact-entries (upstream unknown)— Session exact-entry reader; queued upstream sometimes unavailablesession-identity-evidence— Placement retirement reconciliation; canonical session evidencesession-maintenance-read— Session reclamation reader scopesession-row-facts— Session-row projection refreshsession-store-target— Session transcript store-target/reader admissionsession-target-inventory (upstream unknown)— Session store-target inventory; queued upstream sometimes unavailablesessionRows.sharedFacts— Session-row projection shared ACP/placement factstranscript-maintenance— Harness finalization; transcript hydration maintenanceuntyped-task— Cron read-only worker invoked by cron RPCworkerEnvironments.pruneCandidates— Placement reconciliation; terminal environment pruningworkerPlacements.changeSnapshot— Placement change-event snapshot/reconciliationworkers.placementPendingResults— Placement/publication pending-workspace reconciliationworkers.placementRecoveryCandidates— Placement-dispatch active recovery reconciliationunassigned— Native owner determined per SQL stack; transport sender absentUnknown queued upstream provenance is limited to the displayed exact-entry and target-inventory transport groups. Their native kernels are known; the caller before the task pool drained its queue is not captured. No positive median contribution comes from those unknown groups. Native unassigned SQL is split by observed native owner in a separate report.
Control/cron exhaustive positive SQL-stack groups
This supplements the request-owner table with every normalized SQL/native/caller stack that increases in any paired phase or contributes positively to an exact phase median. Positive stack contributions do not represent net added work: function changes and different owners can have offsetting negative stacks. Exact net group and phase ledgers remain authoritative.
agentDatabaseDeletion.snapshot— Agent deletion journal; session registry maintenance/admissionauth-profile-rows— Auth profile read helper; agent/shared auth cellsbootstrap.prune— Device pairing bootstrap completion expirychannelIngress.failedHealth— Gateway health collector; failed ingress queuechannelIngress.pressureHealth— Gateway health collector; ingress pressurecron.currentReceipt— Cron run-receipt live authority guardcron.loadMutable— Cron mutable-store/receipt authority ownercron.maintainHistory— Cron run-history retention maintenancecron.observeRunRecovery— Cron timer; run-receipt recovery proposalsdatabase.domain.publish— SessionManager transcript persistence/domain publicationdeliveryQueue.countFailed— Gateway health collector; failed outbound queuedeliveryQueue.outbound— Gateway scheduled outbound-delivery retry scandevicePairing.list— Node catalog RPC and device-pair notifier readshistory-page— Chat-history page and user-profile display projectionmentions.snapshot— Mention inbox synchronization/maintenanceopen— Admitted native database owner / scheduled WAL maintenancepluginState.entries— Plugin-state entries; health quarantine and pairing notifierpluginState.sweep— Gateway scheduled plugin-state expiry sweepsecrets.purge— Expired secret-store cleanupsession-entry-list— Session registry maintenance and cron session reapersession-exact-entries— Session exact-entry reader; queued upstream sometimes unavailablesession-identity-evidence— Placement retirement reconciliation; canonical session evidencesession-maintenance-read— Session reclamation reader scopesession-membership-facts— Session membership projection refreshsession-row-facts— Session-row projection refreshsession-target-inventory— Session store-target inventory; queued upstream sometimes unavailablesession.maintenance.read— Session reclamation write-owner read phasesessionRepositoryWorkspaces.find— Session deletion/cron continuation cleanup; repository-workspace lookupsessionRows.sharedFacts— Session-row projection shared ACP/placement factssessionUpstream.listWatched— Watched session-upstream synchronizationtranscript-anchors— Session transcript anchor read ownertranscript-maintenance— Harness finalization; transcript hydration maintenanceunassigned— Native owner determined per SQL stack; transport sender absentuntyped-task— Cron read-only worker invoked by cron RPCworkerEnvironments.pruneCandidates— Placement reconciliation; terminal environment pruningworkerPlacements.changeSnapshot— Placement change-event snapshot/reconciliationworkerPlacements.read— Placement retirement reconciliationworkers.placementPendingResults— Placement/publication pending-workspace reconciliationworkers.placementProjection— Turn placement preparation/claim authorityworkers.placementRecoveryCandidates— Placement-dispatch active recovery reconciliationworktrees.findLiveByOwner— Placement orphan-result cleanup; managed-worktree registryAll group signatures, SQL, candidate/baseline samples, exact median components, source stack IDs and per-run connection/request/timestamp witnesses are in cron-positive-sql-stacks.json. Concrete owners are listed above; unassigned native owners are split further in native-owner-splits.md. This table preserves stack-shape replacement positives; it does not treat them as new net preparation.
Native owner splits without a logical request
The 13 positive first-turn SQL/stack groups without a request all have the captured
releaseOpenClawStateLease→ plugin lifecycle lease → post-ready plugin-maintenance chain. The complete native/caller stacks are unchanged. They are release/transaction/busy-timeout statements; no sender request is invented. Their execution can straddle connect/first-turn.All control/cron native work is conservatively split by its last captured business-owner frame below; counts cover all native statements, not just positive subgroups. Statement/native-stack IDs and every connection/timestamp are retained in native-owner-splits.json. A changed schema-marker frame is reported even where owner counts stay equal.
at <anonymous> (src/config/sessions/session-accessor.sqlite-mutation-worker.runtime.ts)— Session reclamation and agent physical-writer admission/leaseat <anonymous> (src/gateway/server-worker-placement-startup.ts)— Placement reconciliation: publication resume/defer/read pathsat <anonymous> (src/state/openclaw-agent-db-admission.ts)— Session reclamation and agent physical-writer admission/leaseat async <anonymous> (src/config/sessions/session-accessor.sqlite-archive.worker.ts)— Session reclamation and agent physical-writer admission/leaseat async <anonymous> (src/config/sessions/session-accessor.sqlite-mutation-worker.runtime.ts)— Session reclamation and agent physical-writer admission/leaseat async <anonymous> (src/gateway/server-worker-placement-change-events.ts)— Placement change-event retirement/cleanupat async <anonymous> (src/gateway/server-worker-placement-startup.ts)— Placement reconciliation: publication resume/defer/read pathsat async executeJobCore (src/cron/service/timer-execution.ts)— Cron timer/job execution guardat async onTimer (src/cron/service/timer-scheduler.ts)— Cron timer/job execution guardat async runReclamationWorkerPort (src/config/sessions/session-accessor.sqlite-mutation-worker.runtime.ts)— Session reclamation and agent physical-writer admission/leaseat async runWithSqliteMutationWorkerCoordination (src/config/sessions/session-accessor.sqlite-worker-coordination.ts)— Session reclamation and agent physical-writer admission/leaseat async sweep (src/cron/maintenance.ts)— Cron scheduled session-registry maintenanceat claimOpenClawAgentDatabaseLease (src/state/openclaw-agent-db-lease.ts)— Session reclamation and agent physical-writer admission/leaseat executeJobCore (src/cron/service/timer-execution.ts)— Cron timer/job execution guardat maintain (src/gateway/github-oauth-lifecycle.ts)— GitHub OAuth lifecycle credential-record reconciliationat openOpenClawAgentDatabaseSteps (src/state/openclaw-agent-db.ts)— Session reclamation and agent physical-writer admission/leaseat reclaimSqliteSessionInTransaction (src/config/sessions/session-accessor.sqlite-reclamation.ts)— Session reclamation and agent physical-writer admission/leaseat resolveWorkerPlacementSessionTarget (src/gateway/server-worker-placement-session-target.ts)— Placement session target lookupat run (src/gateway/github-oauth-lifecycle.ts)— GitHub OAuth lifecycle credential-record reconciliationat runSqliteSessionDeletionTransaction.operationLabel (src/config/sessions/session-accessor.sqlite-reclamation.ts)— Session reclamation and agent physical-writer admission/leaseat withAdmission (src/config/sessions/session-accessor.sqlite-worker-admission.runtime.ts)— Session reclamation and agent physical-writer admission/leaseEvery native owner has zero median delta in this window; the aggregate native medians are 675 → 675. Candidate pair3 includes an extra publication/OAuth/cron maintenance pass, while baseline pair4 contains additional maintenance in different owners. Those samples remain in all reported medians. Native stack provenance does not supply a missing logical sender.
Compaction, shutdown, Memory lifetime and native failures
Compaction/shutdown attribution
Exact pins
1cc4c619cb5c87859661920acd1d016581acf14b→a991a9ae36814c2b8fed2287cf52af88ab3f2574; all six pairs retained. Shutdown612.5→620.5 (+8; duration ratio1.139), compaction808→774 (−34), combined1569.5→1572.5 (+3/+0.191%; duration ratio1.024). The following ledger uses the actual middle two runs, not sums of independent owner medians.Shutdown contributors: baseline pairs4+2 and candidate6+1, each weight½. Combined contributors: baseline4+3 and candidate5+3, each weight½.
Shutdown positives+16 are offset by−7.5 session-entry SQL and−0.5 placement projection SQL, giving+8. Combined positives+13.5 are offset by−10.5 across scheduled WAL, auth-helper envelopes and row projections, giving+3. All35 positive SQL shapes have baseline owner/SQL counterparts. Time-derived busy_timeout numbers are treated as arguments only for matching; original SQL literals and every raw execution remain counted.
All three Memory workspace-lock command families have identical SQL and request totals in each corresponding combined-window pair. Their shutdown increases are placement of already-counted work: compareDelete combined SQL[104,104,104,13,13,13], compareUpdate[72,72,72,9,9,9], observe[48,48,48,6,6,6] on both sides. This is direct evidence rather than a blanket timing allowance.
The positive combined marker SELECT is specifically source-reviewed:
readSqliteVersionObservationbinds the prior owner data_version twice; its next argument fingerprint changes between executions 1668 and 1671 on connection 329:7:1, after the previous content-marker execution 1664 and around marker execution 1669. Numeric versions and the committing writer were not logged and are not invented. The notifier producer is unchanged, and baseline executes the same query.Memory lifecycle: in every one of12 runs, the same native target worker opens/prepares the main agent database during first-turn and closes it once during shutdown, costing10 SQL (agent-file TRUNCATE plus shared-state lease/handle cleanup). No native reopen or prepareWrite occurs in compaction/shutdown. Each run separately opens one unique
.memory-reindex-*shadow for7 SQL and closes its actor for0 SQL. The12-versus10 figures in preliminary lifecycle totals are two PASSIVE maintenance checkpoints attributed to an already-completed first-turn open, not reopen/admission. Retention receives 0 SQL/0 request savings in all six current pairs; historical637 is not used.Fresh failed native executions: baseline[1,0,1,0,0,0], candidate[3,1,1,1,3,3]. Baseline has2 connect-phase plugin lease BEGIN lock refusals; candidate has6 such connect refusals plus2 shutdown restart-intent BEGIN refusals in each of pairs1,5,6. There are zero first-turn or warmed failures and zero failed prepares. The failure owners are byte-identical across pins. Source retries/temporary busy policies explain the path, but the failed records lack a sufficient request/connection/argument identity join to certify same-lease retry, lease closure or intent-row removal; none is claimed.
All 24 explicit Memory closes (12 canonical native owners and 12 private shadows) have successful completion acknowledgements. Those acknowledgements do not resolve the separate failed shared-state lease or restart-intent transactions. The lifetime fix is retained; the older 637-statement/three-request result is historical and receives no credit here.
Raw measurement archive SHA-256: 817cec90883970b84c89e4e928477a4cf0de26b8a42813bcfd84c09bc0584e08. All six paired traces, calibration/conservation records, source/build bindings, imported-batch provenance and detailed owner evidence are retained for this stacked PR.
Validation
--maxWorkers=1; wrapper wall time 544.84 seconds. CI seconds were not measured. These results, Madge (11.916 seconds), and standalone Knip (25.636 seconds) are reused from59a9b8222a49after exact whole-tree verification that the final head changes only five unused export modifiers in two test-helper files. Runtime code, test values, and test implementations are unchanged.check:changed --base 1cc4c619cb5c87859661920acd1d016581acf14b --head a991a9ae36814c2b8fed2287cf52af88ab3f2574 --timed: passed, including all production/test typechecks, lint, storage guards, and SQLite worker ratchet (564.214 seconds). The earlier run failed only on five inherited test-helper exports. This branch imports the exact main fixes fromf6c34cd2a5cdand fix: keep turn-model fixture internals private #167160, preserving @shakkernerd's credit, and the final full-tree export scan is clean.8460d834c1ffade1fbc63cd3cff4c3a6ffae53cf9aabefed6b3d90f025fb86fa.r6i.large(2 vCPU, 16 GiB), Node 24.21.0 and pnpm 12.5.1, through the lane proof slot.pnpm build: 467.444 seconds; canonical Docker package build: 440.456 seconds; published2026.9.8driver × candidate update: 673.036 seconds. Remote run. The update finished,/readyzreturned 200, and the connected server reported the exact candidate build ID2026.9.8-a991a9ae3681-2026-10-08T13-39-33.664Z. Driver and candidate version strings match, so serving identity is established by the build ID, not version equality. The probe was scope-limited (nooperator.read); this is not a claim of complete read-only health diagnostics. Native proof and cleanup both exited 0; the lease is released.Remote source HEAD/tree and product digest matched before and after execution. Candidate package SHA-256:
704e7c4870c84350b0d13ba4162afa81f80c5ef812f97e93d210851f0374b59b; remote evidence archive SHA-256:f1bab30fe4502b8962a4f6e57e6612e6300849d93dfe008f16e9a6956371cb48. All 111 archived evidence members matched the artifact index.Infrastructure recovery: Testbox did not admit a runner within approximately 15 minutes, so proof moved to AWS. Earlier capacity waits included 29 one-minute slot waits, a 12-minute backoff, and 13 further slot waits; the additional SQL batch waited 11 minutes. The initial 8 GiB build failed during declaration generation with
oneshot canceled; OOM was not established. An inherited build receipt documented an 11.28 GB peak, so the final run used 16 GiB and passed (full-build maximum RSS 10,495,460 KiB). The final remote slot and lease were acquired immediately; no proof lease remains active.An earlier pre-integration run failed an unchanged real-time maintenance assertion at 110.6 ms versus 100 ms. Full-suite replays on that pinned base and candidate both passed under overlapping same-host load. The current 361-test suite passed both periodic-maintenance cases. The original stall cause remains unproven; no assertion was loosened, and passing replays are not presented as a causal fix.
No schema, durability, retention-policy, permission, dependency, or protocol-version changes.
Landing validation
Integration commit
8b14a0b0324708ba1368bc3e6da10432f7895703preserves main's reply refactor, current authority/lifecycle repairs, batched auth table inspection, artifact-only Doctor readers, and ACP marker/metadata batching. The complete integrated delta received clean Codex P2 review. Main already contains the timeout-at-open optimization, so that file now matches main exactly.CI run 37844099686 found one PR-caused failure:
manager-shadow-write.test.tsintercepted the new SQL-free retention borrow as though it were a publication connection. Commit31f5cf6277e99d40370ed7fe96d753d32630b244restricts fault injection and capacity probes to concrete publication stores. No production code or assertions changed. The original file reproduced 7 passes/1 failure locally; the repaired file passes all 8 cases, and its fresh P2 review is clean. The run's other cancellations do not represent completed coverage.Post-integration proof:
onCopytype error came from an outdated local Ghostty patch; installing the unchanged merged lockfile corrected it, and the failing Gateway graph passed.openclaw-delegate-tool.exec-preparation.test.tswere zero-SQL spies observing only backgroundPRAGMA wal_checkpoint(PASSIVE)calls. The fixture, spy helper, and WAL owner are byte-identical to integration baseline8879e5ef4b98e7ff17b0ac04e7695f66f3e143b2; the fixture supplies no selected cohort reader. Policy and revocation assertions passed before those checks. These background-maintenance failures remain recorded; assertions were not weakened and no passing replay is claimed as a fix. The exact scheduling source was not separately instrumented.pnpm test extensions/memory-core/src/memory/manager-shadow-write.test.ts --maxWorkers=1, 8/8 passed, 426.35 seconds wall time on the loaded host; Vitest 384.93 seconds. The previous hosted run's eight cases totaled 20.051 seconds (the failing close case 1.391 seconds); that is prior-head CI timing, not a new-head timing claim. Formatting passes.v2026.10.1-beta.1, SDK exports andapi.runtimedeclarations. The marginal lane adds no sync/async conversion, removed export, or required argument; its reader/fact additions remain optional. The original API-diff report below is retained with its exact revision and additive type-surface caveat.OPENCLAW_*environment names are introduced.The approved alternating-pair SQL measurements are reused under the landing instructions. The conflict resolutions preserve the existing SQL paths and do not add new requests; there is no new SQL measurement or current-main performance claim.
Retained authority follow-up: the pre-existing synchronous placement checks in
src/gateway/worker-environments/worker-turn-admission.ts:128andsrc/gateway/worker-environments/worker-turn-launcher.ts:101still call the placement owner (placement-store.ts:136). They remain live checks; this PR does not substitute cached authority. Their retirement follows the documented next-Plugin-SDK-major path indocs/reference/database-schemas/worker-access.md: remove raw synchronous writers and make revocation publication complete before retiring final host reads.Local single-file lint did not reach analysis: its existing Plugin SDK declaration-build prerequisite timed out after 300000 ms on the loaded host. No lint findings were emitted; the required CI lint gate remains the authority for the repaired head. All owned local test, compiler, and lint processes have settled.
Latest integration: merge commit
d8c835febfdaca86f071e0e4b1d44a9b994d9155incorporates main33c4e4d822f70da14e3eb9e3cb87a10c672af2a5to clear a subsequent conflict. The two resolved files keep main runtime-target facts and this PR auth-source presence together in the existing cohort snapshot, with both optional request/result fields and existing bounds/membership checks. The complete integrated delta has fresh clean P2 review.session-entry-cohort.worker.test.tspasses 2/2 cases (301.76 seconds wrapper wall, 114.16 seconds Vitest); core production types and the affected config-test types pass, and Madge remains at 0 cycles. Production/test/doc delta counts remain unchanged. This is conflict-only integration; the prior paired SQL and compatible SDK/update proof are reused.Schema-fixture follow-through: CI run 37851809640 on
d8c835febfdaca86f071e0e4b1d44a9b994d9155found two old query-count expectations inopenclaw-state-db-schema-policy.test.ts. Commit401ef5b0e5fe6161480ae74f025821a995e2bbffrequires exactly 0 marker reads for a warmed explicit transaction and 1 for a fresh implicit pin. It preserves every value assertion, including visibility of the newer peer marker after each snapshot closes, and corrects the stale schema-reference sentence. Both selected cases pass (208.71 seconds command wall; 52.92 seconds Vitest), state-test types pass (22.62 seconds), and the test repair has clean P2 review. The previous hosted cases took 0.061 and 0.056 seconds; these are prior-head CI timings. The other flagged Node/type jobs completed their steps without independent failures before fail-fast cancellation. No assertions were loosened, retries added, or production code changed. Final scope: production +221, tests +772, docs +29, total +1022 across 37 files.Final launcher integration:
e2e522d89e8358b765f29e4e86ce2939baa9c0eamerges main9afa39c27b8c99f14698428a499ade1b8ec98932, preserving #167194’s extracted result-settlement helper and initial pending-result facts while retaining the prepared-placement release. The stable zero-context patch ID is unchanged (a63acf7003b1e7038b9b8f3111017d7dfdce210f), so clean reviews and unchanged proof are reused for this mechanical merge. Five selected local-placement/revocation/remote-reconciliation cases pass across two files (1159.21 seconds wrapper wall on the loaded host); affected core/Gateway test types pass and Madge reports 0 cycles. CI run 37855296437 completed successfully on predecessor401ef5b0e5fe6161480ae74f025821a995e2bbff; current-head CI remains a separate landing gate. No SQL remeasurement is claimed.Current-head gates: CI run 37859074103 completed successfully on
e2e522d89e8358b765f29e4e86ce2939baa9c0ea, with no failed jobs. The trusted security publisher reportsSUCCESSforopenclaw/ci-gate, dependency review, and security-sensitive review on that same head.