Repository navigation
fix(postgres): preserve numeric scores in session recall - #202304
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 maintainer review before merge. What this changesThis PR makes substring-search scores numeric and extends PostgreSQL recall coverage for visibility, ordering, and result limits. Example: Search for 会 in a visible transcript containing 明天下午开会讨论.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a concrete PostgreSQL recall defect still present on main; no actionable patch defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe transcript worker queries indexed session text, passes candidates through Gateway visibility filtering, and returns scored hits consumed by sessions_search. flowchart LR
A[Session search tool] --> B[Gateway search handler]
B --> C[Transcript worker]
C --> D[PostgreSQL transcript index]
D --> C
C --> E[Visibility filtering]
E --> F[Numeric scored results]
F --> A
Technical reviewBest possible solution: Keep the numeric literal in the existing query owner while preserving driver decoding, tool validation, visibility filtering, and persisted indexes. Do we have a high-confidence way to reproduce the issue? Source establishes the untyped fallback score, unchanged PostgreSQL decoding, and numeric-only tool filter; the author reports reproducing the text score, but this review executed no target code. Is this the best way to solve the issue? The smallest complete fix changes the SQL producer to return numeric zero; coercing scores in the driver or weakening tool validation would broaden the change unnecessarily. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e98e438fb2c0. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1, Tests +301. Total +302 across 2 files. Added test files: 0. 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:
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 (1 earlier review cycle)
Reviewed November 20, 2026, 3:03 AM ET / 08:03 UTC (Revision 2). |
Baseline-Refresh: ca9e7c36d7cfb71430b03378577e9a6e16e0317c
|
@clawsweeper re-review Please review exact head All 8 real PostgreSQL 16 product cases and 42 SQLite sibling tests pass. Independent source/result review and fresh structured review are clean. The earlier dependency failure came from unchanged Discord exports and is addressed by the canonical baseline repair #202297. Exact-head CI is still running: https://github.com/openclaw/openclaw/actions/runs/44698574297 . The PR body contains the current proof and remaining gate. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…2304) * test(postgres): cover recall authorization and paging * fix: refresh the reviewed correction baseline Baseline-Refresh: ca9e7c36d7cfb71430b03378577e9a6e16e0317c * test(postgres): trace recall readiness and physical owners * test(postgres): preserve cold recall diagnostic order * test(postgres): trace recall target and admission failures * fix(postgres): preserve numeric scores for substring recall * test(postgres): isolate recall fixture state per case Co-authored-by: Vincent Koc <[email protected]>
* test(postgres): cover recall authorization and paging * fix: refresh the reviewed correction baseline Baseline-Refresh: ca9e7c36d7cfb71430b03378577e9a6e16e0317c * test(postgres): trace recall readiness and physical owners * test(postgres): preserve cold recall diagnostic order * test(postgres): trace recall target and admission failures * fix(postgres): preserve numeric scores for substring recall * test(postgres): isolate recall fixture state per case Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit 04d1dd1) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit faa8c043085a2156c345af810f8426a2db212e41)
What Problem This Solves
PostgreSQL substring searches could return a text-valued zero score. The session-search tool correctly requires numeric scores, so it silently discarded matching CJK results.
User Impact
Restores CJK substring matches in session recall while preserving permission filtering, numeric result contracts, and result limits. No SQLite schema-version, DDL, migration, persisted-format, configuration, or public-API changes.
Why This Change Was Made
The fallback query now selects a numeric SQL literal. The tool and database driver retain their existing validation and decoding behavior.
The PostgreSQL product suite also covers real asynchronous authorization with 27 denied matches before two allowed hits, ordered results and truncation, the unscoped tool, physical global ownership, shared-store underscore namespaces, and child visibility. Each case owns its state and registry and disposes readers before cleanup.
Evidence
The published candidate is
7aa35a2bc19d31b56a7680cab5b081c6443439c0; exact-head CI passed all 28 executed jobs, including all four PostgreSQL conformance shards and the CI gate. Path-gated jobs were skipped by the plan.7aa35a2bc19d31b56a7680cab5b081c6443439c0.git diff --checkpass.0432ca0f49069428f0acd1fa474e79c83764ce2f: product 8/8 and admission 8/8 on PostgreSQL 17, plus pinned PostgreSQL 16 Gateway cron smoke 4/4. Path-gated jobs were skipped; the product and smoke cases were not skipped.Review Scope and Limits
The exact-head ClawSweeper review found no actionable code findings. Its optional rank-up request for a deployed Gateway/agent capture is deferred: this change has real PostgreSQL proof through the production tool, handler, authorization owner, and worker, with an injected in-process transport. It does not claim a deployed Gateway or external transport test. No additional deployment surface is introduced by the numeric SQL projection fix.
The earlier candidate CI job failed the new cases before the fixture and producer repairs. The subsequent PostgreSQL 16 diagnostic at
186dreturned the matching CJK hit withscore: "0"; the real tool returned no matching result. The repaired candidate returns numericscore: 0and retains both expected hits through that same tool path. This was a diagnostic of the broken producer, not a claim that the final suite passed on an unchanged base.