Repository navigation
feat: experimental PostgreSQL engine for the workboard store - #169214
Conversation
|
🦞👀 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 real behavior proof before merge. What this changesThis PR adds an optional experimental PostgreSQL backend for Workboard while retaining SQLite as the default. Example: A new Workboard installation selects database.engine="postgres" and schemaPrefix="team".
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this PR open: it delivers a maintainer-approved PostgreSQL pilot, but uncertain-write classification still breaks across Workboard replies. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherWorkboard tools and Gateway methods submit storage operations to a worker; the selected SQL connection persists boards, cards, attachments, and session placements and publishes cache-invalidating receipts. flowchart TD
A[Workboard tools and Gateway] --> B[Workboard store]
B --> C[Storage worker]
C --> D[Shared Workboard kernel]
D --> E[SQLite connection]
D --> F[PostgreSQL bridge worker]
F --> G[PostgreSQL schema]
F --> H[SQLite identity anchor]
Technical reviewBest possible solution: Preserve canonical uncertain-write errors through Workboard replies and verify the approved backend through upload-authority and stable-release upgrade scenarios. Do we have a high-confidence way to reproduce the issue? Source establishes the lost-marker path through Workboard's serialized error envelope; no runtime reproduction or target-code execution was performed. Is this the best way to solve the issue? The shared Workboard kernel and worker-owned PostgreSQL client fit the approved pilot, but connection-level tests do not validate error classification across the Workboard reply boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 438e06c68838. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Upload revocation across the new PostgreSQL persistence boundary remains unverified; no concrete authorization bypass was established. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +1412, Tests +1522, Docs +33, Config +3, Generated 0, Other +192. Total +3162 across 76 files. Added test files: 14. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (8 earlier review cycles)
Reviewed October 12, 2026, 4:50 AM ET / 08:50 UTC (Revision 9). |
d047283 to
46a406a
Compare
9a8c7da to
e2d3659
Compare
e2d3659 to
02be1c2
Compare
|
Keep the SQLite query-plan assertion typed to its native handle after adding the PostgreSQL connection variant.
…w#169214) Add an experimental opt-in PostgreSQL engine for the workboard pilot through the existing SQL connection and store owners. SQLite remains the default; PostgreSQL transaction outcomes invalidate the anchor receipts without replaying uncertain writes. Preserve the leaf dispatch boundary so shared SQLite modules do not import the PostgreSQL implementation. Narrow the SQLite-only query-plan test to its native handle. Refs openclaw#169254. Focused and both workboard suites passed; the final test correction passed all 32 affected-file tests and independent review. The operator-authorized CI and REST fallback disposition, including unqualified QA cases and final-head CI coverage, is recorded in the PR body.
What Problem This Solves
Adds an experimental, opt-in PostgreSQL engine for the workboard pilot, tracked in #169254. The existing workboard kernels retain one store owner through a structural SQL connection boundary; a dedicated worker owns the pinned PostgreSQL client. Kysely compiles PostgreSQL for that connection, with identity-marked string-set expressions and buffered iteration.
Configure
database.engine: "postgres",database.postgres.connection(a SecretInput DSN; prefer a SecretRef), and optionallydatabase.postgres.schemaPrefix(defaultopenclaw). The host resolves the secret and supplies it through worker input, without a DSN environment handoff or silent SQLite fallback. The default remains SQLite, so existing installations keep their engine and update behavior.The pilot refuses switching an existing populated SQLite workboard store. An existing PostgreSQL anchor opened with SQLite selected also refuses and names the schema/settings to restore. The SQLite anchor retains the store UUID, schema identity, and shared cache receipts; backups must retain it together with its PostgreSQL schema. Data porting and future PostgreSQL schema migrations remain follow-ups. PostgreSQL uses
synchronous_commit=off, matching the existing SQLite NORMAL acknowledgment tradeoff: a crash can lose recent acknowledged commits.Writers obtain host admission before the combined BEGIN/advisory-lock request. Read snapshots use REPEATABLE READ READ ONLY. Confirmed writes publish through the existing anchor receipt owner. Connection loss during COMMIT or autocommit reports outcome unknown without replaying the operation. The shared loss owner now advances the anchor token once because the write may have committed; definite mid-transaction rollback does not advance it. The regression covers both outcomes and prevents repeated failure from advancing the token again.
Rebase and review
Preserved #169430's consolidation, including both
../record-fields.jsimports, and reapplied only the engine seam. Regenerated the config-documentation checksum through its generator after resolving the newer main conflict. No workboard store design change.The coordinator's Codex autoreview was clean on
e2d365922fa3cec4e7b97efb3fd42f66d399323f. The Database access async conversion session approved the PostgreSQL branch inrunSqliteSingleStatementSync, admission before BEGIN/lock, and the zero-cost string-set marker. The follow-up repair changes the PostgreSQL dispatch boundary: a private brand and minimal interface insql-connection.tsidentify the handle, and itsrunTransactionmethod delegates to the existing PostgreSQL transaction owner. Neither shared SQLite module imports the concrete connection; SQLite also no longer imports the PostgreSQL transaction module. This cuts both PR-added cycle edges without moving unrelated worktree types. The original SQLite function bodies remain identical to current main apart from PostgreSQL dispatch/types and the two approved string-set markers.The cycle repair adds 38 net production lines, excluding tests and the wrapper inventory. It retains the
assertPostgresTransactionUsableexport rename and the PostgreSQL, SQL-connection, and database-schema wrapper entries. No re-review was requested under the delegated landing instructions.Evidence
The token regression failed for the intended reason before the fix. All focused tests and both full workboard suites run with
--maxWorkers=1. PostgreSQL uses a throwaway Homebrew PostgreSQL 17 cluster over a Unix socket; the test connection travels through the existing worker environment-data mechanism. The cluster is stopped and removed after the run. No Docker or remote lease is used.Static closure proof:
sqlite-transaction.ts static import closure (including types): postgres-sync/connection.ts ABSENT. A source-body comparison checked 36 native SQLite functions against currentorigin/main, excluding PostgreSQL dispatch and type-only substitutions; the two previously approved string-set markers remain.The workboard suite has 411 cases rather than the earlier 412 because main consolidated a two-case sessions-board in-flight-read test into one source-invalidation test. The applicable PostgreSQL count is therefore 364 cases plus 47 SQLite-only skips. The SQLite count is 400 plus 11 PostgreSQL-only skips.
The first full-suite invocation was invalidated by the harness because a type-import correction changed a source stamp during compilation; both suites were restarted on unchanged final sources. The broad lint invocation hit a plugin-SDK declaration-generation timeout. The repository's matching source-backed core lint configuration passed; no lint rule or diagnostic was suppressed. PR CI owns broad builds, types, and cross-platform suites. Exact-head CI results will be recorded before landing.
Release-note context: experimental PostgreSQL workboard support behind
database.engine; SQLite remains the default. No CHANGELOG edit (release-owned).Landing CI disposition
CI run 38224917403 was rerun once after fail-fast cancelled the first attempt. Attempt 2 completed with 133 successful jobs, 18 skipped jobs, and 11 failed jobs; no cancelled jobs remain. Both Android jobs completed successfully.
write-unified-entry-dts(5),write-plugin-sdk-entry-dts(11),dist-artifact-ownership(2),tsdown-declaration-resolution(22)control-ui-public-session-card-render.ts. The PR does not change these test files or the asset plugin.7fcf90d43680776fcd422cb5fa2592ce66514366by checking the native SQLite handle before usingprepare. All 32 tests in the affected file passed; wrapper wall time 855.91 seconds (700.38 seconds reported by Vitest). Independent review is clean; formatting and diff checks pass.session-entry-patch.authority.test.tstype errorsb82b033920ee7a4df6323e3ee2b04ac8c6037fe0. Current main replaces the unsafef.read().labelassertions; its matching type job passes in run 38226928416. The merge incorporates that existing main fix.openclaw/ci-gateThe only fix push adds the three-line SQLite test guard; production code is unchanged from the coordinator-reviewed head. The prior focused, SQLite workboard, PostgreSQL workboard, cycle, wrapper-inventory, and import-closure proof is reused. Full CI on the final fix head is not claimed green.
Native admission cannot resume because a predecessor's orphaned operation lock remains. No lock was recovered. After the native stall exceeded ten minutes, the operator-authorized, exact-head REST squash fallback was selected. This records the exception and verification gaps; it does not label unqualified QA failures as inherited.