Skip to content

fix(sessions): prevent search failures during session updates - #160237

Draft
roboclaw-bot wants to merge 2 commits into
mainfrom
openclaw/fix-transcript-error-and-empty-space
Draft

roboclaw-bot wants to merge 2 commits into
mainfrom
openclaw/fix-transcript-error-and-empty-space

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: message search intermittently reports unavailable during ordinary session activity, and the command palette leaves empty filters and hints beneath that failure.

User Impact

Search now tolerates ordinary title/usage updates, including activity in excluded background sessions. Genuine database errors, changed access, and session-lifecycle changes are still checked and reported; a failed search never becomes a false “No results found.” The palette retains a compact error message and Retry, preserving the query, focus, and foreground draft.

No permission, schema, retention, or stored-data changes. This PR has not been deployed to the reported Gateway.

Why This Change Was Made

The backend treated any pending session-row refresh as a changed search scope. Two harmless updates could consume both transcript-search attempts, even though the authorized session keys and lifecycle identities were unchanged.

Each attempt now joins one existing projection refresh before the original owner, readiness, scope, and generation checks. New dirty work after that refresh still consumes the existing retry budget. The final synchronous authorization/presentation check remains in place. This fixes the cause instead of suppressing its error.

Reported and requested by @vyctorbrzezowski.

Work sessions

Evidence

  • Retained live Gateway logs around the report contain sessions.search → “UNAVAILABLE: Session search scope changed while reading; retry the request”. The same error recurs later. No private log payloads are published here.
  • Two registered-handler regressions reproduce that exact failure before the fix, using real SQLite/FTS worker reads and committed metadata updates on matched and excluded sessions. With the fix, both return the expected hit and current title with one transcript read.
  • 12 backend tests pass, covering ordinary updates; repeated real key-set, lifecycle, and refresh-settlement churn; visibility revocation; physical shared-store ownership; archived-hit preparation; and real FTS rejection. The five added cases take 3.33 s of test execution. Full file: 14.61 s test execution, 47.89 s Vitest duration, 50.60 s wall including 28.01 s cold worker compilation. Real projection/worker/SQLite composition is needed to reproduce this timing boundary.
  • Final production and Gateway-methods test typechecks, targeted lint, formatting, and diff checks pass. The earlier broader changed-check run also recorded passing repository guards and all selected test typecheck graphs.
  • Fresh independent P0/P1 review is clean after replacing the initial proposed unbounded refresh loop with a single refresh per existing attempt. A new regression preserves the error when fresh work arrives as that refresh settles.
  • The unchanged UI portion previously passed 82 palette tests and Chromium checks at 1200×800 and 390×844: same-query Retry, focus restoration, and foreground-draft preservation. Its before/after images below demonstrate the retained failure fallback, not the backend concurrency fix.
Earlier UI validation caveat

The first UI changed-check run stopped at a native TypeScript compiler nil-pointer panic in checkCollisionWithRequireExportsInGeneratedCode. A controlled baseline run and the byte-identical restored candidate both passed afterward. No compiler/dependency change or suppression was made; that one-off panic remains unexplained. Remaining checks were run separately, not represented as a green initial aggregate.

Same query, viewport, theme, and simulated service failure:

Before

Before: empty result tabs and misleading transcript fallback

After

After: compact message-search failure with Retry

Narrow viewport

Before:

Before on a narrow viewport

After:

After on a narrow viewport

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S labels Sep 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 3:23 PM ET / 19:23 UTC (Revision 2).

ClawSweeper review

What this changes

The branch lets Gateway session search tolerate ordinary session-row updates and makes failed Control UI palette searches compact and retryable, with tests, copy, and documentation.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: current main lacks the repair, and the branch offers a focused change with no confirmed introduced defect.

Priority: P2
Reviewed head: cc05fc11c011a1bb16da34384d1d1ff38493d476

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused patch, boundary regressions, and inspected UI screenshots provide good review signal; the merge conflict is a separate workflow blocker.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The bot-authored PR is exempt from the contributor proof gate. Inspected before and after screenshots show the changed palette failure state; the backend claim has registered-handler and real SQLite regression evidence, but no deployed Gateway observation. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The bot-authored PR is exempt from the contributor proof gate. Inspected before and after screenshots show the changed palette failure state; the backend claim has registered-handler and real SQLite regression evidence, but no deployed Gateway observation. No stored-data contract changes.
Evidence reviewed 7 items Introduced backend repair: The branch joins one projection refresh after the transcript read, then retains the owner, dirty-state, selection, and final publication checks.
Current-main behavior: Current main still checks the dirty projection immediately after the worker read and spends a retry; it does not join the new refresh.
Registered-handler regression coverage: Added cases call the registered sessions.search handler with real session persistence and transcript reads; they cover harmless matched and excluded updates plus continuing membership, lifecycle, and refresh churn. The PR body reports before-fix failure and after-fix success; this review did not execute the tests.
Findings None None.
Security None None.

