Skip to content

feat: prepare async session SDK and incognito history reads - #167952

Merged
steipete merged 9 commits into
mainfrom
dbasync/incogp04
Oct 10, 2026
Merged

steipete merged 9 commits into
mainfrom
dbasync/incogp04

Conversation

@steipete

@steipete steipete commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session plugins need asynchronous full-entry reads, and the incognito actor arm needs complete history and Memory adapters before its production cutover.

User Impact

Plugins gain getSessionEntryAsync and getSessionEntryByIdAsync on the existing openclaw/plugin-sdk/session-store-runtime subpath and runtime session object. Both return the complete public projection. Active Memory uses one request-owned parent snapshot for eligibility, fast mode, and channel context; private recall helpers stay private and never export debugging transcripts.

The synchronous SDK/runtime getSessionEntry getters retain their synchronous behavior but are now deprecated in favor of getSessionEntryAsync, with removal at the next Plugin SDK major. Custom runtime implementations must implement the two required async methods. The approved SDK budget increase is exactly three exports/callables (3,641 → 3,644 exports; 2,111 → 2,114 callables); the deprecation budget increases by exactly one (147 → 148). The third export is the canonical rethrowIncognitoSessionError helper, keeping typed-error policy shared without pulling in the broader ACP runtime. No new subpath, root barrel, object, or per-entrypoint budget is added.

Incognito activation remains inactive. Unbound incognito calls retain the native host owner and allocate no actor. No schema, stored-data, retention, permission, content-cap, or update migration is introduced, and no incognito T1 retirement is claimed. The published-driver × candidate update cell passed on landing head 74a74b76aedc; details below.

Why This Change Was Made

The existing entry/history owners supply the asynchronous SDK, managed-runtime and Memory reads. Raw delta, latest assistant, exact visible-message delta and display delta retain their distinct contracts. Reads capture their physical source before awaiting; managed reads recheck plugin lifetime, and Active Memory checks current audience authority immediately before effects. Cleanup composes the existing lifecycle owner and preserves durable siblings.

Ordinary uncached Active Memory recall previously prepared the same parent metadata three times, or four when resolving by ID. It now retains one descriptive snapshot for the request. A controlled-await regression proves that channel and fast-mode metadata remain consistent during the request and refresh on the next invocation. This is not a persistent entry cache; status cleanup still reads current state and final authority guards remain live.

SQL attribution exposed a separate inherited producer defect: Memory's DROP TABLE temp.memory_publication_input revoked the durable MAIN schema receipt. Every one of 25 repeated writer admissions in the causal diagnostic followed that TEMP cleanup and correctly responded to the falsely invalid receipt by repeating schema inspection. Those requests executed 988 statements, including 708 in warmed turns. The new SDK/by-ID/recent/latest facades executed zero times in that ordinary workload.

The correction uses the existing schema-facts owner and the same TEMP/MAIN distinction as the sibling noprobe implementation. Proven TEMP-only table creation/cleanup expires connection-local facts and advances the existing local mutation witness without revoking MAIN admission. Mixed batches, unqualified drops, MAIN DDL/version changes, rollback and reentrant MAIN writes retain their guards. A regression also proves that TEMP handling adds no nested foreign data_version probe.

Evidence

Integrated origin/main once at e69931d6e6a21b0067a9f474db50a86e9563f61e; the only textual conflict was resolved by retaining both independent registry lifetime test groups. Measured source: fe4190d230188a04f721ac4aadb008ab231cda5e.

Measured diff against that base: 41 production files, +880/−325 (1,205 changed); 16 test/support files, +854/−23; four docs, +58/−2; two tooling files, +7/−3. Total: 63 files, +1799/−353. Test helpers are counted with tests. No changelog, dependency, line-cap, or timeout-race baseline changes.

Final SQL proof: five alternating main/candidate pairs on the same Node 26.10.0 host, pinned to e69931d6e6a2 → fe4190d23018. All ten workloads completed successfully; no attempts were excluded. The final source-map builds passed (main 89.53s; candidate 363.06s). The canonical UI build regenerated the same Workboard asset references in both checkouts; no diagnostic source changes were present. The harness disabled only automatic archive creation; workload, observer and analyzers were unchanged.

