Skip to content

fix(sqlite): TEMP views invalidate sibling readers and worker logs lack timestamps - #199842

Open
roboclaw-bot wants to merge 4 commits into
mainfrom
openclaw/sqlite-188274-land
Open

roboclaw-bot wants to merge 4 commits into
mainfrom
openclaw/sqlite-188274-land

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #188274

What Problem This Solves

Creating a connection-local TEMP VIEW unnecessarily invalidates other SQLite readers, while worker console lines lack the emit time needed to attribute stalls accurately.

User Impact

TEMP views preserve sibling MAIN-reader admission. Worker diagnostics carry emitter-side timestamps, and slow transaction-hold warnings include the hold start time. No migration or user action is required.

Why This Change Was Made

Extend the existing TEMP-object classifier to views without suppressing subsequent MAIN DDL. Enable the existing timestamp mechanism in the two worker logging entry points and expose the already-measured hold start.

The worker registration fixture now keeps the real console exports and stubs only the two process-wide setters. The mock-export checker removed one obsolete baseline entry. The branch also incorporates the tested main revision and resolves the SQLite store worker conflict.

This does not address the exec-retry, proof-publication, or invalidation-message concerns in issue items a–c.

Evidence

Running-Gateway comparison on the reviewed head

Two isolated Gateways took the same projects.register request. The probe held a real SQLite store-worker commit and stalled the Gateway main thread for 2.2 seconds without changing its clock, logger or response.

Observation PR base 0828443372be PR head a0f86c30cf59
Worker stderr write to external receipt 2,193 ms 2,194 ms
Timestamp on worker warning None 04:51:49.124 UTC (worker write); received at 04:51:51.318 UTC
Transaction hold 1,270 ms; no start time 1,270 ms; started at 04:51:47.853 UTC

Both registrations returned the expected JSON. On both builds eight readiness probes timed out during the stall, and /readyz returned 200 before and after. This shows when the worker emitted its warning, not that the fix prevents stalls. TEMP-view behavior has its own two-connection proof below. Running-Gateway proof session.

Tests

  • Before the fixture update, src/state/openclaw-agent-execution.registration.test.ts failed at import (sqlite-store.worker.ts:74, missing setConsoleTimestampPrefix on the mock) with all 11 cases skipped. This is the checks-node-changed-compact-large-27 failure.
  • On a0f86c30cf59: 101 focused tests passed across nine files, including timestamped SQLite worker stderr and clean JSON stdout through the real broker, plus worker lifecycle and close coverage. The mock-export guard, targeted lint, formatting, focused typechecks and git diff --check passed. Repair and verification session · exact-head CI.

Earlier runtime evidence (built dist/, base 7ecd67c vs the handoff branch)

Both sides were built with pnpm build and exercised through the compiled output only, with an isolated state directory and HOME. This earlier capture was not repeated on a0f86c30cf59.

TEMP view admission. Two connections to one SQLite file, opened and admitted through the compiled openNodeSqliteDatabase and admitSqliteSchema. The writer runs CREATE TEMP VIEW, then CREATE TABLE.

step base sibling admission / revision branch sibling admission / revision
before 5c4329e6... / 1 0dc08831... / 1
after CREATE TEMP VIEW 932793a6... / 2 (invalidated) 0dc08831... / 1 (kept)
after CREATE TABLE (MAIN) abf765f1... / 3 (invalidated) 20f50f70... / 2 (invalidated)

Worker timestamps. The shipped SQLite store worker and the shipped worker task server, run through the compiled openSqliteWorkerStore and WorkerTaskPool:

base:   [state/sqlite] SQLite read-only snapshot for synthetic.sqlite: 4.0 KiB, budget 301 seconds
branch: 2026-11-22T19:05:15.683-08:00 [state/sqlite] SQLite read-only snapshot for synthetic.sqlite: 4.0 KiB, budget 301 seconds

Stdout stays {"value":"ready"} and parses as JSON on both sides. The stock CLI (openclaw sessions --json) emits no worker log line at any level, so the worker entry points are the closest shipped seam.

Slow hold start time. The compiled runSqliteImmediateTransactionSync with slowTransactionHoldMs: 20 and a real 60 ms hold. The "slow SQLite transaction hold" warning has no startedAt on base and "startedAt": "2026-11-23T03:06:16.974Z" (elapsedMs: 60) on the branch.

The earlier harness evidence is separate from the running-Gateway comparison above. Harness scripts and full redacted logs are in the attached evidence bundle.

