Skip to content

fix(sqlite): don't hard fail migrator if DB is newer - #16924

Merged
owenlin0 merged 1 commit into
mainfrom
owen/tolerant_db_mirgator
Apr 6, 2026
Merged

owenlin0 merged 1 commit into
mainfrom
owen/tolerant_db_mirgator

Conversation

@owenlin0

@owenlin0 owenlin0 commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR makes the SQLite state runtime tolerate databases that have already been migrated by a newer Codex binary.

Today, if an older CLI sees migration versions in _sqlx_migrations that it doesn't know about, startup fails. This change relaxes that check for the runtime migrators we use in codex-state so older binaries can keep opening the DB in that case.

Why

We can end up with mixed-version CLIs running against the same local state DB. In that setup, treating "the database is ahead of me" as a hard error is unnecessarily strict and breaks the older client even when the migration history is otherwise fine.

Follow-up

We still clean up versioned state_*.sqlite and logs_*.sqlite files during init, so older binaries can treat newer DB files as legacy. That should probably be tightened separately if we want mixed-version local usage to be fully safe.

@owenlin0
owenlin0 marked this pull request as ready for review April 6, 2026 18:06
@owenlin0
owenlin0 force-pushed the owen/tolerant_db_mirgator branch from 8eb8995 to f064dd1 Compare April 6, 2026 18:13
@owenlin0
owenlin0 force-pushed the owen/tolerant_db_mirgator branch from f064dd1 to cab599d Compare April 6, 2026 18:58
@owenlin0
owenlin0 merged commit 9bb8133 into main Apr 6, 2026
20 of 22 checks passed
@owenlin0
owenlin0 deleted the owen/tolerant_db_mirgator branch April 6, 2026 19:16
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant