Repository navigation
perf: reduce collaboration and workshop SQLite bookkeeping - #169033
Conversation
Use conditional writes and committed rows for cards, membership, suggestions, reactions, and category edits. Check internal sources once inside their transaction and reuse admitted workshop schema facts. Preserve released synchronous adapters and native incognito ownership.
|
🦞👀 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. |
# Conflicts: # src/sessions/session-upstream-links.worker.ts
|
Codex review: needs maintainer review before merge. What this changesThis PR removes redundant SQLite reads and schema work from collaboration, progress-card, Goal, and Workshop operations. Example: A progress card at revision 2 is replaced with markdown "Second".
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it provides useful, maintainer-directed SQLite simplification, and review found no discrete introduced bug. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway and collaboration callers submit mutations to existing database owners, which validate authority, execute synchronous SQLite transactions, and publish committed results to session projections. flowchart TD
A[Gateway and collaboration callers] --> B[Captured store and caller authority]
B --> C[Existing writer admission]
C --> D[Transactional storage kernels]
D --> E[Agent and shared state SQLite]
E --> F[Commit receipts]
F --> G[Session projections and responses]
Technical reviewBest possible solution: Retain the existing storage owners and merge the focused simplification through the normal required gates. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the redundant metadata reads, preparatory entry pass, and repeated Workshop DDL; no target code or tests were executed during this read-only review. Is this the best way to solve the issue? The patch removes work at existing transactional owners, preserves conditional mutation predicates and live authority, and documents its intentional bookkeeping tradeoffs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f442662cabd8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -85, Tests +68, Docs +23, Other +13. Total +19 across 21 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel 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 Reviewed October 11, 2026, 5:31 AM ET / 09:31 UTC. |
|
Landed after exact-head CI passed. The native route twice confirmed a pre-dispatch refusal for Follow-up from review: add optional card/collaboration/workshop mutation scenarios to the shared SQL harness. Current focused owner tests cover their behavior, while the ordinary-chat measurements do not establish their runtime savings. The remaining 69 T1 sites still need their documented SDK/session/config owner cutovers. No concrete correctness or security finding remained. |
…169033) * perf: reduce collaboration and workshop SQLite bookkeeping Use conditional writes and committed rows for cards, membership, suggestions, reactions, and category edits. Check internal sources once inside their transaction and reuse admitted workshop schema facts. Preserve released synchronous adapters and native incognito ownership. * test: remove obsolete progress card decode expectation * fix: accept unchanged category keys in collaboration receipts
First-parent upstream fd0fc62..f4f4868 (8 commits: openclaw#169033 collaboration/workshop SQLite bookkeeping, 952c102, openclaw#155464 active turns during worker dispatch, openclaw#168995 approval/placement queries, openclaw#154286 telegram polling workers, 194a08e, openclaw#169045 code-mode catalog bytes, openclaw#159697 talk voice permissions). Conflicts: - session-sharing-store.native.ts: upstream folded the member lookup and delete into one DELETE ... RETURNING with a no-row early return; our recipient-authority advance now follows that return, so only an actual removal revokes access (same order as before the merge). - worker-access inventory: took upstream, regenerated (632 files, 2442 calls). sharing-store receipt/worker auto-merged: upstream's category plan (keys only) is disjoint from our authority.capture command. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Ordinary collaboration and progress-card operations reread rows or repeat internal source checks even when the existing writer already owns the mutation. Workshop recording also repeats schema DDL on each append.
Why This Change Was Made
Use conditional mutations with RETURNING for progress cards, membership removal, and suggestion finalization; derive reaction removal results from transaction-local rows; prepare category keys and read each current entry only in the writer. Reuse admitted workshop schema facts. Keep caller authorization and live host authority checks at real effects.
User Impact
No user action, schema migration, or public API change. Category updates preserve current unrelated entry fields and skip entries already reassigned by another in-process write.
Main-thread inventory
Owned T1 call sites: 79 → 69, across 33 → 30 files. Three primitive call sites are deleted; seven are classification corrections (five already-worker-only workshop sites and two CLI-only hook sites). This does not claim ten newly migrated runtime calls. All-tier primitive sites: 385 → 382.
The remaining 69 T1 sites require the synchronous SDK, incognito/session, or config-owner cutover. They include config health and plugin metadata, native collaboration/pending-input helpers, pairing allowlists, skill selection, ambient watches, upstream links, progress-card reset, and the cron approval-generation reader. Shared kernels remain classified T1 instead of hiding their synchronous callers. No schema, stored format, retention, permission, dependency, or SDK contract changes.
Removed checks and accepted edges
Measurement
Three alternating pairs, M,C,M,C,M,C, using the unchanged shared synthetic workload. Base
53eb3f4f0c9455debc5ac58283916d7ea85f402b; candidate95501b6c643ceeef86579832f00f2d22ab9e079d. Same Linux host, dependencies and harness; source hashes verified, MAIN/worker native observer calibration passed, and request-to-statement conservation is exact.Warm duration ratio is 1.0001; all phase ratios are below 1.5. First/warmed medians do not rise; no other phase's statement median rises. Second-session requests vary by +2, with unchanged SQL and unchanged owners. The only changed warmed request-family median is the untouched
sessionRows.sharedFacts(4.2 → 4.1 requests/turn).Attribution limit: the shared ordinary-chat workload does not exercise these optional mutation operations: their direct SQL call-site counts are zero on both revisions. The raw −0.6 warmed statement delta is background variation, not a claimed saving from this patch. The baseline itself is already below 500 on this fixed workload; this is not evidence that every production turn is below 500. MAIN remains 4.1, and this PR does not complete the T1-zero mission.
The owner-level removals below are source-counted ordinary-path deltas, with focused behavior regressions; they are not substituted for the shared-harness results above. Logical worker requests for these operations are unchanged.
Validation
All 150 focused tests in 12 owner test files pass on pre-integration head
95501b6c643c(pnpm test <focused files> --maxWorkers=1runner equivalent: 171.74s wall time / CI worker-seconds). Full remotecheck:changedpasses at92c39b5c31ab, before the final receipt predicate correction; type-aware lint, export-collision scan, Knip and both ratchets pass on that head. Madge passes. Codex autoreview: two rounds, scoped-clean (production P0–P2; obsolete-test removal P0–P1). The final receipt correction fixes the category regression exposed by the focused run. No update cell or SDK diff is applicable: no update, Doctor, migration/schema, plugin loading, service lifecycle, or SDK surface changes.LOC after integration: production +108/-193 (net −85), tests +137/-69, docs/tooling +36/-0. Total: +281/-262 across 21 files.
Integration: merged
ce5b795128e359ebebd9df80bdcfaf0258659a5ainto the branch at2f1b30688ed14d8d7fed8b57ac39a65d35f90a2f. The sole conflict was the upstream worker; the final file exactly matches main, which had already landed the same simplification and removed the redundant commit admission. That file and its kernel no longer appear in this PR. Exact integrated-head CI run 38128283864 passes, including source contracts, guards, architecture, build, and changed-test shards.Post-integration sanity pair,
ce5b795128e3→2f1b30688ed1, with source hashes and native calibration verified:The warm duration ratio is 1.0068. The +4 first-turn statements (+0.37%) are entirely in untouched transcript request families: entry-list +14/−7 across caller buckets, exact entries −1, store projection −1, target inventory −1. The +0.4 warmed requests (+0.43%) are likewise untouched transcript/resource/shared-fact work: closes +0.1, entry-read −0.1, exact-entry buckets +0.3/−0.1, target inventory +0.1, shared facts +0.1. No changed owner executes SQL in this workload. Whole-workload statements decrease by 8. This passes the attributed 0.5% turn noise floor; no PR-attributable increase or extra pair is indicated. The three-pair evidence above is retained; this single pair checks the conflict-only integration and is not presented as a three-run median.