fix(sync): stop SQLite-backed containers from re-syncing on their own -shm writes - #1580
Merged
mariusvniekerk merged 2 commits intoSep 3, 2026
Conversation
roborev: Combined Review (
|
roborev: Combined Review (
|
…m writes Opening a WAL-mode SQLite database as a reader rewrites its -shm index. The db-backed providers (zcode, goose) resolved a bare -shm event to the whole container, and zcode also folded the -shm mtime into every member's fingerprint, so each scan scheduled the next one and rewrote every member session in between. On one archive the zcode container had not changed for half an hour while all 22 of its sessions were rewritten every five seconds, and the usage-cache rollups could never stabilize behind them. Ignore bare -shm events for db-backed containers, the rule Omnigent and Cursor IDE already apply through classifySQLiteContainerPath, and drop the -shm mtime from the zcode fingerprint. Real changes always reach the main file or its -wal sibling, which both paths still honor.
…iners The previous commit stopped the db-backed providers from re-syncing on their own -shm writes, but four other SQLite-backed providers still had the same loop open. Zed, Shelley, and Kiro folded the -shm mtime into their container fingerprint and accepted a bare -shm event as a container change, while each of them opens a read connection during fingerprinting that rewrites -shm. Devin ignored the -shm mtime but still accepted the event, so every scan queued a wasted fingerprint pass on the next watcher cycle. The shared journal suffix list now covers only the main file and -wal, which lets Omnigent and Cursor IDE drop their private copies of the same list. Zed and Shelley reject bare -shm events through the shared container classifier the way Omnigent already did, and Devin and Kiro drop the -shm match from their own event mapping. Committed writes always reach the main file or the WAL, so nothing observable is lost. Existing tests that used a -shm event as an example database sibling now use -wal, which is the sibling that carries real changes.
mariusvniekerk
force-pushed
the
fix/db-backed-shm-self-trigger
branch
from
September 3, 2026 14:16
64c51bb to
1b3b28c
Compare
roborev: Combined Review (
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Opening a WAL-mode SQLite database as a reader rewrites its
-shmindex. Several providers treated that rewrite as a source change: they resolved a bare-shmevent to the whole container, folded the-shmmtime into the container fingerprint, or both, while each of them opens its own read connection during a scan. Together those made each scan schedule the next. On one archive the ZCode container had not changed for half an hour while its 22 sessions were rewritten every five seconds, and the usage-cache backfill and/api/v1/usage/summaryfailed continuously with "source archive changed during rollup build" because the archive never held still long enough.Every SQLite-backed provider that opens its own read connection now ignores bare
-shmevents and leaves the-shmmtime out of its fingerprint:dbPathForEvent, plus the ZCode fingerprint.-wal, so Omnigent and Cursor IDE use it instead of private copies.Real changes always land in the main file or its
-walsibling, and every path still honors those. Existing tests that used a-shmevent as an example database sibling now use-wal.Two limits remain. The first read-only open after an agent closes its database cleanly re-creates an empty
-wal, so a provider whose fingerprint reads the-walmtime re-parses its container once per app close. That is one bounded pass, not a loop; the OpenCode provider already guards it by checking whether the WAL has frames, and the same check could be extended later. Stored ZCode mtimes from older builds included the-shmmtime, so the first scan after upgrading rewrites the ZCode archive once.Reviewers should look at
dbPathForEventininternal/parser/db_backed_provider.go,zcodeSessionFileMtimeininternal/parser/zcode.go, andsqliteDBJournalSuffixesininternal/parser/zed_provider.go.Closes #1583
🤖 Generated with Claude Code
https://claude.ai/code/session_01PBqd7h5vuXFZehmrZATaNu
generated by a clanker