Skip to content

perf(memory): reuse pooled origin readers - #170795

Merged
steipete merged 3 commits into
mainfrom
dbasync/connchurn
Oct 13, 2026
Merged

steipete merged 3 commits into
mainfrom
dbasync/connchurn

Conversation

@steipete

@steipete steipete commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Memory-origin and forgotten-session lookups open and close an agent database reader for each operation, repeating connection setup and discarding prepared statements.

User Impact

Memory reads reuse the existing agent reader owner and continue observing committed origin and tombstone writes. No configuration, schema, SDK surface, or update behavior changes.

Why This Change Was Made

readMemoryOriginsInWorker now borrows withOpenClawAgentDatabaseReadOnly instead of the fresh-only helper. The existing owner already handles committed-write invalidation, physical-file replacement, terminal retirement, shutdown, and idle expiry. The per-operation fresh-open/close path is removed from this consumer; no additional pool or lifetime protocol is introduced.

Removed check/lifetime operation: unconditional fresh admission/open/close per memory-origin request. Accepted edge: an idle reader remains open until the existing reader owner's expiry or lifecycle close; agent deletion and replacement still retire it.

The connection census also found a distinct credential-reader floor: sqlite-json.ts:readAuthProfileRowsReadOnly closes its child-local auth pool after reading. That pool does not bind retained handles to physical-file identity or the parent's deletion resource. Removing its close could reuse old credentials after replacement and hold Windows deletion locks. It remains unchanged. Plugin metadata discovery's fresh shared-state reads also remain with their existing owner: the synchronous discovery worker can borrow an existing cached writer, but has no retained shared-state reader when that writer is absent. Removing those opens requires connecting discovery to the shared-state reader owner; this PR does not create a second pool. All four warm plugin metadata opens came from the same discovery worker, so that remains a real follow-up.

Evidence

  • Regression: repeated origin reads retain one native reader, then observe a later committed origin and a newly committed forgotten-session tombstone. CI caught a missing authority callback in the test; corrected in 8555bbfc6a129. The failing case passed locally with pnpm test extensions/memory-core/src/memory-entry-origins.test.ts --maxWorkers=1 -t 'retains one origin reader' (1 passed, 13 skipped; 1042.81 s wall time, dominated by cold worker build/transformation on the loaded host). Final-head CI passed all 14/14 tests in 65.80 s (changed-extension test job).
  • T1 in the touched area: 0 → 0 (memory-entry-origin-reads.ts is already a registered worker module). No synchronous Gateway path is added.
  • Local oxfmt, changed-file oxlint, and git diff --check: passed. Final-head CI passed, including production/test types, lint, changed-file Knip export scan, architecture/Madge, source contracts, and database worker/dialect ratchets. The combined CI/security gate passed; security review reported no sensitive product changes.
  • Codex autoreview: scoped clean at P2; no actionable findings. The reviewer noted that full writer-receipt routing was outside its supplied context; CI covers the added integration regression.
  • One baseline/candidate live harness pair completed its measured windows. Both runs completed the first turn, ten warmed turns, second-session turn, cron, compaction, and idle minute. The child-spawn turn failed on both with the same mock-provider tool-name mismatch. Baseline shutdown exceeded the harness's 120-second timeout; candidate shutdown exited 0. The full harness did not pass; these are matched successful-window counts, not a full-workload success claim.
  • LOC: production +2/−2, regression +70, documentation +4/−2.

Connection census and measurement

Measured base: 95b3b97a4c38457f1c615ec34c7947d35e2a191f; candidate: 8555bbfc6a129 (one pair). Landing head a23e7e8b14991 merges main b4ca9a7a94c8b cleanly; the pooling implementation and regression are unchanged after measurement.

The native-open observer distinguishes actual connection constructors from PRAGMA busy_timeout. The latter is also used to change timeout on an existing connection: all 40 warm-window timeout statements in the baseline came from audit writer admission, not 40 connection opens.

Baseline warm window (10 turns, 113.245 seconds): 22 actual opens—14 auth readers (sqlite-read-pool.ts:acquireAuthProfileReadDatabase through sqlite-json.ts:readAuthProfileRowsReadOnly), 4 shared-state plugin-index readers (installed-plugin-index-row.ts:readPluginMetadataStateRowsSync), and 4 accompanying quarantine readers (openclaw-quarantine-store.ts:readPersistedQuarantineDecision). All are read-only and close after the operation. Median observed lifetimes: 8 ms, 16 ms, and 384 ms respectively; these are lifecycle observations on a loaded host, not latency comparisons.

The changed memory-origin path had two opens during first turn, one during compaction, and one during the idle minute (each with an accompanying quarantine reader), none in the ten warmed chat turns. This PR does not claim an 80% reduction across the unrelated auth/plugin owners.

Metric Baseline Candidate
Warm all-thread statements, median [min–max] 187.5 [180–221] 185 [180–193]
Warm requests, median [min–max] 52 [50–62] 52 [49–55]
Warm turn-caused statements, median [min–max] 168 [168–189] 169 [168–176]
Warm turn-caused requests, median [min–max] 40.5 [40–45] 41 [40–44]
Warm MAIN statements 0 0
First-turn statements / requests / MAIN 1170 / 194 / 40 1184 / 201 / 40
Idle-minute statements / requests / opens 130 / 40 / 8 105 / 35 / 8
Warm actual opens 22 22
Warm timeout statements 40 40

Shared families across ten warm turns (base → candidate): exact-entry facts 43 → 42, actor hydration 13 → 14, entry-cache snapshots 0 → 0, row facts 3 → 0, transcript watermark reads 11 → 10. The one extra hydration is in the unchanged session-actor writer (thread 14, session-actor-durable.ts → session-actor.worker.ts:read), which rehydrates from committed write-token changes. The changed read-only memory owner executes zero operations in either warmed window and publishes no writes or invalidations. This is scheduling variation in the independent actor owner, not a new memory-origin operation. Mean turn-caused statements/requests also fall slightly, 171.2 / 41.2 → 169.9 / 41.1, within noise; no warmed-turn performance gain is claimed.

The selected owner executes four requests in both runs. Its SQL falls 10 → 6, with the removed statements all admission reads during compaction and idle. Its physical opens fall 8 → 4 overall: first use retains two agent readers (plus their two one-time quarantine readers); subsequent compaction and idle opens fall 4 → 0. That is a 100% reduction after first use for this owner, but does not reach an 80% reduction across all background owners. Overall warm opens remain 22; idle opens remain 8 because the existing memory-search reader (manager-search.worker.ts:130) had a later first admission in the candidate. Overall first-turn opens are 66 → 64 (plugin-discovery variation). Audit timeout changes remain 40 → 40 in the warm window and vary 10 → 4 in the idle minute; they are not the pooling saving.

Per-open/admission-related counter Baseline Candidate
Origin-owner first-turn opens, agent + quarantine 4 4
Origin-owner compaction opens, agent + quarantine 2 0
Origin-owner idle-minute opens, agent + quarantine 2 0
Origin-owner SQL / requests, measured workload 10 / 4 6 / 4
Warm PRAGMA user_version 4 4
Idle-minute PRAGMA user_version 4 4

Baseline/candidate warm windows lasted 113.245 / 84.139 seconds. Warm background SQL rates were 103.85 / 117.66 statements per minute; the windows overlap different timer ticks, so these rates are descriptive, not a throughput claim. Host load was 132 at baseline start and 107 at candidate start on 32 cores; no latency claim is made.

Coordination boundaries: idlewake2 owns timer/checkpoint policy, memqueue2 owns indexing scheduling, writerbatch2 owns write transactions. This change only selects the existing memory reader owner and changes none of those policies.

Baseline first-turn, warm, and idle connection attribution
Window Owner Database Mode Opens Closed Observed lifetime median [range], ms
02.first-turn acquireAuthProfileReadDatabase (src/agents/auth-profiles/sqlite-read-pool.ts:154:10) openclaw-agent.sqlite reader 2 1 234186.5 [8–468365]
02.first-turn buildSqliteSchemaContract (src/infra/sqlite-schema-contract.ts:494:20) :memory: writer 4 4 3.0 [2–9]
02.first-turn expectedDefinitions (src/state/openclaw-agent-canonical-validation-schema.ts:115:20) :memory: writer 1 1 12 [12–12]
02.first-turn listSessionEntriesReadOnly (src/config/sessions/session-accessor.sqlite-entry-list.read.ts:159:18) openclaw-agent.sqlite reader 1 1 346937 [346937–346937]
02.first-turn listSessionEntriesReadOnly (src/config/sessions/session-accessor.sqlite-entry-list.read.ts:159:18) openclaw-quarantine.sqlite reader 1 1 18 [18–18]
02.first-turn openMemoryDatabaseReadOnlyAtPath (extensions/memory-core/src/memory/manager-db.ts:233:18) :memory: writer 1 1 6 [6–6]
02.first-turn openMemoryDatabaseReadOnlyAtPath (extensions/memory-core/src/memory/manager-db.ts:233:18) openclaw-agent.sqlite reader 1 1 355663 [355663–355663]
02.first-turn openMemoryDatabaseReadOnlyAtPath (extensions/memory-core/src/memory/manager-db.ts:233:18) openclaw-quarantine.sqlite reader 1 1 4 [4–4]
02.first-turn openOpenClawAgentDatabaseReadOnly (src/state/openclaw-agent-db-readonly-open.ts:176:10) openclaw-agent.sqlite reader 2 1 413293.5 [357451–469136]
02.first-turn openOpenClawAgentDatabaseSteps (src/state/openclaw-agent-db.ts:295:28) openclaw-quarantine.sqlite reader 1 1 2 [2–2]
02.first-turn openOpenClawAgentDatabaseSteps (src/state/openclaw-agent-db.ts:378:16) openclaw-agent.sqlite writer 1 1 338621 [338621–338621]
02.first-turn openShadowBackend (extensions/memory-core/src/memory/manager-publication.worker.ts:113:14) openclaw-agent.sqlite.memory-reindex-<id> writer 1 1 30143 [30143–30143]
02.first-turn openTrackedStateDatabaseResult (src/state/openclaw-state-db-handle.ts:61:22) openclaw.sqlite reader 1 1 24 [24–24]
02.first-turn prepareSessionMemoryEntries (src/config/sessions/session-memory-entry.worker.ts:51:5) openclaw-agent.sqlite reader 1 0 456312 [456312–456312]
02.first-turn prepareSessionMemoryEntries (src/config/sessions/session-memory-entry.worker.ts:51:5) openclaw-quarantine.sqlite reader 1 1 83 [83–83]
02.first-turn readAuthProfileRowsReadOnly (src/agents/auth-profiles/sqlite-json.ts:165:22) openclaw-agent.sqlite reader 5 5 6 [3–7]
02.first-turn readCanonicalStrictTables (src/infra/sqlite-strict.ts:132:21) :memory: writer 2 2 55.5 [41–70]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:254:20) :memory: writer 1 1 8 [8–8]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:254:20) openclaw-agent.sqlite reader 1 1 352603 [352603–352603]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:254:20) openclaw-quarantine.sqlite reader 1 1 12 [12–12]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:364:18) openclaw-agent.sqlite reader 1 1 348413 [348413–348413]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:364:18) openclaw-quarantine.sqlite reader 1 1 22 [22–22]
02.first-turn readMemoryOriginsInWorker (extensions/memory-core/src/memory-entry-origin-reads.ts:42:18) openclaw-agent.sqlite reader 2 2 136.0 [29–243]
02.first-turn readMemoryOriginsInWorker (extensions/memory-core/src/memory-entry-origin-reads.ts:42:18) openclaw-quarantine.sqlite reader 2 2 293.5 [160–427]
02.first-turn readOpenClawAgentIntegrityVerification (src/state/openclaw-quarantine-store.ts:198:16) openclaw-quarantine.sqlite reader 1 1 3 [3–3]
02.first-turn readPersistedQuarantineDecision (src/state/openclaw-quarantine-store.ts:490:20) openclaw-quarantine.sqlite reader 3 3 45 [33–387]
02.first-turn readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw-quarantine.sqlite reader 4 4 67.0 [14–333]
02.first-turn readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw.sqlite reader 4 4 71.0 [6–232]
02.first-turn readPluginModelCatalogEntries (src/agents/plugin-model-catalog.kernel.ts:33:18) :memory: writer 4 4 4.0 [1–266]
02.first-turn readPluginModelCatalogEntries (src/agents/plugin-model-catalog.kernel.ts:33:18) openclaw-agent.sqlite reader 2 2 239.5 [145–334]
02.first-turn readPluginModelCatalogEntries (src/agents/plugin-model-catalog.kernel.ts:33:18) openclaw-quarantine.sqlite reader 2 2 4.5 [4–5]
02.first-turn readSessionEntryList (src/config/sessions/session-entry-list.worker.ts:40:18) openclaw-agent.sqlite reader 1 1 289592 [289592–289592]
02.first-turn readSessionEntryList (src/config/sessions/session-entry-list.worker.ts:40:18) openclaw-quarantine.sqlite reader 1 1 708 [708–708]
02.first-turn resolveExistingAgentSessionStoreTargetsReadOnlyResult (src/config/sessions/targets-read-availability.worker.ts:249:22) openclaw-agent.sqlite reader 1 1 356853 [356853–356853]
02.first-turn resolveExistingAgentSessionStoreTargetsReadOnlyResult (src/config/sessions/targets-read-availability.worker.ts:249:22) openclaw-quarantine.sqlite reader 1 1 29 [29–29]
02.first-turn runWithSessionTranscriptReadFence (src/config/sessions/session-transcript-read-fence.ts:107:67) openclaw-agent.sqlite reader 1 0 439941 [439941–439941]
02.first-turn runWithSessionTranscriptReadFence (src/config/sessions/session-transcript-read-fence.ts:107:67) openclaw-quarantine.sqlite reader 1 1 39 [39–39]
02.first-turn sdkOpenNodeSqliteDatabase (src/plugin-sdk/sqlite-runtime-legacy.ts:27:10) openclaw-agent.sqlite.memory-reindex-<id> reader 1 1 29943 [29943–29943]
02.first-turn withHistoryDatabase (src/config/sessions/session-transcript-worker-scopes.ts:34:25) :memory: writer 1 1 9 [9–9]
02.first-turn withHistoryDatabase (src/config/sessions/session-transcript-worker-scopes.ts:34:25) openclaw-agent.sqlite reader 1 0 485117 [485117–485117]
02.first-turn withHistoryDatabase (src/config/sessions/session-transcript-worker-scopes.ts:34:25) openclaw-quarantine.sqlite reader 1 1 148 [148–148]
08.idle prepareSessionMemoryEntries (src/config/sessions/session-memory-entry.worker.ts:51:5) openclaw-agent.sqlite reader 1 0 189625 [189625–189625]
08.idle prepareSessionMemoryEntries (src/config/sessions/session-memory-entry.worker.ts:51:5) openclaw-quarantine.sqlite reader 1 1 31 [31–31]
08.idle readMemoryOriginsInWorker (extensions/memory-core/src/memory-entry-origin-reads.ts:42:18) openclaw-agent.sqlite reader 1 1 1 [1–1]
08.idle readMemoryOriginsInWorker (extensions/memory-core/src/memory-entry-origin-reads.ts:42:18) openclaw-quarantine.sqlite reader 1 1 147 [147–147]
08.idle readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw-quarantine.sqlite reader 2 2 55.0 [13–97]
08.idle readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw.sqlite reader 2 2 33.5 [12–55]
warm readAuthProfileRowsReadOnly (src/agents/auth-profiles/sqlite-json.ts:165:22) openclaw-agent.sqlite reader 14 14 8.0 [1–30]
warm readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw-quarantine.sqlite reader 4 4 384.0 [27–887]
warm readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw.sqlite reader 4 4 16.0 [5–83]

Open connections are observed until recording ends; an unclosed handle’s lifetime is a lower bound. Synthetic :memory: schema builders and the memory-reindex staging file are shown separately from retained runtime databases. Quarantine rows are admission companions of the named requesting owner.

Candidate first-turn, warm, and idle connection attribution
Window Owner Database Mode Opens Closed Observed lifetime median [range], ms
02.first-turn acquireAuthProfileReadDatabase (src/agents/auth-profiles/sqlite-read-pool.ts:154:10) openclaw-agent.sqlite reader 2 1 175953.5 [29–351878]
02.first-turn buildSqliteSchemaContract (src/infra/sqlite-schema-contract.ts:494:20) :memory: writer 4 4 35.5 [4–53]
02.first-turn expectedDefinitions (src/state/openclaw-agent-canonical-validation-schema.ts:115:20) :memory: writer 1 1 3 [3–3]
02.first-turn listSessionEntriesReadOnly (src/config/sessions/session-accessor.sqlite-entry-list.read.ts:159:18) openclaw-agent.sqlite reader 1 1 272142 [272142–272142]
02.first-turn listSessionEntriesReadOnly (src/config/sessions/session-accessor.sqlite-entry-list.read.ts:159:18) openclaw-quarantine.sqlite reader 1 1 20 [20–20]
02.first-turn openMemoryDatabaseReadOnlyAtPath (extensions/memory-core/src/memory/manager-db.ts:233:18) :memory: writer 1 1 3 [3–3]
02.first-turn openMemoryDatabaseReadOnlyAtPath (extensions/memory-core/src/memory/manager-db.ts:233:18) openclaw-agent.sqlite reader 1 1 287755 [287755–287755]
02.first-turn openMemoryDatabaseReadOnlyAtPath (extensions/memory-core/src/memory/manager-db.ts:233:18) openclaw-quarantine.sqlite reader 1 1 11 [11–11]
02.first-turn openOpenClawAgentDatabaseReadOnly (src/state/openclaw-agent-db-readonly-open.ts:176:10) openclaw-agent.sqlite reader 2 1 306432.5 [289463–323402]
02.first-turn openOpenClawAgentDatabaseSteps (src/state/openclaw-agent-db.ts:295:28) openclaw-quarantine.sqlite reader 1 1 28 [28–28]
02.first-turn openOpenClawAgentDatabaseSteps (src/state/openclaw-agent-db.ts:378:16) openclaw-agent.sqlite writer 1 1 261028 [261028–261028]
02.first-turn openShadowBackend (extensions/memory-core/src/memory/manager-publication.worker.ts:113:14) openclaw-agent.sqlite.memory-reindex-<id> writer 1 1 52264 [52264–52264]
02.first-turn openTrackedStateDatabaseResult (src/state/openclaw-state-db-handle.ts:61:22) openclaw.sqlite reader 1 1 138 [138–138]
02.first-turn prepareSessionMemoryEntries (src/config/sessions/session-memory-entry.worker.ts:51:5) openclaw-agent.sqlite reader 1 0 323533 [323533–323533]
02.first-turn prepareSessionMemoryEntries (src/config/sessions/session-memory-entry.worker.ts:51:5) openclaw-quarantine.sqlite reader 1 1 196 [196–196]
02.first-turn readAuthProfileRowsReadOnly (src/agents/auth-profiles/sqlite-json.ts:165:22) openclaw-agent.sqlite reader 5 5 5 [2–51]
02.first-turn readCanonicalStrictTables (src/infra/sqlite-strict.ts:132:21) :memory: writer 2 2 143.5 [43–244]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:254:20) :memory: writer 1 1 10 [10–10]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:254:20) openclaw-agent.sqlite reader 1 1 285456 [285456–285456]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:254:20) openclaw-quarantine.sqlite reader 1 1 43 [43–43]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:364:18) openclaw-agent.sqlite reader 1 1 277697 [277697–277697]
02.first-turn readExactSessionEntriesWithLifecycle (src/config/sessions/session-entry-read.worker.ts:364:18) openclaw-quarantine.sqlite reader 1 1 11 [11–11]
02.first-turn readMemoryOriginsInWorker (extensions/memory-core/src/memory-entry-origin-reads.ts:42:18) openclaw-agent.sqlite reader 2 0 343260.0 [343122–343398]
02.first-turn readMemoryOriginsInWorker (extensions/memory-core/src/memory-entry-origin-reads.ts:42:18) openclaw-quarantine.sqlite reader 2 2 38.0 [19–57]
02.first-turn readOpenClawAgentIntegrityVerification (src/state/openclaw-quarantine-store.ts:198:16) openclaw-quarantine.sqlite reader 1 1 21 [21–21]
02.first-turn readPersistedQuarantineDecision (src/state/openclaw-quarantine-store.ts:490:20) openclaw-quarantine.sqlite reader 3 3 101 [34–195]
02.first-turn readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw-quarantine.sqlite reader 3 3 79 [65–672]
02.first-turn readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw.sqlite reader 3 3 12 [11–13]
02.first-turn readPluginModelCatalogEntries (src/agents/plugin-model-catalog.kernel.ts:33:18) :memory: writer 4 4 15.0 [2–24]
02.first-turn readPluginModelCatalogEntries (src/agents/plugin-model-catalog.kernel.ts:33:18) openclaw-agent.sqlite reader 2 2 94.5 [25–164]
02.first-turn readPluginModelCatalogEntries (src/agents/plugin-model-catalog.kernel.ts:33:18) openclaw-quarantine.sqlite reader 2 2 23.0 [4–42]
02.first-turn readSessionEntryList (src/config/sessions/session-entry-list.worker.ts:40:18) openclaw-agent.sqlite reader 1 1 222589 [222589–222589]
02.first-turn readSessionEntryList (src/config/sessions/session-entry-list.worker.ts:40:18) openclaw-quarantine.sqlite reader 1 1 262 [262–262]
02.first-turn resolveExistingAgentSessionStoreTargetsReadOnlyResult (src/config/sessions/targets-read-availability.worker.ts:249:22) openclaw-agent.sqlite reader 1 1 290600 [290600–290600]
02.first-turn resolveExistingAgentSessionStoreTargetsReadOnlyResult (src/config/sessions/targets-read-availability.worker.ts:249:22) openclaw-quarantine.sqlite reader 1 1 46 [46–46]
02.first-turn runWithSessionTranscriptReadFence (src/config/sessions/session-transcript-read-fence.ts:107:67) openclaw-agent.sqlite reader 1 0 320339 [320339–320339]
02.first-turn runWithSessionTranscriptReadFence (src/config/sessions/session-transcript-read-fence.ts:107:67) openclaw-quarantine.sqlite reader 1 1 43 [43–43]
02.first-turn sdkOpenNodeSqliteDatabase (src/plugin-sdk/sqlite-runtime-legacy.ts:27:10) openclaw-agent.sqlite.memory-reindex-<id> reader 1 1 52417 [52417–52417]
02.first-turn withHistoryDatabase (src/config/sessions/session-transcript-worker-scopes.ts:34:25) :memory: writer 1 1 13 [13–13]
02.first-turn withHistoryDatabase (src/config/sessions/session-transcript-worker-scopes.ts:34:25) openclaw-agent.sqlite reader 1 0 375400 [375400–375400]
02.first-turn withHistoryDatabase (src/config/sessions/session-transcript-worker-scopes.ts:34:25) openclaw-quarantine.sqlite reader 1 1 206 [206–206]
08.idle openOpenClawAgentDatabaseReadOnly (src/state/openclaw-agent-db-readonly-open.ts:176:10) openclaw-agent.sqlite reader 1 0 134066 [134066–134066]
08.idle prepareSessionMemoryEntries (src/config/sessions/session-memory-entry.worker.ts:51:5) openclaw-agent.sqlite reader 1 0 112805 [112805–112805]
08.idle prepareSessionMemoryEntries (src/config/sessions/session-memory-entry.worker.ts:51:5) openclaw-quarantine.sqlite reader 1 1 35 [35–35]
08.idle readPersistedQuarantineDecision (src/state/openclaw-quarantine-store.ts:490:20) openclaw-quarantine.sqlite reader 1 1 31 [31–31]
08.idle readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw-quarantine.sqlite reader 2 2 16.5 [15–18]
08.idle readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw.sqlite reader 2 2 69.0 [9–129]
warm readAuthProfileRowsReadOnly (src/agents/auth-profiles/sqlite-json.ts:165:22) openclaw-agent.sqlite reader 14 14 8.0 [2–16]
warm readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw-quarantine.sqlite reader 4 4 43.0 [12–159]
warm readPluginMetadataStateRowsSync (src/plugins/installed-plugin-index-row.ts:63:9) openclaw.sqlite reader 4 4 12.0 [12–13]

Borrow the existing agent read-only owner for memory origins and forgotten-session membership instead of opening and closing a fresh connection per request. Preserve lifecycle retirement and verify committed origin and tombstone writes remain visible through the retained reader.
@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T08:49:53.299404Z a23e7e8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-core Extension: memory-core size: S labels Oct 13, 2026
@steipete
steipete merged commit 3b646bf into main Oct 13, 2026
107 of 108 checks passed
@steipete
steipete deleted the dbasync/connchurn branch October 13, 2026 09:00
vincentkoc added a commit that referenced this pull request Oct 13, 2026
* commit '7ae69497bec4d9c37f170f046a3cbbf954ff19a7': (6238 commits)
  refactor(ui): replace Systems filters with native menu (#170786)
  fix(browser): browser open honors timeoutMs for its opening navigation (#170053)
  refactor: deslop old Apple shared/macOS and Control UI code (#170823)
  perf(memory): reuse pooled origin readers (#170795)
  fix(crabbox): preserve project snapshots across runtime updates (#170780)
  fix: prevent chat image loading from shifting messages (#170819)
  refactor(ui): use native menus for Secret Store actions (#170663)
  fix(gateway): keep chat metadata available during model reloads (#170805)
  fix: preserve diagnostics for unresponsive state lease heartbeats (#170835)
  fix(test): prepare runtime config for corpus revision proof
  test: give credential fixtures database ownership
  perf(auth): unblock session writes during health preparation (#170807)
  fix(ci): use smaller runners for selected Gateway client tests (#170821)
  fix: use same-commit plugins in development macOS builds (#170776)
  perf(github): share cached reads across sessions and searches (#170825)
  fix(projects): keep listings stable during unrelated session changes (#170824)
  fix(update): update repair fails after Doctor completes on busy macOS hosts (#170779)
  fix(heartbeat): suppress truncated NO_REPLY finals such as NO_R (#170190)
  perf(sessions): reduce read transaction overhead (#170745)
  refactor: simplify older plugin and package lifecycles (#170800)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
Reuse the existing worker-owned agent database reader for memory origins and forgotten-session tombstones. Preserve write-receipt invalidation and reader retirement while removing repeated connection admission.

Add a regression that retains one reader and observes later committed origin and tombstone writes. The measured owner falls from eight to four total opens and eliminates all four repeat background opens; warmed-turn requests and overall opens are unchanged.
vincentkoc added a commit that referenced this pull request Oct 18, 2026
* feat(qa): report scorecard evidence gaps

Distinguish catalog coverage, recorded attempts, and qualified evidence without changing scores or release gates.

Include the canonical compatibility migration-status correction from ec1fb60.

Co-authored-by: Patrick Erichsen <[email protected]>

* chore(qa): drop compatibility backport already on main

Keep the QA evidence-gap change scoped to its 13 paths. The canonical compatibility correction ec1fb60 and later refinements are already on main; restore the six branch preimages so the merge consumes that upstream owner state.

* chore(qa): integrate canonical worker settlement fixes

* commit '7ae69497bec4d9c37f170f046a3cbbf954ff19a7': (6238 commits)
  refactor(ui): replace Systems filters with native menu (#170786)
  fix(browser): browser open honors timeoutMs for its opening navigation (#170053)
  refactor: deslop old Apple shared/macOS and Control UI code (#170823)
  perf(memory): reuse pooled origin readers (#170795)
  fix(crabbox): preserve project snapshots across runtime updates (#170780)
  fix: prevent chat image loading from shifting messages (#170819)
  refactor(ui): use native menus for Secret Store actions (#170663)
  fix(gateway): keep chat metadata available during model reloads (#170805)
  fix: preserve diagnostics for unresponsive state lease heartbeats (#170835)
  fix(test): prepare runtime config for corpus revision proof
  test: give credential fixtures database ownership
  perf(auth): unblock session writes during health preparation (#170807)
  fix(ci): use smaller runners for selected Gateway client tests (#170821)
  fix: use same-commit plugins in development macOS builds (#170776)
  perf(github): share cached reads across sessions and searches (#170825)
  fix(projects): keep listings stable during unrelated session changes (#170824)
  fix(update): update repair fails after Doctor completes on busy macOS hosts (#170779)
  fix(heartbeat): suppress truncated NO_REPLY finals such as NO_R (#170190)
  perf(sessions): reduce read transaction overhead (#170745)
  refactor: simplify older plugin and package lifecycles (#170800)
  ...

* fix(gateway): preserve safe previews and no-op bindings

Clear only the matching pending binding operation after an authoritative unchanged settlement, preserving committed and unknown invalidation fences.

Include the canonical managed-media preview correction from 47ba0ae.

Co-authored-by: Peter Steinberger <[email protected]>

* merge(main): reconcile QA reporting with frozen main

* test(gateway): verify retained route authority after binding settlement

Co-authored-by: Patrick Erichsen <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
* feat(qa): report scorecard evidence gaps

Distinguish catalog coverage, recorded attempts, and qualified evidence without changing scores or release gates.

Include the canonical compatibility migration-status correction from 3f6d26f.

Co-authored-by: Patrick Erichsen <[email protected]>

* chore(qa): drop compatibility backport already on main

Keep the QA evidence-gap change scoped to its 13 paths. The canonical compatibility correction 3f6d26f and later refinements are already on main; restore the six branch preimages so the merge consumes that upstream owner state.

* chore(qa): integrate canonical worker settlement fixes

* commit '4ae87487b6eca95ac58a2f18de0e742b240772eb': (6238 commits)
  refactor(ui): replace Systems filters with native menu (openclaw#170786)
  fix(browser): browser open honors timeoutMs for its opening navigation (openclaw#170053)
  refactor: deslop old Apple shared/macOS and Control UI code (openclaw#170823)
  perf(memory): reuse pooled origin readers (openclaw#170795)
  fix(crabbox): preserve project snapshots across runtime updates (openclaw#170780)
  fix: prevent chat image loading from shifting messages (openclaw#170819)
  refactor(ui): use native menus for Secret Store actions (openclaw#170663)
  fix(gateway): keep chat metadata available during model reloads (openclaw#170805)
  fix: preserve diagnostics for unresponsive state lease heartbeats (openclaw#170835)
  fix(test): prepare runtime config for corpus revision proof
  test: give credential fixtures database ownership
  perf(auth): unblock session writes during health preparation (openclaw#170807)
  fix(ci): use smaller runners for selected Gateway client tests (openclaw#170821)
  fix: use same-commit plugins in development macOS builds (openclaw#170776)
  perf(github): share cached reads across sessions and searches (openclaw#170825)
  fix(projects): keep listings stable during unrelated session changes (openclaw#170824)
  fix(update): update repair fails after Doctor completes on busy macOS hosts (openclaw#170779)
  fix(heartbeat): suppress truncated NO_REPLY finals such as NO_R (openclaw#170190)
  perf(sessions): reduce read transaction overhead (openclaw#170745)
  refactor: simplify older plugin and package lifecycles (openclaw#170800)
  ...

* fix(gateway): preserve safe previews and no-op bindings

Clear only the matching pending binding operation after an authoritative unchanged settlement, preserving committed and unknown invalidation fences.

Include the canonical managed-media preview correction from f3260b9.

Co-authored-by: Peter Steinberger <[email protected]>

* merge(main): reconcile QA reporting with frozen main

* test(gateway): verify retained route authority after binding settlement

Co-authored-by: Patrick Erichsen <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
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 size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant