Add managed enforcement of DELETE journaling on NFS (#57225)

## Why

Existing databases retain their journal mode, so selecting `DELETE` for new NFS databases leaves existing WAL databases unchanged.

## What changed

- Add the managed `unsafe_enforce_sqlite_journal_mode` requirement to migrate existing NFS databases before opening writable pools and require `DELETE` on each connection.
- Share migration code between startup and `codex migrate-nfs-db`, preserving WAL backups and resuming interrupted replacements, including lazily opened databases.
- Hold the migration lock through pool initialization and keep migration failures out of automatic corruption recovery.
- Preserve local logs behavior and skip legacy NFS logs cleanup when enforcement is enabled.

## Testing

Add coverage for requirement precedence, database settings, data and backup preservation across restarts, interrupted replacement recovery, refusal of active WAL databases, migration lock waiting, and local logs remaining in WAL mode.

GitOrigin-RevId: da41ec1b58b1ee8092591cdf8b358280928ff9d4
This commit is contained in:
Dmitriy Kovalenko
2026-10-26 20:10:45 +00:00
committed by copyberry
parent 964aeda627
commit 480ab2d006
24 changed files with 747 additions and 358 deletions
+4 -1
View File
@@ -338,7 +338,10 @@ async fn new_config(
agent_max_depth: 1,
agent_roles: BTreeMap::new(),
memories: MemoriesConfig::default(),
sqlite: SqliteConfig::from_sqlite_home(codex_home.clone()),
sqlite: SqliteConfig::from_sqlite_home_with_nfs_enforcement(
codex_home.clone(),
/*enforce_delete_on_nfs*/ false,
),
log_dir: codex_home.join("log").to_path_buf(),
codex_home,
history: History::default(),