Repository navigation
fix(boards): publish widgets with PostgreSQL storage - #189564
Conversation
Co-authored-by: galiniliev <[email protected]>
Worked on by: - @galiniliev Co-authored-by: galiniliev <[email protected]> OpenClaw-Publication: d477bd91-3dea-4845-9f8d-1aceed406b57
|
🦞👀 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 changesPublish durable Board mutations through the existing V2 worker API instead of borrowing a Gateway-thread database connection. Example: Create and update the HTML widget duration using PostgreSQL-backed agent storage.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs a current PostgreSQL Board publication failure. The prior finding is fixed, and no new actionable code defect was found; required CI remains blocked by an unattributed session-reader failure. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway Board requests pass session and source checks into the agent writer queue; the storage worker commits mutations and returns snapshots and invalidation notifications. flowchart LR
A[Gateway Board request] --> B[Session and source checks]
B --> C[Agent writer queue]
C --> D[V2 worker publication]
D --> E[Board mutation kernel]
E --> F[Selected database engine]
E --> G[Snapshot and change notifications]
Technical reviewBest possible solution: Retain the existing V2 worker repair and resolve the required-check disposition before landing. Do we have a high-confidence way to reproduce the issue? Current main reaches a host database borrow that PostgreSQL rejects, and the supplied baseline production-class run reports the matching failure; this read-only review executed no target code. Is this the best way to solve the issue? Reusing the existing V2 publication owner is the smallest complete fix because it removes the incompatible native borrow while preserving queueing, session identity, authority, and settlement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 27b1717849b0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -11, Tests +94, Other +1. Total +84 across 6 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 HistoryReview history (1 earlier review cycle)
Reviewed October 31, 2026, 3:32 PM ET / 19:32 UTC (Revision 2). |
Document the intentionally synthetic worker-publication boundary, prune its obsolete mock fingerprint, and account for the annotation line. Co-authored-by: galiniliev <[email protected]>
Worked on by: - @galiniliev Co-authored-by: galiniliev <[email protected]> OpenClaw-Publication: 7b09028-9495-4628-b9e3-38da7adc4a62
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
/refresh-security-review 3206710 |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* fix(boards): publish widgets with PostgreSQL storage Co-authored-by: galiniliev <[email protected]> * fix(boards): publish widgets with PostgreSQL storage Worked on by: - @galiniliev Co-authored-by: galiniliev <[email protected]> OpenClaw-Publication: d477bd91-3dea-4845-9f8d-1aceed406b57 * test(boards): declare outcome mock isolation Document the intentionally synthetic worker-publication boundary, prune its obsolete mock fingerprint, and account for the annotation line. Co-authored-by: galiniliev <[email protected]> * Publish openclaw/pg-board-publication Worked on by: - @galiniliev Co-authored-by: galiniliev <[email protected]> OpenClaw-Publication: 7b09028-9495-4628-b9e3-38da7adc4a62 --------- Co-authored-by: galiniliev <[email protected]>
Backport accepted fixes onto 2026.11.5-beta.2. Base: bc061f9 Canonical source tree before commit: e6c0c39 These are adapted/squashed backports; do not claim each is an exact Git cherry-pick. Source provenance (selected verified commits; other cohorts use their frozen patch/adoption manifests): runtime-B: b20a0cc fix(macos): connect with configured credentials despite stale app environment (#191468) c4c0942 fix(update): failed updates from 10.7–10.9 crash in automatic migration recovery (#189713) 6aae408 fix(update): preserve recovery errors and async triage callbacks (#191495) 8910654 fix(macos): prevent first-launch Gateway failures after upgrades (#191436) 00b2ff4 fix: parent sessions miss child approvals with a custom session store (#189827) c6142a8 fix: avoid copying managed plugin binaries during Gateway startup (#187865) e72b356 fix(anthropic): avoid token profile collisions (#187875) 807075d fix(anthropic): set API workspace at login (#186976) bafe92f fix(exec): preserve no-timeout results from macOS app nodes (#190729) 9b05a64 fix(imessage): use a PostgreSQL-safe recovery cursor key (#184919) 6ba197f fix: session search on PostgreSQL scans every transcript row instead of using the text index (#187909) 4f49aa5 fix(sessions): PostgreSQL session search scans every transcript row again after the 5th search on a connection (#188979) de3936c fix(macos): Mac tab shows a blank or stale page when a load fails (#185432) e977080 fix(macos): prevent duplicate voice sends and false sent feedback (#186271) provider-compaction: 1b43c2e fix(compaction): preserve active request provenance (#180214) 7b0cfe3 fix(google): restore tool calls with Python keyword parameters (#191561) 9039ceb fix(ci): keep compaction attribution helpers internal d6a1327 feat(google): use the Interactions API for Gemini Flash models (#189395) fe0f8d1 fix(google): Gemini models ignore configured topP (#190695) history: c51d733 fix(sessions): stop expanding archive reads from exhausting memory (#190690) 3c8bd4d fix(sessions): page oversized earlier history instead of failing at 8 MiB (#188450) b195f61 fix(sessions): page oversized transcript history in both directions (#188483) b65482e fix(gateway): preserve older history across hidden message gaps (#188557) 3d4fc94 fix(sessions): avoid oversized listing and imported-history reads (#189284) 33e7baf fix(sessions): bound active accounting without blocking writers (#190182) 682ade7 fix: preserve chat history continuation metadata (#188612) runtime-C: 7e005b0 fix(macos): keep secrets when a Gateway config save fails (#187734) 15cf738 fix(macos): keep Gateway auth when Tailscale exposure is turned off (#187664) b53a06b perf(update): read candidate state inventory without copying the shared database (#187921) 970fc4e fix: restore CLI message sends with agent tool policies (#188058) 73ad731 fix: stop model fallback when session capability metadata changes (#179312) 32305db fix: subagent turns fail after session metadata changes (#183501) d13bd0f fix(codex): include relay conversation instructions in trajectory (#189005) e375530 fix: replies after a plugin reload from Control UI go to the session's last external chat (#190982) 9346376 fix: reasoning-only retry is refused by Anthropic as reasoning_extraction (#184434) direct-auth-state: 1b15408 fix(models): keep the model list when one plugin-owned provider lacks a credential (#189014) 7d8dc60 fix: recover startup migration with retained worker index (#189023) capacity: 41772e3 fix(worktrees): settle completed disk debt on refused postchecks (#188727) command-once-189369: 8269137 fix(plugins): plugin commands that continue the agent run three times on native command turns (#189369) pg-board-189564: 7232a8d fix(boards): publish widgets with PostgreSQL storage (#189564) queued-edit-189869: 92b32ca fix: hold queued messages through inline edits (#189869) Preserve source attribution from original commits. For a genuinely exact individual pick only, use the conventional (cherry picked from commit <sha>) line. Full file-level provenance: coverage-manifest.json; reviewed patch hashes: artifact-registry.json. No held136/native82 content adopted by this work. No release or full-candidate qualification claim. Additional original-source identities (exact adapted hunk scope is in frozen artifacts): release-guides-185258: 39c37e6 docs(release): define ledger-first hotfix routing (#185258) UI-history: 10a6e4f fix(ui): scope provider-add discovery warning to its own provider (#188541), 3d7b4c4 fix(ui): never fail loading earlier chat history without a boundary (#188372) obsolete-cache-188203: 90d82c2 fix: preserve completed reasoning and refill chat snapshots (#188203) webhook-169778: b1f643f fix(startup): keep webhook decisions startup recorded for channels Doctor left pending (#169778) schema-lease-188391: ba6cfcd fix(state): keep lease renewal independent of parent admission (#188391) backfill-188976: c75a8a8 fix(gateway): stop session row backfill once the Gateway is closing (#188976) canonical-disable-188846: 88b56ee fix(config): auto-enable reads and writes mixed-case plugin policy under the canonical id (#188846) matrix-177272: 5a6d22c fix(matrix): stop seeding new thread sessions from the room transcript (#177272) provider-hook-189059: 0588f51 fix(models): isolate every per-provider catalog failure (#189059) unicode-189868: 87396e7 fix(oc-path): avoid reading and editing a different Unicode key (#189868) replay-cohort: 2031044 fix(sessions): acknowledge committed input retries without duplicate turns (#188527), 9114431 fix: resume configured fallback after interrupted attempts (#188672) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes: Board widget publication fails when agent storage uses PostgreSQL because the write path tries to open a database connection on the Gateway main thread.
User Impact
HTML widgets and native session reports can be created, updated, and reopened with PostgreSQL-backed agent storage. SQLite and incognito behavior remain covered. No schema migration or configuration change is required.
Why This Change Was Made
Use the existing worker-owned V2 publication capability instead of borrowing a host database handle. Preserve current target/source checks, admitted-write completion, committed and unknown-outcome invalidation, and cleanup handling.
Port of Galin Iliev's original fix, adapted to current main's fixture split and read-admission changes. Co-authored with @galiniliev.
Evidence
Current published head:
3206710d8f3d4902e26dc53be7b6011dcbc4416b.SqliteBoardStoreclass fromf1c93577085244aa96aa87b53a2df9b59d293bd7, with only relative import URLs relocated into a task-local proof module, successfully read an empty snapshot from isolated PostgreSQL 17.11, then failed atputWidgetwith “PostgreSQL connections must run in a worker.” No database owner or admission boundary was mocked. This is a production-class reproduction, not a claim that the committed Vitest test ran red on the base.dist/index.jscompleted authenticated WebSocketsessions.create,board.widget.putfor HTML creation and update,board.widget.putfor a native session report, and an independentboard.get. Board revisions were 1 → 2 → 3, and the read returned revision 3 with both widgets and the report props. An independent PostgreSQL query confirmed the two committed rows, HTML widget revision 2, and the updated HTML bytes rather than the original text. 1 test passed; command exit 0; fixture cleanup completed. No Gateway handler, database owner, or request authority was mocked.prepare-vitest-runtime.mjs --require-current-head --with-ai-packagepreparation completed successfully. Both build stamps reported the current head and clean inputs. The live Gateway hello reported build2026.10.9-3206710d8f3d-2026-10-31T18-52-15.775Z; its actual executable was the pinned OpenClaw Bun fork. Entrypoint SHA-256:155c2b503eb8745655a881eee2c7d120f8fbd2ba95be2968fc754f8679cc2cb2.git diff --checkpassed. After the mechanical repair, the strict mock-export ratchet, focused outcome-test lint, and test-line budget passed again.Review and CI Disposition
f1c93577085244aa96aa87b53a2df9b59d293bd7and the complete candidate committed unchanged ase4c6bdb7eae5bf1c77dca506a2ebb01acbb5df84: scoped-clean, no accepted/actionable findings; final source verification completed. The reviewer assessed code and owner contracts; runtime evidence was obtained separately. Local ClawSweeper was unavailable, so the documented hosted fallback is used.48ec70a24910456992cb98f642abc2b54d6b2bc5documents its deliberate outcome/close-failure isolation immediately above the mock, prunes the obsolete fingerprint, and adds exactly one allocation line. No replacement baseline exception or executable test/production change was introduced. The existing independent code review and runtime tests are reused for this mechanical repair. The current-head baseline-ratchet CI job passed.3317467359b31be71a2a4687b5f6a3bea5fc44c8has ordered parents maina8d7e641984c0dc9e53c616c64747b66c0dab9c5and this PR head. Eleven relevant source/dependency input trees match between that baseline and tested merge. Six scoped base/merge controls passed but did not reproduce the original failure; those passes alone are not an exemption.github_pendingpreparation completed without pushing or changing source, retainingtests.result: failand the exact failed attempt. Landing still requires protected verification of the inherited-failure evidence, live writer capability, required reviews, and security. No CI rerun or merge was performed for this preparation.3206710d8f3d4902e26dc53be7b6011dcbc4416b, with no actionable findings. It accepted the shipped Gateway proof and explicitly retained the then-unresolved CI disposition. This is not a claim of all-green CI.Commands, proof costs, and retained artifact identities
Storage run:
node scripts/test-database-conformance.mjs --engine postgres --connection <isolated-local-dsn> -- src/infra/database-engine/board-publication.postgres.test.ts src/boards/sqlite-board-store.outcomes.test.ts src/boards/sqlite-board-store.worker.test.ts src/boards/board-store.test.ts src/boards/session-actor-board-store.test.ts --maxWorkers=1The combined storage harness completed in 1653.60 seconds, including cold compilation and final artifact verification. Touched-file case totals: outcomes 10.453 seconds / 5 cases; worker 91.814 seconds / 22 cases; PostgreSQL 40.801 seconds / 1 case.
Gateway proof used a task-local selection of the canonical E2E config and the real
createOpenClawTestInstance/GatewayClientowners:OPENCLAW_E2E_USE_PREBUILT_DIST=1 OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=600000 node scripts/run-vitest.mjs run --config .openclaw/tmp/gateway-proof/vitest.config.ts --configLoader runner --maxWorkers=1The prebuilt contract was selected only after successful exact-head preparation. The bounded no-output watchdog was extended for observed active cold compilation; Gateway startup remained bounded at 120 seconds. Existing proxy settings were preserved with loopback exceptions for this owned fixture. Setup-only failures were corrected before the passing request run and are not counted as product passes.
The Gateway case took 11.146 seconds; the complete Vitest run took 187.27 seconds, including compilation/transformation. Its completed native worker generation had 18,194 inputs and 23,125 outputs, and final generation verification completed.
Retained proof SHA-256 values:
15f29d4e355350af24bb956b4bab3a4507e05b5ca20f939e68ba81248d7c250451b22a45a2337cf7bbcfe1f3a0653621c68e0136baef5aeb50fcbb2c77a5db7f41a1ed1763e06b15181bdf2109505aadd232360742a6b10adc9329430991c4f62309c3ba751adcc31fb7c581571e7764c0498883d2c1cfe5798d7168d769852f5ad1fb7b70d73a268dbc124fb465522a3a69316ea7a8d9cf5a3ae8d0d47879f832812c8d22cac7006d8495e757eeea259423e5881826a880e851088c77f095f5Simplification removes the host-handle wrapper: production code is net -11 lines. The dedicated allocation is 94 test lines: 93 regression-test lines plus the justified mock-isolation comment. The shared test-line baseline is unchanged; the mock fingerprint baseline shrinks from 6442 to 6441 entries.
Worked on by