All-thread statements Main median Candidate median Delta Delta % Candidate/main phase duration
Boot 3,394.0 3,405.0 +11.0 +0.32% 0.899
Connect 347.0 304.0 -43.0 -12.39% 0.882
First turn 2,678.0 2,450.0 -228.0 -8.51% 1.192
Warmed / turn (10 turns) 1,129.7 1,117.2 -12.5 -1.11% 1.157
Second session / subagent 4,570.0 4,277.0 -293.0 -6.41% 0.687
Control plane 34.0 33.0 -1.0 -2.94% 0.774
Cron 1,372.0 1,268.0 -104.0 -7.58% 0.734
Compaction 414.0 442.0 +28.0 +6.76% 1.023
Shutdown 196.0 204.0 +8.0 +4.08% 1.046
Compaction + shutdown (context) 612.0 681.0 +69.0 +11.27% 1.022
Second session through shutdown 6,659.0 6,227.0 -432.0 -6.49% 0.782

First-turn samples: main [2877, 2699, 1999, 1830, 2678]; candidate [2450, 2445, 2494, 2233, 2652]. Warmed per-turn samples: main [1107.6, 1130.6, 1129.7, 1133.7, 1093.9]; candidate [1120.0, 1136.1, 1092.4, 1117.2, 1068.4]. Both strict turn medians decrease without using the noise-floor exception. Every phase duration ratio is valid (maximum 1.192). Whole-workload median: 23,961 → 23,590 (−371 statements).

The statement gate passes: strict first/warmed medians decrease; boot is within the non-turn 2% tolerance; shutdown is within the ten-statement tolerance. Compaction is assessed with the permitted adjacent Memory indexing/settlement window from second-session work through shutdown. The narrower compaction and compaction+shutdown increases remain visible above.

Positive phase attribution Exact delta in median-defining runs Existing owner / SQL shapes
Boot +13 − 4 + 2 = +11 Initial writer admission moved from connect into boot (+13 schema/index inspection statements); unchanged Gateway config/read admission −4; worker config-machine-state reads +2
Compaction: generic Memory sync generation +7 Existing lease busy_timeout / locking mode / transaction / version write, index revision and metadata reads
Compaction: Memory origin reads +9 Existing origin/tombstone reader and its admission queries
Compaction: corpus / participant reads +12 Existing corpus inventory, canonical entry scope and participant projection
Compaction explicit post-compaction sync 0 Same foreground post-compaction operation
Shutdown +8 Retained lease release, clean-close bookkeeping and shutdown transaction/checkpoint scheduling; within the absolute non-turn tolerance

For the runs defining the compaction medians (main pair 2 and candidate pair 1), generic sync starts occur twice in main's second-session phase versus once in the candidate; compaction has zero versus one. Each has two generic starts across the full tail and one explicit post-compaction sync. Every one of the 24 positive compaction SQL/stack groups occurs in baseline traces; their combined count across the tail decreases 102 → 95. This locates existing generation work across phases rather than treating compaction's increase as a new SDK request.

Tail sums, in alternating-pair order: main [6831, 7269, 6659, 6123, 6288]; candidate [6280, 6227, 6089, 6479, 6183]; median 6659 → 6227, duration ratio 0.782. The campaign rule compares medians, so pair 4's individual increase remains recorded without changing that result. Attribution uses phase, ordered lease markers and source stacks; final uninstrumented traces do not carry an end-to-end generation/request ID for every worker corpus/origin read.

The repaired schema-refresh stack (refreshOpenClawAgentDatabaseSchema) falls from median 778 → 82 statements per workload and 308 → 0 across ten warmed turns. Its warmed samples are main [185, 431, 148, 308, 317], candidate [0, 0, 0, 40, 0]. Complete SQL × normalized stack × thread × phase counts are retained for all ten runs. No new foreign freshness probe or compensating policy cache was added.

Exact attribution of the rejected measurement and the correction

The rejected first-turn median was +50 statements; the rejected warmed median was +35 per turn. Exact decomposition uses the runs that supplied each overall median, rather than summing independently chosen per-stack medians. The table below reconciles +50 and +350 across ten warmed turns at the earlier measured head/base.

Native stack family First-turn delta Ten warmed turns delta
Writer admission: openClaimedWriter → refreshOpenClawAgentDatabaseSchema +83 +397
Session entry read worker −41 −26
Memory publication worker −6 −15
Other retained SQL/stack groups +7 +29
Joint detail not retained after the earlier aggregation +7 −35
Exact total +50 +350

Complete SQL-shape and source-site totals were retained even where the joint cross-product was not. Representative positive worker SQL shapes from that same comparison:

SQL shape First-turn delta Ten warmed turns delta
PRAGMA schema_version +7 +47
PRAGMA table_list +6 +30
MAIN table definitions from sqlite_schema +6 +30
MAIN pragma_index_list / index definitions +6 +30
MAIN pragma_index_xinfo +6 +30
MAIN trigger definitions +6 +30
schema_meta ownership/version row +5 +19

A separate non-gating diagnostic at integrated 7ddec2cacec3 joined transport request keys, sender stacks, native SQL and timestamps. All 25 repeated database.prepareWrite requests followed TEMP cleanup on the exact canonical agent DB path; each saw schemaValid=false. Twenty-three used the normal preparation path and only two requested forced re-admission. Another 350 preparations reused valid receipts correctly. Forced re-admission was therefore retained, rather than weakened.

The 25 repeated requests cost 37–40 statements each (median 40). Sender stacks identified 15 entry patches, four writable-entry preparations, two entry admissions, one deletion, two ordinary worker admissions and one queue-truncated caller. All 1,918 incognito captures were unbound. These counters establish the faulty producer and preserve attribution limits; the final uninstrumented alternating-pair results above determine gate acceptance.

Functional, review, type, SDK and build proof
Command / boundary Result Local command wall time
pnpm test extensions/active-memory/index.test.ts --maxWorkers=1 -t 'resolves thinking and fast mode' against the pre-fix implementation Negative control: both cases failed on mixed channel metadata 59.670s
pnpm test Active Memory, managed registry lifetime, SDK entry, actor history and Memory files, --maxWorkers=1 213 passed after integration and request-snapshot repair 166.703s
pnpm test src/infra/sqlite-schema-facts.test.ts --maxWorkers=1 -t 'expires local TEMP facts' against original production Negative control: four unwanted MAIN-invalidation failures 2.894s
Same TEMP cases before removing an unnecessary read-scope reset Negative control: four extra PRAGMA data_version probes 6.401s
pnpm test src/infra/sqlite-schema-facts.test.ts --maxWorkers=1 50 passed on final TEMP semantics 4.001s
pnpm test Memory publication generation/transfer/settlement files, --maxWorkers=1 27 passed 82.114s
pnpm test src/state/openclaw-agent-execution-incognito.history.test.ts src/state/openclaw-agent-execution-incognito.memory.test.ts src/plugin-sdk/session-store-runtime.async.test.ts --maxWorkers=1 67 passed on final fe4190d23018; includes real Active Memory prompt/status, actor loss, no host SQL under binding, native unbound behavior, and durable siblings 271.584s, including cold worker compilation
Core schema/admission/creation-witness/integrity suite group 120 passed, one skipped, seven inherited expectation failures described below 101.694s
pnpm tsgo:core after integration passed 17.956s
pnpm tsgo:core:test all 27 graph groups passed 563.958s
pnpm tsgo:extensions / pnpm tsgo:extensions:test passed 32.102s / 23.680s
Affected core/infra/state type checks after TEMP repair passed 13.211s / 17.585s / 20.336s
Native follow-up changed-check planner, after its size-ratchet stop all remaining commands passed, with type receipts above reused 799.160s
Scoped schema-facts lint passed 262.731s, including SDK declaration preparation
pnpm plugin-sdk:surface:check exact approved budget passes; no unauthorized shipped removals 11.732s; repeated native-plan check also passed
pnpm plugin-sdk:api:diff --base e69931d6e6a21b0067a9f474db50a86e9563f61e --head 90716cea3f83644f03f6c641e5151e3b204e09b5 digest 8d6d5fdd: three additions, 154 reachable type changes, zero direct changes/removals, no entrypoint changes 476.080s

The earlier full pnpm build passed with 96 plugins, the CLI bootstrap/lazy-import guard and 53 built control-plane modules. Final QA source-map build receipts accompany the SQL proof. Prior durable transcript/SDK/Memory sibling proof passed eight files / 123 tests; ClickClack/runtime proof passed 13 files / 203 tests. Unchanged inputs retain that proof.

Three original isolated P2 review rounds were clean. Fresh P1 reviews of the requested corrections were also scoped-clean; the final TEMP review included full schema, validation, delivery and entry-source authority context. No accepted P0/P1 finding remains. The only production change after the final Memory/type/lint receipts deleted an unnecessary TEMP-only read-scope reset; the final schema tests and fresh review cover that deletion. No public signature changed after the SDK comparison.

Tests explicitly cover metadata replacement across controlled awaits, by-ID identity and missing results, typed actor loss, raw off-path history, exact visible cursor/reset/requiredBytes/message limits, latest assistant with a trailing user, mirror receipts, private cleanup and durable sibling behavior. No private transcript is ingested into durable Memory storage.

Local wall times are not hosted CI cost. Hosted CI seconds/outcome remain pending until the pushed-head run completes. The published-driver × candidate update cell passed on landing head 74a74b76aedc; details below.

Known inherited checks and size disposition

check:changed reports growth in existing oversized owner/test files. LOC is explicitly non-gating for this assignment; no size or timeout baseline was expanded. The native planner's remaining commands passed, including formatting, all Knip scans, types, changed-file lint, SDK surface/package exports, SQLite-worker and timeout ratchets, plugin boundaries, import cycles, schema/database-first guards, Doctor contracts, pairing and webhook guards.

Seven creation-witness cases have unchanged exact-object expectations that omit transcriptPublication, added by main's 7a82a475dc23 (#167875). The test, producer and publication-type blobs match both pinned e69931d6e6a2 and the independently checked later main ffff5b214290. The producer unconditionally assigns the field before returning. These failures remain recorded; the expectations were not weakened or rerun merely for green.

pnpm db:worker-inventory:check reports a stale generated inventory on both pinned main and candidate. Current source inventories are 618 files, 2,428 → 2,429 calls; the single addition is the worker-to-worker latest-assistant wrapper. The TEMP correction adds no SQL access wrapper. No incognito T1 retirement is claimed.

Inactive completion, released sync contract and retained native paths
ID Complete under explicit binding Retained obligation
PM1 Full public async entry/by-ID projection and managed lifetime fencing Sync getter deprecation/removal at next SDK major; P12 must honor that window
PM5 One parent metadata snapshot for eligibility, fast mode and channel preparation; final audience guard Production selection remains native
PM6 Async status and typed-error propagation through recall/polling/recovery Named sync/offline contracts retained
PM7 P02 lifecycle cleanup, canonical private helper keys, no private debug export, durable sibling preservation Native private cleanup remains until P12
PM8 Memory actor/absence adapters and physical-source capture Durable ingestion, snapshot/bootstrap kernels and native selectors retained
SS5 Owner-bound recent text and latest-assistant facade Native entry/history arm retained
SS6 Distinct latest-assistant operation and existing raw delta Existing raw command reused, not charged again
F2 Exact visible cursor/reset/byte/message limits, separate from display delta Native production selection closes in P12

These IDs are closed only for inactive implementation and the explicit-binding consumer contract. P01/P02 dependency work is not charged again. Native read/hydration/stats/watermark/presence selection, Memory entry/reset/corpus selectors, snapshot/bootstrap kernels, durable ingestion guards, and named sync/offline contracts remain. Current audience/caller preparation and channel mirror source guards stay intact.

The sync full-row getter is a shipped contract: [email protected], published 2026-10-08T09:38:01.687Z, exports it from dist/plugin-sdk/session-store-runtime.d.ts:5; dist/agent-harness-runtime-R8dTs5zl.d.ts:6648 declares getSessionEntry(params: SessionStoreReadParams): SessionEntry | undefined. Tagged source v2026.9.9 (bcfc88812a35243893585dbeca87ca41b48272ca), src/plugin-sdk/session-store-runtime.ts:391, agrees. Its signature/body remain synchronous; the approved disposition is now encoded with @deprecated, a named async replacement and next-SDK-major removal. There is no Promise under the old name, blocking bridge, or full-entry authority mirror.

Landing corrections and validation

Landing head: 74a74b76aedcd4a878742e4fcdd744404891eaa3. This corrects all three actionable findings from the completed ClawSweeper review of fe4190d23018, plus the cold-history regression found in CI run 37999246325.

ClickClack retains its declared >=2026.9.9 host contract: choose the async capability when present, otherwise the released synchronous getter. An available async reader's rejection propagates without a synchronous retry. Active Memory requests orderBy: "updatedAt" through the existing async by-ID owner; default generic reads preserve exact-ID-first listing order. The opt-in includes trimmed legacy aliases and stable session-key ties. TEMP-only changes preserve MAIN admission, while revocation fixtures now execute actual MAIN DDL. Recent channel-history reads again restore cold transcripts under the retained source assertion.

Released SDK audit: both v2026.9.9 and latest available tag v2026.10.1-beta.2 retain synchronous getSessionEntry signatures; the two new async methods do not exist in those tags. The optional selection parameter extends only this PR's unreleased async API; no additional export, new environment name, schema, or migration is introduced.

Focused validation passed 329 tests in ten files / seven shards, 477.37s command wall time, covering the real durable/incognito SDK reader, generic canonical reads, Active Memory, ClickClack service, schema facts and validation custody, guarded channel history, runtime-process build graph, wrapper import inventory, and get-reply import closure. Negative controls failed on the intended older-session and missing-released-host-capability defects. Test typechecking exposed one widened fixture literal, corrected with its actual InternalSessionEntry type; all 27 core test graphs now pass, as do core and extension production/test types. Both fresh isolated P2 correction reviews are scoped-clean; the only subsequent test edit supplied that concrete fixture type, and the commit hook formatted the ClickClack table-driven test.

Measured focused suite wall times: validation-cache 45.12s, SDK/schema/guarded-history group 75.12s, canonical reads 20.69s, Active Memory 103.45s, ClickClack 87.33s, import/build graph group 13.84s, wrapper closure 55.24s. Worker compilation and transform costs are included. Current-head CI used 17,047 summed job wall seconds across 108 jobs (parallel elapsed time is lower). Targeted lint passes except the previously recorded non-gating 700-line owner-file limit in session-entry-read-runtime.ts; no limit baseline was expanded.

The earlier five alternating SQL pairs remain valid under the authorized proof-reuse rule. These corrections preserve the normal workload's emitted SQL paths; the changed optional ID-selection query is exercised directly by the focused owner regression. No SQL remeasurement was performed at landing.

Historical CI classification: TEMP revocation fixtures and cold-history preparation were PR-caused and are repaired here. The plugin-cron fallback failure (Model prompt projection must be captured before provider dispatch) originates in main's 6461c186e518 (#167938). The test and five implicated prompt/fallback source blobs are identical across the tested baseline 87d3db2aea6a, merge 3a896554d18e, and independently inspected main; this PR does not change them. Current-head CI is run 38006222773. Current-head CI completed with one inherited root failure in unchanged plugin-cron fallback code (job 114075870784) and aggregate 114077921067; there were no cancellations. Native admin evidence binds tested merge 184477ae0b2a7eef2c2c62c879b78a1f8d2bc0e8 and baseline d2643069b48d353f29db7e67993eab20330bace5.

Final SDK comparison against the pinned source base completed with digest af697948: exactly three added exports, 154 reachable type changes, zero removals or direct changes, and no entrypoint changes. The released-signature audit above remains unchanged.

The published-driver update proof passed from published [email protected] to exact candidate 74a74b76aedcd4a878742e4fcdd744404891eaa3. Full package build and integrity verification passed. The update completed in 193.871s; readiness returned 200, the updater recorded finished, the serving candidate was verified, durable history survived, and incognito history/artifacts did not survive. Full remote package/build/cell command: 698.563s; Testbox execution: 712.788s. No migration or schema bump is introduced by this PR.

Worker-cutover routing audit additionally selected src/auto-reply/reply/commands-tts.test.ts, whose real latest-history reads reach the changed reader. All 14 tests passed (433.68s including cold compilation); no new worker routing is needed. The remaining direct consumers are already worker-routed, forked, or intentionally mock this boundary.

Keep production incognito acquisition host-owned. Add complete public async entry and by-ID reads, latest-assistant history, and Memory/Active Memory consumer cutover. Preserve the released synchronous getter and the native paths reserved for activation. Initial isolated P2 review is clean; focused validation follow-ups are pending.
Capture explicit actor paths before ambient environment normalization. Use canonical reconciliation in the history fixture and migrate the required async runtime mock and ClickClack reader. Isolated P2 review is clean; remaining SDK fixture routing proof follows.
Revalidate the producer audience and abort state immediately before model invocation. The regression fails without this final check and passes with it. Share SDK entry getters through their existing internal projection owner to avoid twenty eager modules without changing public signatures. Repair host-worker fixture routing and literal types. Third isolated P2 review is clean.
@clawsweeper

clawsweeper Bot commented Oct 9, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The plugin SDK, OpenClaw’s interface for plugins, adds asynchronous session reads, prepares private history access, keeps private recall transcripts from being exported, and reduces repeated database validation.

Example: Use Active Memory in an incognito conversation with persistTranscripts enabled.

  • Before: The recall helper can export a JSONL debugging transcript.
  • After: The recall helper stays private and exports no transcript artifact.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, coherent work with repaired findings and resolved update validation, while the new SDK and inactive actor behavior remains supported mainly by harness evidence.
Proof confidence 🦐 gold shrimp (3/6) Maintainer-directed work is outside the ordinary external-contributor proof gate. The supplied real Gateway workload exercises the changed TEMP admission owner, and the exact-candidate published-driver update receipt resolves the previous update concern; inactive SDK and actor adapters retain harness coverage. No durable schema or serialized-data contract changes were found, and the update observations preserve durable history.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes
User problem: Plugin authors lack public complete asynchronous session reads, and private recall helpers can export debugging transcripts.
Reason: Recorded maintainer direction establishes value for worker-backed SDK reads and inactive private-session preparation. Existing owners absorb the capability, and the final corrections preserve established consumer behavior.

Merge readiness

✅ Ready for maintainer review

This maintainer-directed prerequisite remains useful and is not superseded by current main. Earlier findings remain repaired, and this review found no new actionable code defect.

Priority: P2
Reviewed head: 74a74b76aedcd4a878742e4fcdd744404891eaa3

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The new SDK getters and explicitly bound private-history adapters have production-code harness coverage rather than a direct shipped-entry-point demonstration; production actor activation remains intentionally inactive.
Agent review details

How this fits together

Plugins and Active Memory read session metadata and conversation history through shared storage interfaces. Those interfaces select a durable database worker or an explicitly bound private session owner and return metadata or transcript content.

flowchart TD
  A[Plugin or Active Memory] --> B[Asynchronous session reader]
  B --> C{Selected storage owner}
  C --> D[Durable database worker]
  C --> E[Bound private session actor]
  D --> F[Source and lifetime checks]
  E --> F
  F --> G[Session metadata or history]
Loading

Technical review

Best possible solution:

Retain the existing storage owners and synchronous compatibility window through the later atomic incognito cutover.

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

Not applicable as a single bug report: this PR adds an owner-directed SDK capability. The supplied correction evidence reports failing negative controls for the earlier compatibility and session-selection defects.

Is this the best way to solve the issue?

Yes: the patch extends existing worker and actor owners, preserves released-host capability selection, and separates descriptive metadata from live authority.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned introduced changes: Reviewed the merge-base-to-head delta separately from base drift. The checkout remained clean and whitespace checks passed; no target tests, builds, or review helpers were executed. (74a74b76aedc)
  • Current-main necessity: Fetched main still exports the synchronous session getter without the proposed public asynchronous getters. The related merged work supplies storage and actor prerequisites rather than replacing this PR. (src/plugin-sdk/session-store-runtime.ts:160, e39552c18106)
  • Complete proof source inspected: Read the full PR body, including previously omitted evidence. Its SHA-256 matches the captured source identity 2b53807ac52117a9be78187090dff505d15a698d515fabd3bd15b83e8ab2686c. The body records maintainer-directed SDK expansion, synchronous compatibility through the next SDK major, and inactive production actor acquisition. (74a74b76aedc)
  • Update concern resolved: The full body reports a published [email protected] update to the exact reviewed candidate: readiness returned 200, the updater recorded finished, candidate serving identity was verified, durable history survived, and private history/artifacts did not survive. The linked allocation is https://github.com/openclaw/openclaw/actions/runs/38007009935. Its cancelled Testbox lifecycle is not itself a passing update receipt; the body supplies the completed remote cell observations. Raw job logs redirect to a proxy-blocked storage host, so those logs could not be independently inspected. (74a74b76aedc)
  • Prior compatibility and selection findings repaired: ClickClack retains capability selection between the asynchronous reader and the released synchronous getter, without retrying an asynchronous rejection through synchronous storage. Active Memory requests updatedAt ordering through the existing by-ID owner, whose tests cover duplicate IDs, trimmed legacy aliases, and ties. (src/config/sessions/session-accessor.sqlite-entry-read.ts:668, 74a74b76aedc)
  • History and admission corrections retained: Recent conversation reads restore cold transcripts under the retained source assertion. Revocation fixtures now use actual MAIN DDL, while separate TEMP cases preserve MAIN admission and invalidate connection-local facts. (src/config/sessions/transcript.ts:247, 74a74b76aedc)

Likely related people:

  • Peter Steinberger: Raw commit bc6fedb adds src/infra/sqlite-schema-facts.ts:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bc6fedbe4633; files: src/infra/sqlite-schema-facts.ts)
  • Josh Lehman: Raw commit f1cab04 adds src/plugin-sdk/session-store-runtime.ts:41 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f1cab04966fa; files: src/plugin-sdk/session-store-runtime.ts)

PR surface

Source +594, Tests +918, Docs +58, Other +3. Total +1573 across 65 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 42 919 325 +594
Tests 18 981 63 +918
Docs 4 60 2 +58
Config 0 0 0 0
Generated 0 0 0 0
Other 1 6 3 +3
Total 65 1966 393 +1573

Review metrics

Metric Value Why it matters
Public SDK expansion 3 exported additions; 2 required asynchronous runtime methods Custom runtime implementations must supply the methods under the recorded maintainer direction.
Production versus tests Production +919/-325; tests and support +981/-63 Production growth supplies bounded adapters and consumer migration through existing storage owners.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is bounded session SDK and storage preparation without evidence of an urgent current core outage.
  • merge-risk: 🚨 compatibility: The accepted runtime contract requires two asynchronous methods while preserving released synchronous getters through the documented migration window.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-09T20:38:25.647Z sha aca926c :: blocked before merge. :: [P1] Preserve ClickClack reads on the declared 2026.9.9 host floor
  • reviewed 2026-10-09T21:30:03.274Z sha aca926c :: blocked before merge. :: [P1] Preserve ClickClack reads on the declared 2026.9.9 host floor | [P2] Preserve newest-session selection when resolving an ID
  • reviewed 2026-10-09T22:35:37.562Z sha fe4190d :: needs changes before merge. :: [P1] Preserve ClickClack reads on the declared 2026.9.9 host floor | [P2] Preserve newest-session selection when resolving an ID | [P2] Update revocation fixtures for the TEMP/MAIN distinction
  • reviewed 2026-10-10T00:05:14.229Z sha 74a74b7 :: needs changes before merge. :: none

Reviewed October 9, 2026, 8:23 PM ET / October 10, 2026, 00:23 UTC (Revision 5).

Keep async entry reads and typed incognito errors on the existing session-store-runtime subpath. Apply the approved exact export budgets and document removal of synchronous getters at the next SDK major.
Prepare one request-owned parent entry for eligibility, fast mode, and channel context. Preserve final audience authority and current status cleanup reads. The regression fails the previous repeated-read path across a controlled metadata change.
Keep connection-local TEMP table creation and explicit cleanup from revoking shared MAIN schema receipts. Expire local facts and native mutation witnesses while preserving same-frame data versions and existing transaction, rollback, and main-schema invalidation.
@openclaw-barnacle openclaw-barnacle Bot closed this Oct 9, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 9, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Oct 9, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Oct 9, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 9, 2026
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 9, 2026
Retain ClickClack support for released hosts, preserve Active Memory newest-session ID selection through the read owner, restore cold history before channel preparation, and exercise MAIN revocation with durable DDL. Released synchronous SDK signatures remain unchanged.
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
@steipete
steipete merged commit 320d57b into main Oct 10, 2026
184 of 187 checks passed
@steipete
steipete deleted the dbasync/incogp04 branch October 10, 2026 00:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
…#167952)

* feat: prepare async session SDK and incognito history adapters

Keep production incognito acquisition host-owned. Add complete public async entry and by-ID reads, latest-assistant history, and Memory/Active Memory consumer cutover. Preserve the released synchronous getter and the native paths reserved for activation. Initial isolated P2 review is clean; focused validation follow-ups are pending.

* fix: retain physical session owners across async read preparation

Capture explicit actor paths before ambient environment normalization. Use canonical reconciliation in the history fixture and migrate the required async runtime mock and ClickClack reader. Isolated P2 review is clean; remaining SDK fixture routing proof follows.

* fix: fence recall after asynchronous metadata preparation

Revalidate the producer audience and abort state immediately before model invocation. The regression fails without this final check and passes with it. Share SDK entry getters through their existing internal projection owner to avoid twenty eager modules without changing public signatures. Repair host-worker fixture routing and literal types. Third isolated P2 review is clean.

* style: align async session fixtures with lint rules

* feat(sdk): deprecate synchronous session entry reads

Keep async entry reads and typed incognito errors on the existing session-store-runtime subpath. Apply the approved exact export budgets and document removal of synchronous getters at the next SDK major.

* perf(active-memory): reuse parent metadata during recall

Prepare one request-owned parent entry for eligibility, fast mode, and channel context. Preserve final audience authority and current status cleanup reads. The regression fails the previous repeated-read path across a controlled metadata change.

* fix(sqlite): preserve main admission across temp scratch tables

Keep connection-local TEMP table creation and explicit cleanup from revoking shared MAIN schema receipts. Expire local facts and native mutation witnesses while preserving same-frame data versions and existing transaction, rollback, and main-schema invalidation.

* fix(sessions): preserve async adapter compatibility and history

Retain ClickClack support for released hosts, preserve Active Memory newest-session ID selection through the read owner, restore cold history before channel preparation, and exercise MAIN revocation with durable DDL. Released synchronous SDK signatures remain unchanged.
amittell added a commit to amittell/openclaw that referenced this pull request Oct 10, 2026
Conflict in src/config/sessions/transcript.ts with main's openclaw#167952
(320d57b). Main moved readRecentUserAssistantTextForSession off
synchronous main-thread reads: the session entry is now read in a worker
(withSessionEntryReadOnlyInWorker), the store path can be an incognito
actor's, every page comes from readSessionTranscriptBoundedMessageTailPageAsync,
and readRestoredSessionTranscript takes the owner's assertCurrent. This
branch had replaced the same read with a synchronous one-snapshot selection
(readSessionTranscriptConversationSnapshot) followed by async grounding.

Resolution: main's entry read, scope and assertCurrent stay as they are.
The selection keeps this branch's contract (newest entries first, each
assistant entry with the media from its own turn's earlier tool results,
at most 1,000 rows of turn and 64 references) but now runs in
selectRecentConversationRows on main's async tail-page reader, so it works
off the Gateway thread and for incognito sessions. Offsets count from the
end, so a write between pages would shift the next page onto rows already
read and could lend a later tool result to an earlier reply; each page's
projection snapshot (generation, indexed seq, boundary) must match the
first, and a mismatch restarts the read. The third read that sees a
change keeps paging, as replay did before, and returns every row with no
references, so replay redacts their managed media rather than shortening
the window. Grounding still runs after the cold-storage retry.

The synchronous readSessionTranscriptConversationSnapshot, its type, its
session-accessor re-export and its accessor test are removed; those three
accessor files are main's again. Two new regressions land rows between
pages: one write, where a reply's later tool result must not become its
provenance, and a write in each of three reads, where the last read
re-reads that tool result into the reply's turn and must still drop it
and still reach the oldest row.
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: active-memory extensions: clickclack merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: file-transfer rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant