Repository navigation
fix: keep search current after small PostgreSQL transcript rewrites - #202629
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesCast integer aggregates to BIGINT so small transcript rewrites update search immediately and queue health and archive totals return numbers. Example: Replace a roughly 54 KB PostgreSQL transcript with a message containing “replacement marker”.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current PostgreSQL result-type defect with focused changes in the existing query owners; no actionable correctness or security findings were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSession storage and ingress workers query PostgreSQL through the shared SQL bridge; their aggregate results feed transcript rebuild decisions, archive inventory, and Gateway health responses. flowchart TD
A[Transcript replacement] --> B[Rebuild sizing query]
C[Archive and ingress workers] --> D[Inventory and pressure queries]
B --> E[PostgreSQL BIGINT results]
D --> E
E --> F[Existing numeric decoder]
F --> G[Search projection and health results]
Technical reviewBest possible solution: Keep the explicit integer casts in the existing queries and land after the required CI gates pass. Do we have a high-confidence way to reproduce the issue? The aggregate decoding and subsequent byte addition establish the failure path in current source, supported by the author's PostgreSQL red/green replay; this read-only review ran no target code. Is this the best way to solve the issue? Casting integer aggregates at their producers is the smallest complete repair and preserves the shared decoder, null handling, filtering, and rebuild budgets. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4332e9aa1613. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +15, Tests +86. Total +101 across 6 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 November 20, 2026, 12:50 PM ET / 17:50 UTC. |
|
Merged via squash.
|
…202654 * origin/main: (34 commits) fix(ui): restore Skills first-visit asset limits (#202694) fix: restore Skills discovery recovery checks (#202747) fix(database): report disabled memory after a port (#202630) test(ui): settle live event imports before cursor assertions (#202752) fix: keep installed plugins in the Featured list instead of hiding them fix: keep PostgreSQL transcript and health totals numeric (#202629) fix(ui): show only SKILL.md in plugin skill previews fix: preserve the running installation when an agent updates its Gateway (#201570) chore(ui): refresh control ui locales (#202744) fix: show saved child results when idle delivery expires (#202732) perf(state): adopt producer-owned read commands (#202731) fix(cli): restore dashboard Gateway start and install recovery (#202085) fix: make plugin catalog artwork easier to recognize fix: restore queued compaction writer-fence coverage (#202709) fix(ui): remove resting chrome from Customize settings gears chore(ui): refresh control ui locales (#202734) fix: distinguish a recovered gateway from its failed update checks fix(ui): keep known plugin details visible while loading fix(cli): connect through gateway.remote.edgeAuth without a Gateway token fix: make the Plugins catalog clear when disconnected ...
) * feat(gateway): add restricted writer transport and steer discovery * refactor(gateway): retain publication owner across writer expansion * feat: prepare restricted connections for Session Share steering OpenClaw-Publication: d030c287-b7c5-8326-aa7e-a2b07b373ac6 * fix(gateway): distinguish disabled publication purposes at handshake * Publish openclaw/cool-shrimp OpenClaw-Publication: 096bcc30-6af3-892d-a6b9-456f24a4f5ba * merge: bring main into the steering transport branch and regenerate the config baseline * Merge remote-tracking branch 'origin/main' into land/steer-transport-202654 * origin/main: (34 commits) fix(ui): restore Skills first-visit asset limits (#202694) fix: restore Skills discovery recovery checks (#202747) fix(database): report disabled memory after a port (#202630) test(ui): settle live event imports before cursor assertions (#202752) fix: keep installed plugins in the Featured list instead of hiding them fix: keep PostgreSQL transcript and health totals numeric (#202629) fix(ui): show only SKILL.md in plugin skill previews fix: preserve the running installation when an agent updates its Gateway (#201570) chore(ui): refresh control ui locales (#202744) fix: show saved child results when idle delivery expires (#202732) perf(state): adopt producer-owned read commands (#202731) fix(cli): restore dashboard Gateway start and install recovery (#202085) fix: make plugin catalog artwork easier to recognize fix: restore queued compaction writer-fence coverage (#202709) fix(ui): remove resting chrome from Customize settings gears chore(ui): refresh control ui locales (#202734) fix: distinguish a recovered gateway from its failed update checks fix(ui): keep known plugin details visible while loading fix(cli): connect through gateway.remote.edgeAuth without a Gateway token fix: make the Plugins catalog clear when disconnected ... * merge: bring main into the steering transport branch and regenerate the config baseline * merge: bring main into the steering transport branch and regenerate the config baseline * merge: bring main into the steering transport branch and regenerate protocol output Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: vincentkoc <[email protected]>
…02629) Co-authored-by: VACInc <[email protected]>
…claw#202654) * feat(gateway): add restricted writer transport and steer discovery * refactor(gateway): retain publication owner across writer expansion * feat: prepare restricted connections for Session Share steering OpenClaw-Publication: d030c287-b7c5-8326-aa7e-a2b07b373ac6 * fix(gateway): distinguish disabled publication purposes at handshake * Publish openclaw/cool-shrimp OpenClaw-Publication: 096bcc30-6af3-892d-a6b9-456f24a4f5ba * merge: bring main into the steering transport branch and regenerate the config baseline * Merge remote-tracking branch 'origin/main' into land/steer-transport-202654 * origin/main: (34 commits) fix(ui): restore Skills first-visit asset limits (openclaw#202694) fix: restore Skills discovery recovery checks (openclaw#202747) fix(database): report disabled memory after a port (openclaw#202630) test(ui): settle live event imports before cursor assertions (openclaw#202752) fix: keep installed plugins in the Featured list instead of hiding them fix: keep PostgreSQL transcript and health totals numeric (openclaw#202629) fix(ui): show only SKILL.md in plugin skill previews fix: preserve the running installation when an agent updates its Gateway (openclaw#201570) chore(ui): refresh control ui locales (openclaw#202744) fix: show saved child results when idle delivery expires (openclaw#202732) perf(state): adopt producer-owned read commands (openclaw#202731) fix(cli): restore dashboard Gateway start and install recovery (openclaw#202085) fix: make plugin catalog artwork easier to recognize fix: restore queued compaction writer-fence coverage (openclaw#202709) fix(ui): remove resting chrome from Customize settings gears chore(ui): refresh control ui locales (openclaw#202734) fix: distinguish a recovered gateway from its failed update checks fix(ui): keep known plugin details visible while loading fix(cli): connect through gateway.remote.edgeAuth without a Gateway token fix: make the Plugins catalog clear when disconnected ... * merge: bring main into the steering transport branch and regenerate the config baseline * merge: bring main into the steering transport branch and regenerate the config baseline * merge: bring main into the steering transport branch and regenerate protocol output Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: VACInc <[email protected]> (cherry picked from commit 4dcb171) Operator-requested 2026.11.10 stable backport (Dallin, 2026-11-24 04:15). Clean apply. Later main mentions: 39bcc3c feat: prepare restricted connections for Session Share steering (#202654);. Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 3d91af2) Release adaptation: regenerate config docs hashes for this stable tree using config:docs:gen; config:docs:check passed. No config migration or anchor rename. Companions: no later PR or SHA mentions. Later same-path overlaps are unrelated config baseline regeneration, PostgreSQL operations/docs, or qualification tooling; #202109 is independent upgrade coverage, #202704 is a restore guide, and #202654 is a Session Share feature. Existing anchor selection and numeric aggregate fix #202629 are unchanged. Co-authored-by: VACInc <[email protected]> Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit abc82993e59c1632ddfcaece8a02ce15c432e990)
Summary
High Level TLDR
Small PostgreSQL transcript rewrites now update search in the same transaction. Ingress health counts and cold transcript archive totals are numbers in the returned data.
What Problem This Solves
Rewriting an existing transcript that fits the synchronous byte budget can briefly hide its messages from search while the index catches up. PostgreSQL can also return quoted counts and byte totals where readers expect numbers.
User Impact
Search reflects a small rewrite as soon as it commits. Queue and archive clients can read counts and byte totals as numbers. No migration is required.
Root Cause
PostgreSQL returns
SUM(bigint)asnumeric. The PostgreSQL driver leavesnumericas text, while OpenClaw's existingbigintdecoder returns safe integers as numbers. A real server replay returned"5000"for the raw sum, yielding"5000300"when adding 300 incoming bytes. The invalid total crosses the 4 MiB rebuild cap. The ingress and cold inventory queries similarly returned their sums as text. The cold inventory regression received"203"for a 203-byte embedded archive.Why This Change Was Made
Cast these integer aggregates to
BIGINTin their existing queries. The queries keep their filters, null handling, and rebuild caps. The casts use the numeric result path already used by nearby transcript queries and count fields.Real behavior proof
The focused transcript rewrite regression was replayed on the PR base
8832901915fbwith PostgreSQL 18 andunaccent. With the test alone, Vitest failed withexpected true to be falseat the in-transaction reconciliation assertion. With the sizing fix applied to that base, one selected test passed. The test also queries search after commit for both the replacement and the old text. Use the conformance command below with just the search test file and add-t "indexes a small replacement".With PostgreSQL 18.7 on a private Unix socket, the production replacement transaction left
needsReconcile: trueon the base for a roughly 54 KB transcript. The same production transaction leftneedsReconcile: falsewith the patch. A search of the committed replacement found the new message and no longer found the replaced message. On the same private server, the ingress worker returned three quoted counts on the base. After the fix, the foreground Gateway returned{"pendingCount":1,"claimedCount":1,"blockedCount":1}viaopenclaw health --json.Evidence
The rewrite replay seeded a fresh session for each sample on the same local server. Across five warmups and 20 measured replacement transactions, median commit time was 8.31 ms on the base and 10.74 ms with the patch. p90 was 10.56 ms and 16.27 ms. With the fix, the measured transaction also publishes the search projection. The measurement excludes deferred reconciliation and does not estimate total rebuild cost.
Autoreview covered the complete patch against base
1fbcec108f4e4at P0–P2 and reported no actionable findings. Simplification kept the casts inside the three existing queries and reused the existing search and archival fixtures.Verification
A fresh
pnpm build:ci-artifactson the pushed head also completed successfully. The Control UI build printed advisory size-budget warnings.Seven PostgreSQL tests and 54 SQLite sibling tests passed. Focused type-aware lint, formatting, and
git diff --checkpassed. Local PostgreSQL project durations were 135 seconds for the search suite, 27 seconds for cold inventory and selection, and 49 seconds for ingress health, including setup. The local runs used the pushed patch and its original base. A three-way merge against current main completed cleanly. Hosted CI passed on this head, including the artifact build, all four PostgreSQL conformance shards, the PostgreSQL 16 smoke job, and the required CI gate. https://github.com/openclaw/openclaw/actions/runs/44785119876node scripts/test-database-conformance.mjs --engine postgres --connection "$TEST_DSN" -- \ src/infra/database-engine/session-search-product.postgres.test.ts \ src/config/sessions/session-cold-storage-selection.postgres.test.ts \ src/infra/database-engine/ingress-queue-health.postgres.test.ts --maxWorkers=1What was not tested
Production state, paid model providers, other PostgreSQL server majors, and total background reconciliation latency were outside this proof.