fix: flaky test (#11428)

stage1_concurrent_claims_respect_running_cap was flaky due to SQLite
lock contention, not cap logic correctness. The claim flow used deferred
transactions (BEGIN) with read-then-write behavior, which can fail under
concurrency with SQLITE_BUSY_SNAPSHOT/database is locked when upgrading
a read transaction to a write transaction. We fixed this by using BEGIN
IMMEDIATE for stage1 and phase2 claim paths, so lock acquisition happens
up front and contenders serialize cleanly instead of failing during
upgrade. After the change, codex-state tests pass and stress reruns of
the flaky path no longer reproduced the failure.
This commit is contained in:
jif-oai authored and GitHub committed 2026-02-11 10:23:18 +00:00
1 parent 476c1a7160
commit 2c5eeb6b1f
2 files changed
+2 -3

No files matched your search

-1
View File
@@ -1272,7 +1272,6 @@ WHERE id = 1
}
#[tokio::test]
#[ignore = "TODO(jif): flaky"]
async fn stage1_concurrent_claims_respect_running_cap() {
let codex_home = unique_temp_dir();
let runtime = StateRuntime::init(codex_home.clone(), "test-provider".to_string(), None)