How this fits together

Gateway session search combines access-scoped session rows with transcript matches from a SQLite worker and returns authorized results. The Control UI command palette presents those results and offers Retry when search fails.

flowchart LR
 A[Palette query] --> B[Gateway search scope]
 B --> C[Session row projection]
 C --> D[Transcript worker]
 D --> E[Scope and access recheck]
 E --> F[Results or error]
 F --> G[Palette results or Retry]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub currently reports a merge conflict; the resolved result is not available for review against current main.
  • Complete next step (P2) - Resolve the merge conflict against current main, check that its newer palette shortcut rendering survives, and mark the PR ready when prepared.
Agent review details

Security

None.

PR surface

Source +52, Tests +169, Docs +3. Total +224 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 5 70 18 +52
Tests 4 177 8 +169
Docs 1 4 1 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 251 27 +224

Review metrics

Metric Value Why it matters
Production and test growth production +52 net lines; tests +169 net lines The production growth is focused on one search refresh and palette recovery; the larger test delta covers their observable failure paths.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the search refresh and retry behavior after resolving the conflict while preserving current main's palette shortcut rendering and the final access checks.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the search refresh and retry behavior after resolving the conflict while preserving current main's palette shortcut rendering and the final access checks.

Do we have a high-confidence way to reproduce the issue?

Yes. The added registered-handler cases give a specific path in which committed session updates arrive after a real transcript read; this review did not execute them.

Is this the best way to solve the issue?

Yes. Joining one projection refresh before the existing scope and authorization rechecks is a narrow repair, and Retry gives the palette a visible recovery path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against fd28e926dcb1.

Labels

Label changes:

  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.

Label justifications:

  • P2: Intermittent search failure affects a user-facing workflow, while the proposed repair has a limited surface.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The bot-authored PR is exempt from the contributor proof gate. Inspected before and after screenshots show the changed palette failure state; the backend claim has registered-handler and real SQLite regression evidence, but no deployed Gateway observation. No stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The bot-authored PR is exempt from the contributor proof gate. Inspected before and after screenshots show the changed palette failure state; the backend claim has registered-handler and real SQLite regression evidence, but no deployed Gateway observation. No stored-data contract changes.

Evidence

What I checked:

  • Introduced backend repair: The branch joins one projection refresh after the transcript read, then retains the owner, dirty-state, selection, and final publication checks. (src/gateway/server-methods/sessions-search-projected.ts:120, cc05fc11c011)
  • Current-main behavior: Current main still checks the dirty projection immediately after the worker read and spends a retry; it does not join the new refresh. (src/gateway/server-methods/sessions-search-projected.ts:118, fd28e926dcb1)
  • Registered-handler regression coverage: Added cases call the registered sessions.search handler with real session persistence and transcript reads; they cover harmless matched and excluded updates plus continuing membership, lifecycle, and refresh churn. The PR body reports before-fix failure and after-fix success; this review did not execute the tests. (src/gateway/server-methods/sessions-search-scope.test.ts:139, cc05fc11c011)
  • Final authorization boundary: The registered Gateway method checks current mutation authorization when the result is published; the projected search also reselects authorized rows after awaited work. (src/gateway/server-methods/sessions-read.ts:78, cc05fc11c011)
  • Visible UI result: The PR's downloaded before and after screenshots were inspected at wide and narrow viewports. They directly show empty filters and hints replaced by a compact message-search error and Retry; they do not demonstrate the backend concurrency repair. (cc05fc11c011)
  • Current merge state: GitHub reports the pinned PR head as draft and conflicting with its pinned base. The supplied test-merge evidence is unavailable, so no merged-result regression is inferred. (cc05fc11c011)

Likely related people:

  • Galin Iliev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RoboClaw: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-28T07:15:51.022Z sha c6e3436 :: needs changes before merge. :: none

@roboclaw-bot roboclaw-bot changed the title fix(ui): keep failed palette searches compact and retryable fix(sessions): prevent search failures during session updates Sep 28, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 28, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S stale Marked as stale due to inactivity status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants