Skip to content

fix: handle missing required params for OpenAI/GPT-5 function calling (Skill tool)#482

Open
pollmap wants to merge 1 commit intoGitlawb:mainfrom
pollmap:fix/skill-tool-missing-param-gpt
Open

fix: handle missing required params for OpenAI/GPT-5 function calling (Skill tool)#482
pollmap wants to merge 1 commit intoGitlawb:mainfrom
pollmap:fix/skill-tool-missing-param-gpt

Conversation

@pollmap
Copy link
Copy Markdown

@pollmap pollmap commented Apr 7, 2026

Problem

When using OpenClaude with GPT-5/Codex backends, slash commands such as /commit or /review-pr trigger a Skill tool call without the required skill parameter:

```
InputValidationError: Skill failed due to the following issue:
The required parameter skill is missing
```

Root Cause

OpenAI function calling relies heavily on the JSON schema `description` field to infer parameter values. The previous `skill` description did not explicitly document:

  1. That the leading `/` must be stripped (`/commit` → `skill: "commit"`)
  2. The exact input→parameter mapping with concrete examples

As a result, GPT-5 calls `Skill({})` or `Skill({skill: undefined})` instead of `Skill({skill: "commit"})`.

Changes

  • `inputSchema`: Expanded `skill` description with concrete slash-stripping examples for GPT-style function calling
  • `validateInput`: Added null/undefined guard before `skill.trim()` with an actionable error message for non-Claude runtimes
  • `prompt.ts`: Appended `IMPORTANT for OpenAI/GPT function calling` block reinforcing the required parameter contract

Affected Provider

OpenAI-compatible / Codex backends only. Claude (Anthropic) behaviour is unchanged.

Tested With

OpenClaude v0.1.8 + Codex Spark (`https://chatgpt.com/backend-api/codex\`) via ChatGPT Pro OAuth

When using OpenClaude with GPT-5/Codex backends, slash commands such as
/skill-name trigger a Skill tool call without the required `skill` parameter,
resulting in: "The required parameter `skill` is missing".

Root cause: OpenAI function calling relies heavily on schema descriptions to
infer parameter values. The previous description did not make the
slash-to-parameter mapping explicit, causing GPT-5 to call Skill({}) or
Skill({skill: undefined}) instead of Skill({skill: "skill-name"}).

Changes:
- inputSchema: expand `skill` description to explicitly document that the
  leading slash must be stripped (/commit → skill: "commit") with concrete
  input/output examples for GPT-style function calling
- validateInput: add a null/undefined guard before skill.trim() to produce
  an actionable error message when non-Claude runtimes omit the parameter
- prompt.ts: append a short IMPORTANT block for OpenAI/GPT function calling
  that reinforces the required parameter contract and slash-stripping rule

Affected provider: OpenAI-compatible / Codex backends only.
Claude (Anthropic) behaviour is unchanged.
Copy link
Copy Markdown
Contributor

@kevincodex1 kevincodex1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! We just need to make sure this will not affect other models

Copy link
Copy Markdown
Collaborator

@gnanam1990 gnanam1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and for digging into this. The direction looks right, and the prompt/schema improvements seem helpful for GPT-style function calling. I do have one blocking concern before we merge:

  1. The missing-skill runtime path still doesn’t appear to be fully handled. tool.inputSchema.safeParse(input) runs before validateInput(), so calls like Skill({}) or Skill({ skill: undefined }) will still fail in Zod first and never reach the new null/undefined guard.
  2. There isn’t a regression test covering that exact missing-parameter path, so it’s hard to verify the reported issue is actually fixed rather than just better-guided.

Could you take another look and either adjust the schema/validation flow for that case, or narrow the PR description to “improve model guidance” and add a regression test for the actual failure mode? Happy to discuss if helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants