Repository navigation
refactor(state): reduce SQLite duplication and test-only seams - #167533
Conversation
Exercise the existing FIFO, authority, completion-source and shutdown regressions through real session reads. Remove the private allocation diagnostic and execution facade, and share actor fixtures and worker reply observation. No public SDK, schema, durability or permission changes.
|
🦞👀 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. |
|
Codex review: needs maintainer review before merge. What this changesThe branch consolidates SQLite mutation bookkeeping, removes private incognito diagnostics used only by tests, and shares actor test support. Review scores
ProductKind: Refactor · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR remains useful on current main and is ready for ordinary maintainer review. No actionable introduced defect or unresolved product choice was found. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSQLite admission tracks which database facts remain valid across writes, transactions, and foreign commits. Incognito session workers serve memory-only session operations with ordered execution and accepted-work settlement. flowchart TD
A[Session requests] --> B[Incognito session owner]
B --> C[Ordered worker execution]
C --> D[Memory-only SQLite]
E[Statements and iterators] --> F[Shared mutation tracking]
D --> F
F --> G[Current database facts]
Technical reviewBest possible solution: Keep freshness and settlement under their existing owners, with lifecycle coverage exercised through real session operations. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes a behavior-preserving refactor rather than a reported product defect. Is this the best way to solve the issue? Yes: consolidating bookkeeping inside its existing owner and retiring diagnostic-only production interfaces removes duplication without creating another runtime path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ae64a98a4eb1. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -67, Tests -72. Total -139 across 23 files. Added test files: 1. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)Reviewed October 8, 2026, 11:12 PM ET / October 9, 2026, 03:12 UTC (Revision 4). |
|
Merged via squash.
|
…law#167533) * refactor(sqlite): share schema mutation bookkeeping * refactor(state): retire incognito test-only execution seam Exercise the existing FIFO, authority, completion-source and shutdown regressions through real session reads. Remove the private allocation diagnostic and execution facade, and share actor fixtures and worker reply observation. No public SDK, schema, durability or permission changes. * test(state): clarify the incognito reply observer snapshot
What Problem This Solves
SQLite schema tracking duplicated mutation bookkeeping, while incognito tests kept an otherwise unused production diagnostic command and execution facade alive.
User Impact
No user-visible behavior change. Authority, foreign-commit freshness, FIFO ordering, accepted-work settlement, schemas, durability, permissions, and released SDK contracts remain unchanged.
Why This Change Was Made
Ordinary statements and iterators now share the schema owner's mutation entry and settlement logic, and catalog rows are projected in one pass. Incognito tests exercise real session reads through the existing owner, allowing removal of the private memory diagnostic, its operation alias, and the test-only
.runfacade. Repeated actor setup, host-SQL observation, and reply interception use shared test support.Every existing test case remains. Allocation arithmetic assertions are replaced with retained-session-data checks; foreign-writer, iterator-close, live-authority, FIFO, native-loss, and exact completion-source regressions are preserved. The removed facade is absent from the released SDK actor contract.
Deslop
907 changed lines. No schema or dependency changes, compatibility aliases, new options, or new test cases.
Evidence
SQL gate passed under the campaign’s deferred-startup rule. Exact-head CI, focused behavior proof, and fresh P2 review are complete.
check:changed: the combined run found missed test-only facade callers; those were migrated and production plus all 27 core test typecheck graphs now pass. All remaining guards and targeted lint pass after correcting helper lint. The export scan still reports the inherited unusedClientVoiceToolEffectin the untouched Talk store (identical Git blob in base and candidate).pnpm check:madge-import-cycles: 0 cycles.pnpm deadcode:knip: clean file/dependency scan.git diff --check: clean.8e01625010e8268710820187f7c03af22789ae82, including 284 relevant owner/caller test cases and both changed Gateway shutdown files.Paired SQL proof
Final Testbox run 37870378770 compared baseline
4f33fe7402bf6f2d807dfec0864344a3824a4ae2with candidate8e01625010e8268710820187f7c03af22789ae82in three alternating pairs on the same isolated Linux host (Node 24.19.0; 99.50–99.87% CPU idle before runs). Candidate tree:342b6014c575269b101262496e4c6badb2e25ada.The workload and native SQL counting contract are unchanged. A task-local copy adds the existing transport census so SQL can be joined to request IDs, parents, timestamps, and callers; it records no bindings or result bodies. All six full workloads passed: 13 turns, native child, cron, compaction, 37 successful RPCs, clean shutdown, and no surviving fixture children. Calibration remains seven executed statements per thread. Raw traces conserve exactly against every phase/thread/SQL CSV.
The first-turn shift is directly linked to startup: candidate pair 2 sends
catalogrequest7899:10:task-worker:1during boot, then its explicitly parentedpluginCatalog.readhelperprocess:7994:1executes 27 statements during the first turn. The catalog owner and callers are unchanged. Excluding only those boot-origin helper statements yields first-turn samples main[2895,2899,2848], candidate[2895,2878,2902], both median 2895. Full boot+connect+first samples are main[5568,5587,5598], candidate[5594,5587,5576], both median 5587. Combined medians are computed from full-window samples, not by adding phase medians. No noise-floor exception is needed.Other positive deltas are within the attributed non-turn allowance: connect +2 is existing startup media/snapshot timing; second-session +10 is unchanged maintenance/projection/cache work; shutdown +11 is one existing projection refresh (nine row-fact statements plus two shared-fact statements), also observed on main. No scheduling owner changed. First/warmed duration ratios are 1.033/1.028; every reported phase ratio is below 1.071.
Shutdown before/after proof passed the same two selected real-close cases on both heads: appends 4.133→3.747 seconds, outbox 3.775→3.817 seconds; combined case time 7.908→7.564 seconds and invocation duration 62.57→59.69 seconds. Four unrelated cases were excluded by the same exact name filter. All task leases were stopped after local artifact verification.
Earlier measurement and tooling limitations
The loaded-Mac schema-only series did not clear its first-turn gate (3029→3142; warmed 1353.2→1349.9). A standard-observer isolated series improved first turn (2889→2879) but had a small warmed rise (1328.2→1329.6); missing request origins made attribution incomplete. The final census series was added to resolve that evidence gap, and neither earlier series is relabeled as a raw zero-increase pass.
The first isolated attempt completed its workloads but hit the inline artifact collector’s 10 MiB limit. Recovery used direct download, validated the archive and source binding locally, then stopped the lease. The final census series logged one recovered baseline plugin-lease lock-contention diagnostic; every workload completed. Raw test logs are not published.
Changed test-file CI cost
Times below sum the reported case durations; shared worker startup and shard overhead are excluded. Every listed case passed.
src/agents/sessions/session-manager-incognito.test.tssrc/gateway/server-close.agent-databases.test.tssrc/gateway/server-close.incognito-manager.test.tssrc/infra/sqlite-schema-facts.test.tssrc/state/openclaw-agent-execution-incognito.compute.test.tssrc/state/openclaw-agent-execution-incognito.creation.test.tssrc/state/openclaw-agent-execution-incognito.entry-patch.test.tssrc/state/openclaw-agent-execution-incognito.history.test.tssrc/state/openclaw-agent-execution-incognito.lifecycle.test.tssrc/state/openclaw-agent-execution-incognito.memory.test.tssrc/state/openclaw-agent-execution-incognito.outbox.test.tssrc/state/openclaw-agent-execution-incognito.pending-history.test.tssrc/state/openclaw-agent-execution-incognito.sessions.test.tssrc/state/openclaw-agent-execution-incognito.test.tsReleased SDK check at landing
Compared
v2026.10.1-beta.1(6830fe76b3db05ad59e8ff7f0f872d4e2639a1fe) with the approved head usingpnpm plugin-sdk:api:diff; the command completed successfully (report digestcd5a19f0080fc26482ccc9ef34d7ae4d73088ea70ab48c521cddac995e9f43fa). The release-wide report contains 1,187 affected exports from intervening development and no added or removed SDK entrypoints; it is not a PR-only zero-diff claim.The removed
IncognitoAgentDatabaseExecution.runfacade andAgentDatabaseIncognitoOperationsdiagnostic alias are internal: no released SDK export, documented SDK subpath, orapi.runtimecontract exposes them. Their report mentions occur only in conservative whole-module (*) declaration sections, not named exported signatures. The declaration renderer intentionally retains an entire subtree when it cannot index a declaration. Direct source checks against the release tag and current SDK/runtime barrels confirm the boundary; the existing transcript SDK adapter returns its declared context-reader contract and consumes the narrower incognito actor internally. No compatibility facade or deprecation record is needed for these private removals. The stablev2026.9.9tag predates the internal incognito execution module.