Skip to content

openai-codex/gpt-5.4 sessions crash silently when MCP tools have parameter-free schemas #58246

Description

@rixcorp-oc

Summary

Agents running on openai-codex/gpt-5.4 (or any openai-codex-responses API) crash silently with zero output when any MCP server is configured that exposes tools with no parameters (e.g. aws___list_regions).

The session immediately terminates with stopReason: "error" and 0 tokens consumed. From the user's perspective it looks like a model timeout or silent failure — nothing is surfaced in the UI.

Root Cause

The OpenAI Responses API requires all type: "object" tool schemas to include a properties field, even if empty. MCP tools with no parameters are typically defined as:

{ "type": "object" }

The API rejects this with:

Invalid schema for function 'aws___list_regions': In context=(), object schema missing properties.

This crashes the entire session — not just the offending tool call — before a single token is generated.

Two Affected Locations

1. @mariozechner/pi-aiconvertResponsesTools() (critical path)

// providers/openai-responses-shared.js
export function convertResponsesTools(tools, options) {
    const strict = options?.strict === undefined ? false : options.strict;
    return tools.map((tool) => ({
        type: "function",
        name: tool.name,
        description: tool.description,
        parameters: tool.parameters, // passed directly with no normalization
        strict,
    }));
}

Tool parameters are passed directly to the API with no schema normalization. Any type: "object" schema missing properties reaches the wire unchanged.

2. OpenClaw → normalizeToolParameters() (defence-in-depth)

The existing normalizer in auth-profiles-B5ypC5S-.js handles:

  • type: "object" with properties → passes through ✅
  • No type field but has properties → injects type: "object"
  • type: "object" without properties → falls through unchanged ❌

This gap means even if a fix is applied in the normalizer, the pi-ai layer bypasses it entirely.

Fix

In both locations, normalize { type: "object" }{ type: "object", properties: {} }:

// convertResponsesTools fix
if (parameters?.type === "object" && !("properties" in parameters)) {
    parameters = { ...parameters, properties: {} };
}
// normalizeToolParameters fix (additional branch)
if ("type" in schema && !("properties" in schema) && !Array.isArray(schema.anyOf) && !Array.isArray(schema.oneOf)) {
    return preserveToolMeta({ ...tool, parameters: applyProviderCleaning({ ...schema, properties: {} }) });
}

These are semantically identical in JSON Schema — { type: "object" } and { type: "object", properties: {} } both mean "accept any object". The change is safe for all other providers.

Impact

  • All agents on openai-codex/gpt-5.4 with any no-parameter MCP tool configured fail completely
  • Silent failure — looks like a model hang, not a schema error
  • Affects any MCP server that exposes informational/query tools with no input parameters (common pattern)

Workaround

Applied a local patch to convertResponsesTools() in @mariozechner/pi-ai which resolves the issue. Verified working: agent spawns successfully, returns output, 0 tokens → 19k tokens after patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions