Repository navigation
Description
Client or integration
Other
Area
Platform (Windows / macOS / Linux)
Summary
On Windows, one icacls timeout while atomicWriteFile hardens its temp file blocks every later write to that destination until the proxy restarts. The proxy keeps reporting healthy and nothing is logged.
atomicWriteFile (src/config/atomic-write.ts) hardens with { required: true, timeoutMemoKey: <destination> } at five call sites (lines 204, 244, 267, 302, 445 on dev e25be53). After a timeout, timeoutMemoErrorIfBlocked (src/lib/windows-secret-acl.ts) refuses every caller without retryTimedOutOnce instantly. None of these five call sites passes the flag, so the memo never re-arms for them. #3522 added the 5-minute re-arm (TIMEOUT_MEMO_REARM_MS) for exactly this failure on the response-spill directory, but the general atomic writer did not get it. #1296 described the same "fails for the life of the process" property, but its fix addressed how the error is classified, not how the writer recovers.
What I observed on 2.92.0: an icacls stall on 2026-10-26 around 14:21–14:32Z froze provider-account-quota-cache.json (last write 14:21:23Z) and codex-quota-cache.json (last write 14:31:14Z) for about 23 hours. During that time live /api/provider-quotas?refresh=1 reads succeeded (HTTP 200, 1.7 s) and other files such as auth.json kept updating. Both quota persisters wrap the write in catch {} (src/providers/account-quota-disk.ts, src/codex/quota.ts), and the required: true branch throws without logging, so the only trace was one unrelated required: false warning from the same stall. Anything that reads those files, including the proxy itself after a restart, saw readings that were a day old.
auth.json (oauth/store.ts), config.json (config/persist-unlocked.ts), and the pid and runtime-port files are written through the same function. I did not observe it, but by the same mechanism a stall that hits one of them would block that file until restart.
Expected: after icacls recovers, the next write to the same destination succeeds without a restart, as it already does for the spill directory.
Reproduction
Windows only, because the real icacls is used before and after the simulated stall. From a checkout root, save this as repro.ts and run OPENCODEX_HOME=<empty temp dir> bun repro.ts:
import { join } from "node:path";
import { mkdirSync, readFileSync } from "node:fs";
import { atomicWriteFile } from "./src/config/atomic-write.ts";
import { setIcaclsRunnerForTests, setNowForTests } from "./src/lib/windows-secret-acl.ts";
const home = process.env.OPENCODEX_HOME!;
mkdirSync(home, { recursive: true });
const target = join(home, "provider-account-quota-cache.json");
let now = Date.now();
setNowForTests(() => now);
const write = (label: string) => {
const body = `{"label":"${label}"}\n`;
try { atomicWriteFile(target, body); } catch (e: any) { console.log(label, "threw:", e?.message); }
let landed = false;
try { landed = readFileSync(target, "utf8") === body; } catch {}
console.log(label, landed ? "written" : "refused");
};
write("1 baseline");
setIcaclsRunnerForTests(() => ({ success: false, exitCode: null, timedOut: true, stdout: "" }));
write("2 icacls stall");
setIcaclsRunnerForTests(null);
write("3 icacls healthy again");
now += 60 * 60_000;
write("4 one hour later");Output on 2.92.0 (atomic-write.ts is identical in 2.93.0 and on dev):
1 baseline written
2 icacls stall threw: ACL hardening timed out (ETIMEDOUT) — transient icacls stall; the volume may still support per-user NTFS ACLs; ACL state unverified (probe failed)
2 icacls stall refused
3 icacls healthy again threw: ACL hardening skipped — previous attempt timed out
3 icacls healthy again refused
4 one hour later threw: ACL hardening skipped — previous attempt timed out
4 one hour later refused
A write to a different path succeeds at step 3, so only the destination that timed out is blocked.
Fix I am running locally: add retryTimedOutOnce: true to the five harden calls in src/config/atomic-write.ts. With that change, steps 3 and 4 write. A retry that stalls again is refused until 5 minutes have passed and then succeeds, which matches the #3522 behavior. The cost while icacls stays stalled is at most one bounded harden attempt (30 s default budget) per destination every 5 minutes. The written file still has to pass a full harden before the rename, so a write never goes through without the ACL. After applying the change and restarting, both cache files resumed writing within seconds.
It may also be worth logging the first refusal from these best-effort persisters once, so a frozen file shows up in service.log instead of failing silently.
Version
2.92.0 (also checked: 2.93.0 and dev e25be53 have the same atomic-write.ts call sites)
Operating system
Windows 11 Pro 26H2 (build 26300)
Provider and model
Not provider-specific (observed on the anthropic / anthropic2 / google-antigravity rows of provider-account-quota-cache.json and on codex-quota-cache.json)
Logs or error output
# service.log: the only line from the stall. It is a required:false harden of another path;
# the required:true timeouts on the two cache writes threw without logging.
2026-10-26T14:32:00.755Z [opencodex] ACL hardening timed out (ETIMEDOUT) — transient icacls stall; the volume may still support per-user NTFS ACLs; ACL state unverified (budget exhausted) — continuing without NTFS ACL harden
# File mtimes (UTC) 23 hours later, with the same proxy process still running and healthy:
provider-account-quota-cache.json 2026-10-26T14:21:23Z
codex-quota-cache.json 2026-10-26T14:31:14ZScreenshots and supporting files
No response
Redacted configuration
No response
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
fix(config): re-arm the atomic writer's ACL timeout memo per destinat…
Ingwannu commentedon Oct 29, 2026
Closing as completed on
dev: #7891 merged asc7f3928a21f2ff3c47ba7a2dd91c193ad4cf1273, which I verified is an ancestor of current trusteddev9b78a16f4fe0c300527e6b183052407269bb941d.The atomic writer opts its five hardening paths into the existing destination-keyed timeout re-arm while preserving required ACL hardening and retained-child bounds.
I checked the implementation and the successful exact-head required CI for
858e59b7c60270f0b5a219b412c87aa91a69839c. Existing author regression receipts remain author-run evidence; I did not rerun unchanged passing suites or reproduce this on a live account/native client. This closure records the landed scope, not validation of the reporter's installed version or a release claim. If the same failure occurs on a build containing this commit, provide a new bounded, redacted reproduction against that build.