Skip to content

fix: preserve updates after read-only SQLite probes - #182032

Merged
steipete merged 1 commit into
mainfrom
fix/update-readonly-wal-capture
Oct 24, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/update-readonly-wal-capture

Conversation

@steipete

@steipete steipete commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes updates from published stable stopping in post-activation Doctor with SQLite migration source changed after update capture. after a read-only SQLite probe, even though the captured database contents are unchanged.

User Impact

Read-only probes no longer prevent the candidate from migrating preserved SQLite state. Changed database contents or write evidence still refuse migration and automatic restoration. This is a candidate-side repair, so an older installed updater can benefit without a new handoff protocol.

Why This Change Was Made

Opening a cold WAL database can create a zero-write shared-memory index; closing its last writable reader can remove it. The candidate now recognizes only those two equivalent observations, bound to the same file identity and committed content, before acquiring native exclusion. Legacy fingerprints stay byte-for-byte compatible, and exclusive handles, postimages, and native close keep their strict checks.

Evidence

The two real SQLite regressions fail on unchanged main and exercise migration plus close attribution with the fix. Additional checks cover retained exclusive custody and reject outside commits, including a write followed by restoration of the original value. The migration suite passes all 12 tests; the generation suite passes all 21 tests. Core and infra-test typechecks and independent review are clean.

The real published 2026.10.6 updater now completes against the packed candidate in an isolated npm prefix: exit 0, durable run status succeeded, all three agents migrate from schema 25 to 32 and shared state from 20 to 31, and memory/cache table hashes remain identical. The replay restores the failed run’s stable pre-activation backup; isolated paths and update-ledger rows differ. The latest published stable has no PostgreSQL state support, so this is a stable-created SQLite upgrade.

All three final-head PostgreSQL CI shards actually ran and passed (1,143 tests, 37 existing skips); local shards 1 and 2 also passed. CI run 40044349319 has three unrelated UI failures, each reproduced with the same test and selector on unchanged base a69cf566: directory-race folder navigation, downloads second-file selection, and file-link “Show in Files” filter selection. The update-only diff does not change their inputs. These remain recorded as inherited failures.

Release-note context: the next candidate must contain this repair for updates from 2026.10.6; it fixes the candidate-side migration check while retaining the shipped updater’s fingerprint and handoff protocol.

The shared observation owner adds 40 net production lines; regression coverage adds 104 lines and the update contract adds seven. No protocol, configuration, or schema was added.

@clawsweeper

clawsweeper Bot commented Oct 24, 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.

@steipete
steipete marked this pull request as ready for review October 24, 2026 00:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T00:19:34.030202Z 50e8022 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M labels Oct 24, 2026
@steipete
steipete force-pushed the fix/update-readonly-wal-capture branch from 50e8022 to d6fbcaa Compare October 24, 2026 00:18
@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. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR lets candidate Doctor recognize an empty SQLite WAL index appearing or disappearing without changing the installed updater’s fingerprint format.

Example: A captured WAL database contains retained.value = 7, and a read-only probe creates an empty shared-memory index before migration.

  • Before: Doctor rejects migration with “SQLite migration source changed after update capture.”
  • After: Doctor admits the equivalent observation and migrates the database while retaining value 7.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused and source-consistent repair with meaningful native SQLite coverage, but the required upgrade compatibility result remains pending.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied evidence reaches real SQLite migration and close attribution through an in-process harness, while the body explicitly leaves the shipped updater replay pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An update stops in candidate Doctor after a read-only SQLite probe despite unchanged captured database contents.
Reason: This maintainer-authored direction restores the documented update behavior without adding configuration, schemas, or another state owner.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this useful maintainer-authored repair open: current main still rejects harmless empty WAL-index transitions, and no concrete introduced correctness defect was found.

Priority: P1
Reviewed head: d6fbcaa2bda4e0cedb3ba91958cbabef4d377527

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Low-value test src/infra/update-doctor-migration-attribution.test.ts: Remove the helper-call-count spy assertion in the exclusive-custody cases; it pins implementation routing rather than proving exclusion against another writer, while the real SQLite migration and receipt assertions remain useful.
  • Missing end-to-end proof: The promised published-stable updater replay through candidate Doctor, exercising the reader transition with retained settings, rows, and rollback behavior, has not yet been supplied.
Agent review details

How this fits together

The updater captures database generations, candidate Doctor checks them before migrations, and migration receipts let the updater distinguish owned changes from unrelated writes.

flowchart TD
  A[Installed updater capture] --> B[Recorded database fingerprint]
  B --> C[Candidate Doctor admission]
  D[Current SQLite family] --> E[Shared generation owner]
  E --> C
  C --> F[Exclusive migration]
  F --> G[Write receipt and rollback checks]
Loading

Technical review

Best possible solution:

Keep equivalence recognition in the existing generation owner while preserving legacy fingerprints, strict exclusive custody, and migration receipts.

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

Current-main hashing distinguishes absent and zero-write WAL indexes, and migration admission requires exact equality; the supplied real-SQLite regression fixtures exercise both transitions, but no target code was run during this review.

Is this the best way to solve the issue?

The patch is a focused repair: it shares the existing observation implementation, accepts only the evidenced empty-index equivalence, and leaves exclusive reads and post-migration checks strict.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Database generation fingerprints keeps the original intent (0ac1c24: Recognize checkpoint-equivalent committed content while retaining file identity and WAL write evidence for safe rollback.)
  • Artifact-preserving generation reads keeps the original intent (648fb53: Avoid native source opens that rebuild WAL indexes and change the recorded generation.)
  • Migration source admission changes intended behavior with a stated reason (8f62210: Bind migration and credential-cutover publications to the updater’s captured source under maintenance custody.)
  • Private-image acquisition keeps the original intent (908d45c: Reuse one verified private image while preserving final source-family verification.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +40, Tests +104, Docs +7. Total +151 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 92 52 +40
Tests 1 104 0 +104
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 203 52 +151

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +40 net lines; tests +104 lines The growth reuses the existing generation implementation and covers distinct reader-transition, custody, and write-rejection cases without adding persistent state.

Labels

Label changes:

  • add P1: Harmless SQLite probes can stop an existing installation’s update during post-activation Doctor.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Label justifications:

  • P1: Harmless SQLite probes can stop an existing installation’s update during post-activation Doctor.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the already-promised published-stable updater replay with preserved settings and data before lifting the author’s merge pause.

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.

Reviewed October 23, 2026, 8:35 PM ET / October 24, 2026, 00:35 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

The requested upgrade proof is complete on d6fbcaa2bda4e0cedb3ba91958cbabef4d377527: the published 2026.10.6 updater completed against the packed candidate with exit 0 and a durable succeeded result. All three agent stores migrated from 25 to 32, shared state from 20 to 31, and the memory/cache table hashes stayed identical. Real turns, inherited auth and history, the retained cron job, PostgreSQL port, and restart also passed. All three final-head PostgreSQL CI shards actually executed and passed (1,143 tests; 37 existing skips).

Keeping the small exclusive-mode spy assertion: it guards the specific prohibition on opening and closing a raw source file descriptor while SQLite owns POSIX locks. A successful PRAGMA locking_mode assertion alone cannot detect that OS-lock release. The surrounding native SQLite migration/close and outside-write tests remain the behavioral proof. This is not a production seam.

The three UI failures were separately reproduced with the same selectors on unchanged base a69cf566; the PR body records their inherited attribution. The release-note context now states that the next candidate needs this repair for updates from 2026.10.6.

@clawsweeper re-review

@steipete
steipete merged commit 237fdc6 into main Oct 24, 2026
149 of 154 checks passed
@steipete
steipete deleted the fix/update-readonly-wal-capture branch October 24, 2026 00:54
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

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

Labels

docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant