fix(codex): allow env api-key app-server bootstrap · openclaw/openclaw@009b18c
steipete
·
2026-05-26
·
via Recent Commits to openclaw:main
File tree
extensions/codex/src/app-server
| Original file line number | Diff line number | Diff line change |
|---|
@@ -32,6 +32,7 @@ Docs: https://docs.openclaw.ai
|
32 | 32 | - Agents/media: send direct fallback for generated media still missing after an active requester wake fails. (#85489) Thanks @fuller-stack-dev. |
33 | 33 | - Agents: derive overflow compaction budgets from provider-reported and synthetic over-budget token counts so confirmed context overflows compact before retrying. (#70473) Thanks @fuller-stack-dev. |
34 | 34 | - Agents/Codex: recover Codex context-window prompt errors through overflow compaction and surface reset guidance when recovery is exhausted. (#85542) Thanks @fuller-stack-dev. |
| 35 | +- Agents/Codex: allow Codex app-server runs to bootstrap from `CODEX_API_KEY` or `OPENAI_API_KEY` when no Codex auth profile is configured. |
35 | 36 | - Agent transcript: include OpenClaw agent session logs when finding local transcript candidates. |
36 | 37 | - Crabbox: bootstrap raw AWS macOS shell commands wrapped in absolute `time` paths so RSS probes can run Node and pnpm on fresh macOS runners. |
37 | 38 | - Crabbox: bootstrap raw AWS macOS shell commands even when setup statements precede Node or pnpm usage. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1016,7 +1016,7 @@ describe("bridgeCodexAppServerStartOptions", () => {
|
1016 | 1016 | } |
1017 | 1017 | }); |
1018 | 1018 | |
1019 | | -it("skips env API-key fallback when app-server does not require OpenAI auth", async () => { |
| 1019 | +it("uses env API-key fallback when app-server has no account", async () => { |
1020 | 1020 | const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-codex-app-server-")); |
1021 | 1021 | const request = vi.fn(async (method: string) => { |
1022 | 1022 | if (method === "account/read") { |
@@ -1032,8 +1032,11 @@ describe("bridgeCodexAppServerStartOptions", () => {
|
1032 | 1032 | startOptions: createStartOptions(), |
1033 | 1033 | }); |
1034 | 1034 | |
1035 | | -expect(request).toHaveBeenCalledTimes(1); |
1036 | | -expect(request).toHaveBeenCalledWith("account/read", { refreshToken: false }); |
| 1035 | +expect(request).toHaveBeenNthCalledWith(1, "account/read", { refreshToken: false }); |
| 1036 | +expect(request).toHaveBeenNthCalledWith(2, "account/login/start", { |
| 1037 | +type: "apiKey", |
| 1038 | +apiKey: "codex-env-api-key", |
| 1039 | +}); |
1037 | 1040 | } finally { |
1038 | 1041 | await fs.rm(agentDir, { recursive: true, force: true }); |
1039 | 1042 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -403,7 +403,7 @@ async function resolveCodexAppServerEnvApiKeyLoginParams(params: {
|
403 | 403 | const response = await params.client.request<CodexGetAccountResponse>("account/read", { |
404 | 404 | refreshToken: false, |
405 | 405 | }); |
406 | | -if (response.account || !response.requiresOpenaiAuth) { |
| 406 | +if (response.account) { |
407 | 407 | return undefined; |
408 | 408 | } |
409 | 409 | return { type: "apiKey", apiKey }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -129,6 +129,13 @@ describe("provider env vars dynamic manifest metadata", () => {
|
129 | 129 | expect(listKnownSecretEnvVarNames()).toContain("FIREWORKS_ALT_API_KEY"); |
130 | 130 | }); |
131 | 131 | |
| 132 | +it("lets openai-codex bootstrap from Codex app-server API-key env", () => { |
| 133 | +expect(resolveProviderAuthEnvVarCandidates()["openai-codex"]).toEqual([ |
| 134 | +"CODEX_API_KEY", |
| 135 | +"OPENAI_API_KEY", |
| 136 | +]); |
| 137 | +}); |
| 138 | + |
132 | 139 | it("includes setup provider env vars without loading setup runtime", () => { |
133 | 140 | pluginRegistryMocks.loadPluginManifestRegistryForInstalledIndex.mockReturnValue({ |
134 | 141 | plugins: [ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -18,6 +18,7 @@ import { uniqueStrings } from "../shared/string-normalization.js";
|
18 | 18 | const CORE_PROVIDER_AUTH_ENV_VAR_CANDIDATES = { |
19 | 19 | anthropic: ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"], |
20 | 20 | openai: ["OPENAI_API_KEY"], |
| 21 | +"openai-codex": ["CODEX_API_KEY", "OPENAI_API_KEY"], |
21 | 22 | voyage: ["VOYAGE_API_KEY"], |
22 | 23 | cerebras: ["CEREBRAS_API_KEY"], |
23 | 24 | "anthropic-openai": ["ANTHROPIC_API_KEY"], |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。