fix(codex): use codexHomeDir() fallback for accurate auth detail path

When adapter config has no CODEX_HOME but process.env.CODEX_HOME is
set, readCodexAuthInfo reads from the process env path. The detail
message now uses codexHomeDir() instead of hardcoded "~/.codex" so
the displayed path always matches where credentials were read from.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Devin Foley
2026-03-24 12:46:16 -07:00
parent 4da83296a9
commit 4eecd23ea3

View File

@@ -15,7 +15,7 @@ import {
} from "@paperclipai/adapter-utils/server-utils";
import path from "node:path";
import { parseCodexJsonl } from "./parse.js";
import { readCodexAuthInfo } from "./quota.js";
import { codexHomeDir, readCodexAuthInfo } from "./quota.js";
function summarizeStatus(checks: AdapterEnvironmentCheck[]): AdapterEnvironmentTestResult["status"] {
if (checks.some((check) => check.level === "error")) return "fail";
@@ -116,7 +116,7 @@ export async function testEnvironment(
code: "codex_native_auth_present",
level: "info",
message: "Codex is authenticated via its own auth configuration.",
detail: codexAuth.email ? `Logged in as ${codexAuth.email}.` : `Credentials found in ${codexHome ?? "~/.codex"}/auth.json.`,
detail: codexAuth.email ? `Logged in as ${codexAuth.email}.` : `Credentials found in ${codexHome ?? codexHomeDir()}/auth.json.`,
});
} else {
checks.push({