Original patch by Mitchell Etzel.

Worked on by

Work sessions

Linked for team reference; these sessions aren’t public.

…ck timestamps

Worked on by:
- @Patrick-Erichsen
- @etzelm

Co-authored-by: Patrick-Erichsen <[email protected]>
Co-authored-by: etzelm <[email protected]>
OpenClaw-Publication: 49a64d40-b9f0-45a8-9416-0441162b9932
@clawsweeper

clawsweeper Bot commented Nov 15, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserves sibling SQLite readers when creating TEMP views and adds worker emission timestamps and transaction hold-start times.

Example: One connection runs CREATE TEMP VIEW local_observer AS SELECT id FROM original while another retains admitted MAIN-schema facts.

  • Before: The sibling admission is invalidated despite no MAIN-schema change.
  • After: The sibling admission survives; a subsequent CREATE TABLE still invalidates it.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct repair with successful exact-head CI and mixed Gateway and compiled-boundary proof; coverage remains partial relative to the linked report.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Public runtime results cover the exact-head projects.register Gateway path under delayed host delivery, timestamped worker warnings and hold starts, plus compiled two-connection TEMP-view admission and MAIN-DDL invalidation; protected session links are optional provenance.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Connection-local TEMP views unnecessarily invalidate sibling SQLite readers, and delayed worker diagnostics obscure when a transaction hold occurred.
Reason: The maintainer-authored direction has clear operational value and a small implementation; its Related reference accurately limits coverage of the broader report.

Merge readiness

✅ Ready for maintainer review

This PR provides a focused repair still needed on current main; no actionable correctness or security findings remain.

Priority: P2
Reviewed head: a0f86c30cf59f32ccfd747e12c6d40a91636a344

Before merge

None.

Findings

None.

Agent review details

How this fits together

SQLite mutation classification controls shared reader admission, while worker logging and transaction diagnostics provide timing information to operators.

flowchart TD
A[SQLite operation] --> B[Mutation classifier]
B --> C[Connection local facts]
B --> D[Shared MAIN admission]
A --> E[Transaction diagnostics]
E --> F[Timestamped worker stderr]
F --> G[Host log relay]
Loading

Technical review

Best possible solution:

Merge the focused classifier and diagnostic repair while retaining the existing MAIN-DDL invalidation and JSON-output contracts.

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

Current-main source establishes the TEMP-view misclassification and missing diagnostic timing, corroborated by the supplied before/after runtime output; this review executed no target code.

Is this the best way to solve the issue?

The patch repairs the existing owners directly and preserves subsequent MAIN-DDL invalidation, stderr routing, and lightweight worker initialization.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f85e5863887b.

Provenance checked

  • TEMP-object classification keeps the original intent (bb7d32e: Preserve connection-local TEMP-trigger admission without hiding subsequent MAIN-schema changes.)
  • SQLite worker output routing keeps the original intent (1368702: Keep worker diagnostics on stderr so structured command stdout remains valid JSON.)
  • Worker-task logging initialization keeps the original intent (7202377: Use lightweight logging state instead of importing the full logger into constrained worker heaps.)
  • Transaction hold attribution keeps the original intent (bfc85ce: Distinguish worker and main-thread warnings without changing transaction behavior or claiming latency causation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 9eb72a0 adds src/infra/sqlite-transaction.ts:524 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9eb72a0fbc17; files: src/infra/sqlite-transaction.ts)
  • Josh Lehman: Raw commit da13d2a adds src/infra/sqlite-store.worker.ts:77 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: da13d2a9c302; files: src/infra/sqlite-store.worker.ts)

PR surface

Source +5, Tests +27, Other -1. Total +31 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 8 3 +5
Tests 6 40 13 +27
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 11 48 17 +31

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Unnecessary reader-admission invalidation and misleading diagnostic timing merit a focused repair without evidence of a widespread outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-15T23:21:47.668Z sha d381508 :: needs changes before merge. :: [P2] Update the registration fixture for the new logging export
  • reviewed 2026-11-23T17:19:35.701Z sha a0f86c3 :: needs maintainer review before merge. :: none

Reviewed November 23, 2026, 11:58 PM ET / November 24, 2026, 04:58 UTC (Revision 3).

roboclaw-bot and others added 3 commits November 23, 2026 17:03
Worked on by:
- @etzelm

Co-authored-by: etzelm <[email protected]>
OpenClaw-Publication: 0df6fe85-57a2-4880-bdf7-4b0df0406b9c
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 23, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

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

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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.

1 participant