openclaw/extensions/codex/api.ts
Peter Steinberger ce5322924b
fix(auth): explain missing Codex profiles after upgrades (#153051)
Explain missing native-only Codex profiles after upgrades through shared Codex-plugin Doctor and Gateway startup warnings. Keep recovery explicit with provider device-code login and per-agent guidance; warnings do not import credentials or block updates.

Preserve local selected-profile lookup failures across rotation, fallback, and tracing without manufacturing HTTP 401 or misleading reauthentication advice. Keep real provider HTTP failures and credential ownership unchanged. Document the verified shared-store preparation command for upgrades from 2026.9.4.

Thanks @msobrosa for the upgrade report and native-credential ownership confirmation, and @kpwillis for the separate shared-store diagnostics.

Validation: 44 focused assertion-cutover tests passed; changed-file checks passed with the documented nested-checkout extension-lint substitute and failing canary. Published 2026.9.4-to-2026.9.5 proof used isolated synthetic credentials; live OAuth was not exercised. Exact-head CI and independent review passed.

Fixes #152968. Shared-store routing report #148557 remains separate.
2026-09-19 16:37:47 -07:00

22 lines
867 B
TypeScript

import path from "node:path";
import { fileURLToPath } from "node:url";
import type { HealthCheck } from "openclaw/plugin-sdk/health";
import { codexNativeProfileRecoveryHealthCheck } from "./src/auth-profile-health.js";
import {
CODEX_MANAGED_APP_SERVER_CHECK_ID,
registerCodexManagedAppServerDoctorChecks as registerChecks,
} from "./src/doctor.js";
const CODEX_PLUGIN_ROOT = path.dirname(fileURLToPath(import.meta.url));
export { CODEX_MANAGED_APP_SERVER_CHECK_ID };
export function registerCodexManagedAppServerDoctorChecks(host: {
getHealthCheck(id: string): HealthCheck | undefined;
registerHealthCheck(check: HealthCheck): void;
}): void {
registerChecks({ ...host, pluginRoot: CODEX_PLUGIN_ROOT });
if (!host.getHealthCheck(codexNativeProfileRecoveryHealthCheck.id)) {
host.registerHealthCheck(codexNativeProfileRecoveryHealthCheck);
}
}