Skip to content

Commit a6ee24f

Browse files
lidge-junjun
andauthored
fix(windows): writable fsync handles, hermetic ACL test lanes, teardown codemod (#3258)
* fix(windows): fsync token and spill files through a writable handle; bump test spawns a real path Windows rejects fsync on a read-only fd with EPERM. service-secrets opened 'r' for every backup/replace/restore, so all three token-ownership cases and the connected-key-rotation child failed on windows-latest; spill-store did the same on its exclusive-copy fallback. Both now open 'r+' (asserted via an openSync spy, driven red). tests/bump-dev-version used new URL(...).pathname, which is '/D:/a/...' on Windows, so bun could not load the CLI and every case exited 1 — including the malformed-input case, which read that as a correct rejection. fileURLToPath + process.execPath, stderr in the failure message, and the specific rejection text asserted. * test(responses-state): hermetic platform lanes; release the ACL gate in finally Generic spill/admission cases assert the synchronous lane, so they pin the platform to linux; a Windows host routed them through queued async publication and they read a resident where a stub was expected (~45 cases). Windows-lane cases now inject both principal resolvers alongside the platform: on the hosted runner the real PowerShell lookup failed with EACLIDENTITY before the case reached its own seams. That failure happened outside the try/finally in 'prices the job-owned superseded generation', so the held icacls promise was never released and the next case waited for it until Bun's 60 s ceiling. spill-store.harden() now consults windowsSecretAclApplies() on both lanes so the platform seam reaches the sync harden too. * test(windows): stub icacls in service.test, settle async spills in issue-702, size the first child wait Dispatch 33595585136 (first run with the ACL lifecycle fix): windows 1/4 fell from ~120 failures to 8 and the account-store/auth-api cascades are gone. What remained: service.test.ts hands a synthetic SID to a REAL icacls on a Windows host (EICACLS on every saveConfig) — both runners are now stubbed at file scope; issue-702 unlinked a spill that Windows had not yet published — it awaits the publication first; native-profile-manager's crash case waited a private 5 s for the first child boot of the shard — it now waits inside its own 15 s budget and reports the child's stderr on timeout. * test(responses-state): gate only spill hardens; copy fallback follows the platform seam Dispatch 33595585136 shard 2 left two failures in this file. The shutdown budget case gated EVERY async icacls call, and on a real Windows host the snapshot flush hardens responses-state.json through the same runner, so flushResponseState() sat behind the gate until the 30 s ACL deadline and the case hit Bun's 60 s ceiling. Gated runners now pass non-spill targets through. canUseExclusiveCopyFallback keyed on process.platform, so a case pinned to the POSIX lane on Windows turned an injected link failure into a successful copy and asserted a tombstone that never came; it now uses the same seam as harden(). * test(responses-state): win32 admission variants; assert the propagated shutdown rejection Reviewer P2: pinning the admission suite to the sync lane left the Windows async branch (runPendingResponseSpill post-write ceiling, failure tombstone) without a case. Two win32 variants now cover it after the queue settles; the write-failure variant scopes the injected failure to the oversized candidate because the queued candidate counts against the RAM cap while it waits. P3: the rejected-release regression now asserts the original error message. * devlog(windows): 011 — dispatch rounds, reviewer verdicts, fuck-powershell cases * test(native-main-refresh): yield to the event loop while waiting for the abort listener The wait spun on Promise.resolve(), which keeps the microtask queue non-empty and never lets a subprocess exit callback run. On Windows the exclusive claim can harden its lock file through an async icacls child before it reaches the abort listener, so the spin never ends. Dispatch 33597649234 shard 4 sat in this file for eight minutes until the job ceiling with zero failures logged. * test(server-stop): replace the 60 ms pending oracle with an observed listener close Reviewer P3: the shutdown-drain regression assumed all earlier stop() stages finished within 60 ms. It now polls until the listener refuses connections, so 'still pending' can only mean the held ACL flight. * test(windows): yield in the remaining claim-cancellation waits; retrying teardown in oauth-manual-code and provider-quota Dispatch 33601508392 shard 4 hung again in responses-native-main-refresh — the two WebSocket string-abort cases spun on Promise.resolve() like the one fixed in 2bf189d. Both now yield to the event loop. Two more bare rmSync teardowns (oauth-manual-code fixed dir, provider-quota temp homes) go through removeTreeWithRetry. * test(windows): freeze the spill ACL clocks in the shutdown-fallback cases; let the write-lock holder outlast a slow contender boot Now that harden() follows the platform seam, the synchronous fallback harden really runs on every host, and its 80 ms reserve raced a loaded Linux shard's wall clock (run 33603770447 test 3/4). The three fallback cases inject the same frozen clock the budget case already used. codex-write-lock's holder used the helper's default 3 s ceiling; a windows- latest contender took longer than that to boot, so the hold expired first and the contender read 'acquired'. The ceiling is now 20 s — the release marker still ends the hold immediately. * test(oauth-manual-code): per-test scratch home with both icacls runners stubbed The manual-code login test persisted its credential through the real icacls on windows-latest and settled as 'OAuth authentication failed' (run 33603770447 shard 4). Same shape as codex-account-store / codex-auth-api: this file is about the PKCE flow, not ACLs. * test(retained-root): size the child marker wait inside the test budget A bun --eval child reaches its marker in 8-11 s on windows-latest; the 10 s default wait lost the race on run 33605898170 shard 1 while the same case passed at 10.4-10.6 s on earlier runs. * test(windows): route every recursive scratch-tree removal through removeTreeWithRetry Mechanical codemod (script kept in .tmp): 870 rmSync(recursive) teardown sites across 381 test files now use the bounded EPERM/EBUSY/ENOTEMPTY retry. Each Windows dispatch so far surfaced one or two more bare rmSync sites (oauth- reauth-bind, responses-native-main-refresh, provider-quota, ...); this closes the class instead of chasing it a shard at a time. 18 sites in 8 files skipped on purpose: mixed file/dir collections, existing custom retry helpers, and the ACL fixture whose shape covers single files. tsc green; test:changed 14165 pass / 2 lab-fabric cases that pass in isolation. * test: fail the listener-close poll closed; per-call marker deadlines inside each test budget Reviewer P2s: the shutdown-drain oracle fell through after 200 attempts without asserting the listener was closed, so a still-open listener could pass as 'pending on the ACL flight'; it now asserts refused. retained-root's 16 s default exceeded the 15 s budget of its first caller, so Bun's timeout, not the helper, would report a slow child; every caller now passes an explicit deadline that fits its own budget. * test(windows): stub icacls in oauth-reauth-bind; widen the startup child port wait Dispatch 33610501053 shard 4: oauth-reauth-bind has no server, so nothing drained the OAuth store's ACL flight before teardown and the icacls child outlived the retry window; both runners are stubbed and the flight flushed. native-profile-startup's child needed 17 s to reach its port file on the loaded shard; the wait is now 18 s inside 20 s+ budgets. * test(oauth-public-surface): stub icacls and flush the ACL flight in a server-less OAuth store test --------- Co-authored-by: jun <[email protected]>
1 parent 19b0157 commit a6ee24f

388 files changed

Lines changed: 1956 additions & 1294 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# 011 — wp2/wp3 evidence: dispatch rounds and reviewer verdicts
2+
3+
## Dispatch 1 — 33595585136 on e1acb7f7a (ACL lifecycle + fsync + fixtures, before review fixes)
4+
5+
| shard | before (33590540220) | after |
6+
|---|---|---|
7+
| windows 1/4 | ~120 fails, account-store/auth-api cascades | 8 fails: service.test ×7 (real icacls given a synthetic SID → EICACLS), issue-702 ×1 (unlinked an unpublished async spill) |
8+
| windows 2/4 | ~100 fails | 2 fails: responses-state budget case (gate swallowed the snapshot harden → 30 s ACL deadline → 60 s ceiling), write-failure case (copy fallback keyed on process.platform) |
9+
| windows 3/4 | ~40 fails | 1 fail: native-profile-manager first-child boot > private 5 s wait |
10+
| windows 4/4 | cancelled | cancelled by the shard-1 gate |
11+
12+
Linux test 3/4 failed once on `late async spill completion` (ETIMEDOUT from the shared ACL budget);
13+
passes 6/6 locally and on the dev push run — treated as the same gate-swallowed-snapshot-harden
14+
mechanism, fixed by `isSpillAclTarget`.
15+
16+
## Dispatch 2 — 33597649234 on 079bec4e0 (all of the above fixed)
17+
18+
windows 1/4 SUCCESS, 2/4 SUCCESS, 3/4 SUCCESS — first Windows-green shards on any branch since
19+
33290817128 (2026-08-30). windows 4/4 cancelled at the 25-minute job ceiling with ZERO test
20+
failures: 199 files done at 06:27:35 (started 06:10:46), then the log ends inside
21+
`responses-native-main-refresh.test.ts` — 8 minutes with no output. The same file passes in
22+
~1.5 s in isolation on the Windows desktop (`desktop-c795oh4`, bun 1.3.14). Shard 4 also carries
23+
`codex-composed-acceptance` (299 s) and `native-profile-startup` (80 s). Investigation: full
24+
shard 4 run on the desktop, log at `C:\Temp\ocx-shard4b.log`.
25+
26+
## Reviewer rounds (read-only, sol/high)
27+
28+
- Lovelace on d0feec0ad..ae6212463: FAIL — P2 flush skipped when an earlier finalizer rejects;
29+
P3 time-based pending oracle. Fixed in 1c41988ad (finally + rejected-release regression, driven red).
30+
- Hooke on origin/dev..079bec4e0 (8 commits): FAIL — P2 admission suite pinned to the sync lane
31+
lost Windows coverage of runPendingResponseSpill; P3 assert the propagated rejection message.
32+
Fixed in 384090052 (two win32 admission variants after queue settle; message asserted).
33+
Confirmed safe: "r+" callers, isSpillAclTarget equivalence, windowsSecretAclApplies() ==
34+
process.platform in production, service.test stub masks nothing, no AGENTS/privacy/Lab violation.
35+
36+
## fuck-powershell
37+
38+
56e1801 async-child-holds-dir-after-stop (87→88), 2f2107d fsync-readonly-handle-eperm +
39+
file-url-pathname-drive-slash (88→90). Graph 313 nodes / 643 edges, validate OK.

‎src/lib/service-secrets.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ export function writeServiceApiTokenFile(token: string): PersistedServiceApiToke
6666
}
6767

6868
function fsyncRegularFile(path: string): void {
69-
const fd = openSync(path, "r");
69+
// "r+", not "r": Windows rejects fsync on a read-only handle with EPERM, so a read-only
70+
// open turned every token backup/replace/restore into a hard failure there.
71+
const fd = openSync(path, "r+");
7072
try { fsyncSync(fd); } finally { closeSync(fd); }
7173
}
7274

‎src/responses/spill-store.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ function isErrno(error: unknown, code: string): boolean {
215215
}
216216

217217
function canUseExclusiveCopyFallback(error: unknown): boolean {
218-
return process.platform === "win32" || ["EPERM", "EACCES", "ENOSYS", "ENOTSUP", "EOPNOTSUPP", "EXDEV"]
218+
// Same platform seam as harden(): a fixture pinned to the POSIX lane on a Windows host must
219+
// see a link failure as a failure, not as a cue to copy.
220+
return windowsSecretAclApplies() || ["EPERM", "EACCES", "ENOSYS", "ENOTSUP", "EOPNOTSUPP", "EXDEV"]
219221
.some(code => isErrno(error, code));
220222
}
221223

@@ -235,7 +237,9 @@ function nextSpillHardenDeadlineMs(budget: SpillAclBudget | undefined): number |
235237
}
236238

237239
function harden(path: string, mode: number, budget?: SpillAclBudget): void {
238-
const aclApplies = budget ? windowsSecretAclApplies() : process.platform === "win32";
240+
// One predicate for both lanes: the test seam that forces a platform must reach the
241+
// sync harden too, or a fixture pinned to "linux" on a Windows host still spawns icacls.
242+
const aclApplies = windowsSecretAclApplies();
239243
try {
240244
chmodSync(path, mode);
241245
} catch {
@@ -384,7 +388,8 @@ function publishNoReplace(
384388
else copyFileSync(tempPath, destinationPath, constants.COPYFILE_EXCL);
385389
copied = true;
386390
harden(destinationPath, 0o600, budget);
387-
const copyFd = openSync(destinationPath, "r");
391+
// "r+": a read-only handle cannot be fsynced on Windows (EPERM).
392+
const copyFd = openSync(destinationPath, "r+");
388393
try {
389394
if (spillIoForTest?.fsync) spillIoForTest.fsync(copyFd);
390395
else fsyncSync(copyFd);
@@ -422,7 +427,7 @@ async function publishNoReplaceAsync(
422427
copied = true;
423428
await hardenAsync(destinationPath, 0o600, budget, retryTimedOutOnce);
424429
throwIfPublicationSuperseded(publicationControl);
425-
const copyFd = openSync(destinationPath, "r");
430+
const copyFd = openSync(destinationPath, "r+");
426431
try {
427432
if (spillIoForTest?.fsync) spillIoForTest.fsync(copyFd);
428433
else fsyncSync(copyFd);

‎tests/account-import.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { afterEach, describe, expect, test } from "bun:test";
2-
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2+
import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
33
import { tmpdir } from "node:os";
44
import { join } from "node:path";
55
import { createAntigravityAccountImportAdapter } from "../src/oauth/account-import/google-antigravity-adapter";
@@ -14,6 +14,7 @@ import {
1414
type ValidatedAntigravityCredential,
1515
} from "../src/oauth/account-import/types";
1616
import { getAccountSet, upsertCredentialByIdentity } from "../src/oauth/store";
17+
import { removeTreeWithRetry } from "./helpers/remove-tree";
1718

1819
const CANARY = "cockpit-canary-refresh-token-DO-NOT-LEAK";
1920
const originalHome = process.env.OPENCODEX_HOME;
@@ -22,7 +23,7 @@ let testHome = "";
2223
afterEach(() => {
2324
if (originalHome === undefined) delete process.env.OPENCODEX_HOME;
2425
else process.env.OPENCODEX_HOME = originalHome;
25-
if (testHome) rmSync(testHome, { recursive: true, force: true });
26+
if (testHome) removeTreeWithRetry(testHome);
2627
testHome = "";
2728
});
2829

‎tests/account-pool-management-api.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
22
import { managementFetch as fetch } from "./helpers/management-auth";
3-
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3+
import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
44
import { tmpdir } from "node:os";
55
import { join } from "node:path";
66
import { handleCodexAuthAPI } from "../src/codex/auth-api";
@@ -32,7 +32,7 @@ describe("Codex account pool strategy management API", () => {
3232
afterEach(() => {
3333
if (previousOpencodexHome === undefined) delete process.env.OPENCODEX_HOME;
3434
else process.env.OPENCODEX_HOME = previousOpencodexHome;
35-
rmSync(TEST_DIR, { recursive: true, force: true });
35+
removeTreeWithRetry(TEST_DIR);
3636
});
3737

3838
test("GET /api/codex-auth/active surfaces strategy defaults", async () => {
@@ -454,7 +454,7 @@ describe("generic OAuth pool-settings contract (#695)", () => {
454454
afterEach(() => {
455455
if (previousHome === undefined) delete process.env.OPENCODEX_HOME;
456456
else process.env.OPENCODEX_HOME = previousHome;
457-
if (testDir) rmSync(testDir, { recursive: true, force: true });
457+
if (testDir) removeTreeWithRetry(testDir);
458458
});
459459

460460
test("GET/PUT round-trip for a generic OAuth provider; api-key providers and bad values get 400", async () => {

‎tests/active-registry-admission.test.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, test } from "bun:test";
2-
import { mkdtempSync, rmSync } from "node:fs";
2+
import { mkdtempSync} from "node:fs";
33
import { tmpdir } from "node:os";
44
import { join } from "node:path";
55
import { MAX_ACTIVE_TURNS, abortAndReleaseAllTurns, activeRegistryMetrics, trackStreamLifetime, tryAdmitTurn, unregisterTurn } from "../src/server/lifecycle";
@@ -24,6 +24,7 @@ import {
2424
import { saveConfig } from "../src/config";
2525
import { startServer } from "../src/server";
2626
import type { OcxConfig } from "../src/types";
27+
import { removeTreeWithRetry } from "./helpers/remove-tree";
2728

2829
describe("active registry admission", () => {
2930
test("active turn 257 returns structured server_busy before handler work", async () => {
@@ -54,7 +55,7 @@ describe("active registry admission", () => {
5455
await server.stop(true);
5556
if (previousHome === undefined) delete process.env.OPENCODEX_HOME;
5657
else process.env.OPENCODEX_HOME = previousHome;
57-
rmSync(home, { recursive: true, force: true });
58+
removeTreeWithRetry(home);
5859
}
5960
});
6061

@@ -86,7 +87,7 @@ describe("active registry admission", () => {
8687
await server.stop(true);
8788
if (previousHome === undefined) delete process.env.OPENCODEX_HOME;
8889
else process.env.OPENCODEX_HOME = previousHome;
89-
rmSync(home, { recursive: true, force: true });
90+
removeTreeWithRetry(home);
9091
}
9192
});
9293

@@ -138,7 +139,7 @@ describe("active registry admission", () => {
138139
upstream.stop(true);
139140
if (previousHome === undefined) delete process.env.OPENCODEX_HOME;
140141
else process.env.OPENCODEX_HOME = previousHome;
141-
rmSync(home, { recursive: true, force: true });
142+
removeTreeWithRetry(home);
142143
}
143144
});
144145

‎tests/adapter-event-oauth-failover.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
2-
import { mkdtempSync, rmSync } from "node:fs";
2+
import { mkdtempSync} from "node:fs";
33
import { tmpdir } from "node:os";
44
import { join } from "node:path";
55
import type { ProviderAdapter } from "../src/adapters/base";
66
import { clearGenericFailoverHealth } from "../src/oauth/generic-account-failover";
77
import { saveCredential } from "../src/oauth/store";
88
import type { AdapterEvent, OcxConfig, OcxProviderConfig } from "../src/types";
9+
import { removeTreeWithRetry } from "./helpers/remove-tree";
910

1011
const actualResolver = await import("../src/server/adapter-resolve");
1112
const actualResolveAdapter = actualResolver.resolveAdapter;
@@ -94,7 +95,7 @@ afterEach(() => {
9495
clearGenericFailoverHealth();
9596
if (originalHome === undefined) delete process.env.OPENCODEX_HOME;
9697
else process.env.OPENCODEX_HOME = originalHome;
97-
rmSync(home, { recursive: true, force: true });
98+
removeTreeWithRetry(home);
9899
});
99100

100101
describe("#2568 adapter-event OAuth failover", () => {

‎tests/agent-task-recovery-combo.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
2-
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
2+
import { existsSync, mkdtempSync, readFileSync} from "node:fs";
33
import { tmpdir } from "node:os";
44
import { join } from "node:path";
55
import {
@@ -20,6 +20,7 @@ import {
2020
recoverySse,
2121
routedConfig,
2222
} from "./helpers/agent-task-recovery";
23+
import { removeTreeWithRetry } from "./helpers/remove-tree";
2324

2425
function providerCompletion(): Response {
2526
return Response.json({
@@ -60,7 +61,7 @@ describe("combo path encrypted agent task recovery", () => {
6061
globalThis.fetch = originalFetch;
6162
resetAgentTaskRecoveryState();
6263
clearResponseStateForTests();
63-
rmSync(home, { recursive: true, force: true });
64+
removeTreeWithRetry(home);
6465
if (priorHome === undefined) delete process.env["OPENCODEX_HOME"];
6566
else process.env["OPENCODEX_HOME"] = priorHome;
6667
});

‎tests/alibaba-region-backup.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import {
66
AlibabaBackupIntegrityError,
77
backupConfigBeforeAlibabaRegionMigration,
88
} from "../src/providers/alibaba-region-backup";
9+
import { removeTreeWithRetry } from "./helpers/remove-tree";
910

1011
test("absent source produces no backup", () => {
1112
const dir = mkdtempSync(join(tmpdir(), "ocx-bak-"));
1213
try {
1314
expect(backupConfigBeforeAlibabaRegionMigration(join(dir, "config.json"))).toBe("absent");
14-
} finally { rmSync(dir, { recursive: true, force: true }); }
15+
} finally { removeTreeWithRetry(dir); }
1516
});
1617

1718
test("creates a snapshot, then never replaces it", () => {
@@ -24,7 +25,7 @@ test("creates a snapshot, then never replaces it", () => {
2425
expect(readFileSync(backupPath, "utf8")).toBe('{"before":true}');
2526
expect(backupConfigBeforeAlibabaRegionMigration(configPath)).toBe("reused");
2627
expect(readFileSync(backupPath, "utf8")).toBe('{"before":true}');
27-
} finally { rmSync(dir, { recursive: true, force: true }); }
28+
} finally { removeTreeWithRetry(dir); }
2829
});
2930

3031
test("an existing snapshot is kept even after the config legitimately changes", () => {
@@ -40,7 +41,7 @@ test("an existing snapshot is kept even after the config legitimately changes",
4041
expect(backupConfigBeforeAlibabaRegionMigration(configPath)).toBe("reused");
4142
// The earliest snapshot survives: it predates every migration.
4243
expect(readFileSync(backupPath, "utf8")).toBe('{"before":true}');
43-
} finally { rmSync(dir, { recursive: true, force: true }); }
44+
} finally { removeTreeWithRetry(dir); }
4445
});
4546

4647
test("a short copy is never published", () => {
@@ -56,7 +57,7 @@ test("a short copy is never published", () => {
5657
remove: path => rmSync(path, { force: true }),
5758
})).toThrow(AlibabaBackupIntegrityError);
5859
expect(existsSync(`${configPath}.pre-alibaba-region-v1.bak`)).toBe(false);
59-
} finally { rmSync(dir, { recursive: true, force: true }); }
60+
} finally { removeTreeWithRetry(dir); }
6061
});
6162

6263
test("a failed copy leaves no snapshot and no temp file", () => {
@@ -74,5 +75,5 @@ test("a failed copy leaves no snapshot and no temp file", () => {
7475
})).toThrow("disk full");
7576
expect(existsSync(`${configPath}.pre-alibaba-region-v1.bak`)).toBe(false);
7677
expect(removed).toHaveLength(1);
77-
} finally { rmSync(dir, { recursive: true, force: true }); }
78+
} finally { removeTreeWithRetry(dir); }
7879
});

‎tests/alibaba-region-migration.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { expect, test } from "bun:test";
2-
import { mkdtempSync, rmSync } from "node:fs";
2+
import { mkdtempSync} from "node:fs";
33
import { tmpdir } from "node:os";
44
import { join } from "node:path";
55
import { loadConfig, saveConfig } from "../src/config";
66
import { projectAlibabaRegionMigration } from "../src/providers/alibaba-region-migration";
77
import { routeModel } from "../src/router";
88
import type { OcxConfig } from "../src/types";
9+
import { removeTreeWithRetry } from "./helpers/remove-tree";
910

1011
const INTL_URL = "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1";
1112

@@ -70,7 +71,7 @@ test("the migrated config survives a reload", () => {
7071
} finally {
7172
if (prev === undefined) delete process.env.OPENCODEX_HOME;
7273
else process.env.OPENCODEX_HOME = prev;
73-
rmSync(home, { recursive: true, force: true });
74+
removeTreeWithRetry(home);
7475
}
7576
});
7677

@@ -142,7 +143,7 @@ test("a namespace-blocked migration remains valid across reload", () => {
142143
} finally {
143144
if (prev === undefined) delete process.env.OPENCODEX_HOME;
144145
else process.env.OPENCODEX_HOME = prev;
145-
rmSync(home, { recursive: true, force: true });
146+
removeTreeWithRetry(home);
146147
}
147148
});
148149

0 commit comments

Comments
 (0)