Repository navigation
fix(database): ported PostgreSQL stores start without planner statistics - #183392
goutamadwant wants to merge 1 commit into
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 refreshes PostgreSQL planner statistics after database port materialization and the subsequent agent memory rebuild. Example: Port agent pop with 10,200 memory chunks to PostgreSQL.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: current main still lacks both statistics refreshes, and this PR includes post-rebuild work absent from the overlapping PR. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe offline database port copies and verifies stores before publication, then rebuilds agent memory under fresh custody; this change refreshes destination statistics at both completion boundaries. flowchart TD
A[Database port CLI] --> B[Offline port owner]
B --> C[Copy data and rebuild projections]
C --> D[Analyze destination namespace]
D --> E[Verify and publish]
E --> F[Fresh memory owner]
F --> G[Rebuild memory and close writer]
G --> H[Refresh statistics and report result]
Technical reviewBest possible solution: Refresh statistics through the existing bulk-copy and post-rebuild owners, preserving custody, canonical data verification, and nonfatal secondary-refresh reporting. Do we have a high-confidence way to reproduce the issue? Current-main source confirms both missing refresh boundaries, consistent with the linked report's catalog observations; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch addresses both write phases using the existing owners, shares namespace-scoped SQL across the asynchronous and synchronous transports, and preserves the prior publication and failure contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dd42213508b9. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +99, Tests +117. Total +216 across 7 files. Added test files: 1. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 Reviewed October 25, 2026, 3:40 AM ET / 07:40 UTC. |
openclaw database port --to postgres and backup restore into PostgreSQL handed back schemas without planner statistics, so first queries planned on default estimates. One shared helper now runs ANALYZE scoped to the destination namespace after the verified commit (and again after the memory rebuild); timeouts or errors are warnings and never undo verified data. Live PostgreSQL proof showed fresh statistics after port. Fixes #183307. Thanks @etzelm for the report and @lonexreb (#183327) and @goutamadwant (#183392) for the earlier fixes. Co-authored-by: lonexreb <[email protected]> Co-authored-by: goutamadwant <[email protected]>
|
Thank you, @goutamadwant! This landed as #183447 (660b252), which runs a namespace-scoped |
…aw#183447) openclaw database port --to postgres and backup restore into PostgreSQL handed back schemas without planner statistics, so first queries planned on default estimates. One shared helper now runs ANALYZE scoped to the destination namespace after the verified commit (and again after the memory rebuild); timeouts or errors are warnings and never undo verified data. Live PostgreSQL proof showed fresh statistics after port. Fixes openclaw#183307. Thanks @etzelm for the report and @lonexreb (openclaw#183327) and @goutamadwant (openclaw#183392) for the earlier fixes. Co-authored-by: lonexreb <[email protected]> Co-authored-by: goutamadwant <[email protected]>
Closes #183307
What Problem This Solves
Fixes: PostgreSQL agent stores returned by
database portlack planner statistics after bulk materialization and the subsequent memory rebuild.User Impact
User impact: first queries against a newly ported PostgreSQL agent store can plan from current table statistics instead of PostgreSQL's default estimates.
Why This Change Was Made
The port now runs a namespace-scoped
ANALYZEafter materialization while port custody is still current. The post-port memory rebuild refreshes the same admitted namespace after closing its writer, and reports a sanitized warning if that secondary refresh fails without misreporting the completed rebuild as failed.Evidence
Before the fix, the focused PostgreSQL regression observed
pg_stat_user_tables.last_analyze IS NULLfor a populatedsession_nodestable when the port returned. With the fix, the same real PostgreSQL path observeslast_analyze IS NOT NULL.Validated on current
main:Results: 15 PostgreSQL conformance tests passed, 7 focused unit tests passed, and the typecheck, formatting, ratchets, and diff check passed. The full repository lint still reports pre-existing max-lines violations in unrelated files; the changed-file line-cap ratchet passes.
Disclosure: AI was used to understand the codebase and review the fix.