GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): skip the WAL checkpoint on database open by neriousy · Pull Request #64532 · anomalyco/opencode

Conversation

@neriousy

@neriousy neriousy commented Nov 17, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Issue for this PR

N/A. Split out of #63729.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Removes the PRAGMA wal_checkpoint(PASSIVE) that runs when the database opens.

A background service registers as soon as it listens and opens the database afterwards (packages/server/src/process.ts). The checkpoint runs synchronously on the event loop, so with a large WAL on a slow disk /api/info stops answering right after registration and clients count the booting service as unresponsive. #54810 has a 300 MB WAL on an HDD.

This moves the work rather than removing it: SQLite runs the same passive checkpoint after a commit once the WAL passes wal_autocheckpoint (1000 pages by default, which we don't change). Opening the database and checking migrations still run on the event loop, so boot on a stalled disk can still block health probes.

The checkpoint was added in #13633 to clean up stale WAL data after a kill mid-write and avoid SQLITE_MISUSE. SQLite recovers the WAL on open by itself and ignores frames from transactions that never committed, so I don't expect that to come back, but I haven't reproduced the original error. That's why this is a draft.

No feature flag: it removes one statement from database startup.

How did you verify your code works?

  • packages/core: bun typecheck, and database.test.ts, database-drizzle.test.ts, database-migration.test.ts, storage-failure.test.ts on Windows
  • Not measured: boot time with a large WAL on a slow disk

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #54810

Public API: adds the skip_startup_checkpoint flag (OPENCODE_FLAGS; experimental.skip_startup_checkpoint config key is generated but ignored), backwards compatible

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@neriousy
fix(core): skip the WAL checkpoint on database open
c1db8f2
A background service registers as soon as it listens and opens the database afterwards, so a synchronous checkpoint of a large WAL on a slow disk keeps /api/info from answering right after registration. SQLite already runs the same passive checkpoint after a commit once the WAL passes wal_autocheckpoint.
@neriousy neriousy mentioned this pull request Nov 17, 2026
fix(client): avoid killing slow background services during recovery #63729
Open
3 of 6 tasks
@neriousy
fix(core): gate the startup WAL checkpoint behind a flag
930ee6e
@neriousy neriousy changed the title fix(core): skip the WAL checkpoint on database open fix(core): flag off the WAL checkpoint on database open Nov 18, 2026
@neriousy neriousy changed the title fix(core): flag off the WAL checkpoint on database open fix(core): skip the startup WAL checkpoint behind a flag Nov 18, 2026
@neriousy
neriousy marked this pull request as ready for review November 18, 2026 16:17
opencodejr[bot]
opencodejr Bot reviewed Nov 18, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gate works as described. I ran opencode serve from source with another connection holding committed WAL frames. On the base and on this PR with OPENCODE_FLAGS=-skip_startup_checkpoint, the main DB file grew on open (checkpointed). On this PR with the local channel's default it didn't. database.test.ts and flag.test.ts pass, and typecheck:tsc in core is clean.

Public API: adds the skip_startup_checkpoint flag. It can be set with OPENCODE_FLAGS, and the regenerated config schema, OpenAPI spec and client types gain an experimental.skip_startup_checkpoint key, which is ignored at runtime as the flag description says. Backwards compatible; releases still checkpoint by default.

No blocking concerns.

Related: #54810

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@neriousy neriousy mentioned this pull request Nov 18, 2026
feat(core): support env-only flags #64694
Open
3 of 6 tasks
@neriousy
Revert "fix(core): gate the startup WAL checkpoint behind a flag"
e254e43
This reverts commit 930ee6e.
@neriousy neriousy changed the title fix(core): skip the startup WAL checkpoint behind a flag fix(core): skip the WAL checkpoint on database open Nov 18, 2026
@neriousy
neriousy merged commit fc30827 into dev Nov 18, 2026
12 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@neriousy
neriousy deleted the skip-startup-checkpoint branch November 18, 2026 16:32
opencodejr[bot]
opencodejr Bot reviewed Nov 18, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new head removes the startup checkpoint outright, with no flag. I re-ran my WAL check with opencode serve from source: the main DB file no longer grows on open, where on the base it does. The database* and storage-failure tests pass and typecheck:tsc in core is clean. There are no open threads from my earlier review. The public API is unchanged: the flag, its config key and the regenerated OpenAPI/client types are gone again.

One note, not blocking: a large WAL left behind is now checkpointed by SQLite's auto-checkpoint after the first commit that leaves it over the limit, which can come soon after boot and still runs on the event loop. On a slow disk the stall may just move to the first write after boot. The description already says the work moves; this only makes that concrete.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
vergeal pushed a commit to vergeal/aicraft that referenced this pull request Nov 22, 2026
@neriousy @vergeal
fix(core): skip the WAL checkpoint on database open (anomalyco#64532)
fc47b88
(cherry picked from commit fc30827)
@BrewTestBot BrewTestBot mentioned this pull request Nov 23, 2026
opencode 2.4.0 Homebrew/homebrew-core#327368
Merged
@amrkmn amrkmn mentioned this pull request Nov 23, 2026
opencode 2.4.0 amrkmn/homebrew-tap#1251
Closed
1 task
@github-actions github-actions Bot mentioned this pull request Nov 23, 2026
feat: opencode release v2.4.0 sprisa/opencode-server#95
Merged
@scottames-github-bot scottames-github-bot Bot mentioned this pull request Nov 27, 2026
chore(deps): update ⬆️ mise-packages scottames/dots#1181
Merged
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@neriousy
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.