Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/codex/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ export function defaultCodexHome(deps: CodexHomeDeps = {}): string {
return findWslWindowsCodexHome(deps) ?? defaultHome;
}

/** Files and directories Codex itself writes into a home it is using. */
const LOCAL_CODEX_STATE = ["config.toml", "auth.json", "sessions", "history.jsonl"] as const;

function localCodexHomeInUse(home: string, deps: CodexHomeDeps): boolean {
return LOCAL_CODEX_STATE.some(entry => pathPresent(join(home, entry), deps));
// Files and directories Codex itself writes into a home it is using. Kept local: defaultCodexHome
// runs during other modules' initialisation (the storage workers reach it through an import
// cycle), and a module-level const declared below it is still in its temporal dead zone then.
return ["config.toml", "auth.json", "sessions", "history.jsonl"].some(entry => pathPresent(join(home, entry), deps));
}

/** stat-based presence: an unexpected stat error counts as present, never as a reason to switch homes. */
Expand Down
8 changes: 6 additions & 2 deletions tests/providers/codebuddy-mcp-server.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { afterEach, describe, expect, test } from "bun:test";
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { mkdtempSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { removeTreeWithRetry } from "../helpers/remove-tree";
import { CODEBUDDY_TOOL_LIMITS } from "../../src/adapters/codebuddy/tool-bridge";
import { codeBuddyMcpInvocation } from "../../src/adapters/coding-agent/turn";

Expand Down Expand Up @@ -49,7 +50,10 @@ async function rejectedCatalog(rawCatalog: string): Promise<string> {

afterEach(() => {
for (const dir of tempDirs.splice(0)) {
rmSync(dir, { recursive: true, force: true });
// Windows keeps the compiled ocx executable locked for a moment after its process exits, so
// a plain rmSync fails with EBUSY; the shared helper waits on the same bounded schedule as
// every other fixture teardown.
removeTreeWithRetry(dir);
}
});

Expand Down
Loading