Skip to content

# Bug: Automations fail with invalid_prompt on OpenRouter provider (Responses wire API) #43740

Open

Description

@nana7536

What version of the Codex App are you using (From “About Codex” dialog)?

Environment - Codex Desktop on Windows 11, CLI version 0.151.0-alpha.7.2 - Provider config: model_provider = "openrouter", base_url = "https://openrouter.ai/api/v1", wire_api = "responses" - Models tested: z-ai/glm-5.3-flash, moonshotai/kimi-k3 — both fail identically

What subscription do you have?

openrouter

What platform is your computer?

No response

What issue are you seeing?

Symptom

All scheduled automations (2 cron + 1 heartbeat) trigger on time but every run terminates within ~4 seconds, before any business logic executes. The task_complete event carries:

{"error":{"code":"invalid_prompt","message":"Invalid Responses API request"}}

This has failed on every scheduled run since at least 2026-09-02 (multiple CLI versions). Changing the automation's model does NOT help — the same failure occurs on every OpenRouter-backed model.

Root cause (from session logs)

The Zod validation error is at input item index 2:

branch 0: Invalid input: expected string, received array
branch 1: input[2]: Invalid input | input[13]: Invalid input | ...

Item 2 in the automation's initial context is a function_call_output injected by Codex itself, for the codex_app/automation_update tool:

{"type":"function_call_output","id":"fco_...","name":"automation_update","namespace":"codex_app","output":"..."}

This item fails OpenRouter's Responses API schema validation. The same models work fine in normal interactive sessions (which don't contain this injected item), so the issue is specifically the automation-context serialization vs. OpenRouter's Responses validation.

Expected behavior

Automations should run on OpenRouter-backed models, or the injected automation_update function_call_output should be serialized in a shape that passes Responses validation (or omitted from the request).

Reproduction

  1. Configure Codex with OpenRouter as model provider (wire_api = "responses").
  2. Create any automation (cron or heartbeat).
  3. Wait for a scheduled run — it fails immediately with invalid_prompt.

Logs

Happy to attach full rollout JSONL from ~/.codex/sessions/ on request.

What steps can reproduce the bug?

Configure Codex with OpenRouter as model provider (wire_api = "responses").

Create any automation (cron or heartbeat).

Wait for a scheduled run — it fails immediately with invalid_prompt.

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    appIssues related to the Codex desktop app
    on Sep 8, 2026
  2. added
    bugSomething isn't working
    custom-modelIssues related to custom model providers (including local models)
    on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appautomationsbugSomething isn't workingcustom-modelIssues related to custom model providers (including local models)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions