fix(cli): reject codex simple-completion probes · openclaw/openclaw@292bbcc
steipete
·
2026-05-03
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,7 @@ Docs: https://docs.openclaw.ai
|
12 | 12 | |
13 | 13 | ### Fixes |
14 | 14 | |
| 15 | +- CLI/infer: reject local `codex/*` one-shot model probes before simple-completion dispatch and point operators at the Codex app-server runtime path instead of ending with an empty-output error. |
15 | 16 | - Agents/sessions: preserve terminal lifecycle state when final run metadata persists from a stale in-memory snapshot, preventing `main` sessions from staying stuck as running after completed or timed-out turns. |
16 | 17 | - Gateway/CLI: make `openclaw gateway start` repair stale managed service definitions that point at old OpenClaw versions, missing binaries, or temporary installer paths before starting. |
17 | 18 | - Heartbeat/scheduler: make heartbeat phase scheduling active-hours-aware so the scheduler seeks forward to the first in-window phase slot instead of arming timers for quiet-hours slots and relying solely on the runtime guard. Non-UTC `activeHours.timezone` values (e.g. `Asia/Shanghai`) now correctly influence when the next heartbeat timer fires, avoiding wasted quiet-hours ticks and long dormant gaps after gateway restarts. Fixes #75487. Thanks @amknight. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -547,6 +547,48 @@ describe("capability cli", () => {
|
547 | 547 | expect(mocks.runtime.writeJson).not.toHaveBeenCalled(); |
548 | 548 | }); |
549 | 549 | |
| 550 | +it("rejects local Codex provider probes before simple-completion dispatch", async () => { |
| 551 | +mocks.prepareSimpleCompletionModelForAgent.mockResolvedValueOnce({ |
| 552 | +selection: { |
| 553 | +provider: "codex", |
| 554 | +modelId: "gpt-5.4", |
| 555 | +agentDir: "/tmp/agent", |
| 556 | +}, |
| 557 | +model: { |
| 558 | +provider: "codex", |
| 559 | +id: "gpt-5.4", |
| 560 | +api: "openai-codex-responses", |
| 561 | +}, |
| 562 | +auth: { |
| 563 | +apiKey: "codex-app-server", |
| 564 | +source: "codex-app-server", |
| 565 | +mode: "token", |
| 566 | +}, |
| 567 | +} as never); |
| 568 | + |
| 569 | +await expect( |
| 570 | +runRegisteredCli({ |
| 571 | +register: registerCapabilityCli as (program: Command) => void, |
| 572 | +argv: [ |
| 573 | +"capability", |
| 574 | +"model", |
| 575 | +"run", |
| 576 | +"--model", |
| 577 | +"codex/gpt-5.4", |
| 578 | +"--prompt", |
| 579 | +"hello", |
| 580 | +"--json", |
| 581 | +], |
| 582 | +}), |
| 583 | +).rejects.toThrow("exit 1"); |
| 584 | + |
| 585 | +expect(mocks.runtime.error).toHaveBeenCalledWith( |
| 586 | +expect.stringContaining("Codex app-server agent runtime"), |
| 587 | +); |
| 588 | +expect(mocks.completeWithPreparedSimpleCompletionModel).not.toHaveBeenCalled(); |
| 589 | +expect(mocks.runtime.writeJson).not.toHaveBeenCalled(); |
| 590 | +}); |
| 591 | + |
550 | 592 | it.each(["", " ", "\n\t"])( |
551 | 593 | "rejects empty model run prompts before local dispatch (%j)", |
552 | 594 | async (prompt) => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -654,6 +654,11 @@ async function runModelRun(params: {
|
654 | 654 | if ("error" in prepared) { |
655 | 655 | throw new Error(prepared.error); |
656 | 656 | } |
| 657 | +if (prepared.selection.provider === "codex") { |
| 658 | +throw new Error( |
| 659 | +'The codex provider is served by the Codex app-server agent runtime, not the local simple-completion transport. Use an openai/<model> ref with agents.defaults.agentRuntime.id: "codex", run through the gateway, or use /codex commands.', |
| 660 | +); |
| 661 | +} |
657 | 662 | const result = await completeWithPreparedSimpleCompletionModel({ |
658 | 663 | model: prepared.model, |
659 | 664 | auth: prepared.auth, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。