Skip to content

fix(channel): keep desktop_clipboard_write schema a top-level object - #241

Merged
iamnbutler merged 1 commit into
mainfrom
openai-tool-schema
Oct 14, 2026
Merged

iamnbutler merged 1 commit into
mainfrom
openai-tool-schema

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

Fixes #192.

OpenAI rejects any function whose parameters lack type: "object" at the top level or carry oneOf/anyOf/allOf/enum/const/not there. desktop_clipboard_write declared its three exclusive forms (text; format: "image" + path; format: "files" + paths) with a top-level oneOf, so openai/gpt-4.1-mini failed every request with HTTP 400 before any tool ran.

The schema is now a plain object with all four fields optional and additionalProperties: false. The handler already accepted only those three exact combinations and threw otherwise, so valid calls behave identically; an invalid combination now fails in the handler with "Supply text, format image with path, or format files with paths." instead of at schema validation. The schema is defined in Ace (packages/channel/src/desktop.ts), not in the desktop-tools package, so no upstream change is needed.

Audit. I built every extension the channel installs (CodingTools, desktop, browser, lanes, Subagent, metadata, messaging) and checked all 36 shipped tool schemas for a non-object top level or a top-level oneOf/anyOf/allOf/enum/const/not. Before this change only desktop_clipboard_write failed. After it, none do. Unions nested inside properties (desktop_launch.application, desktop_open.item, etc.) stay as they are; OpenAI allows them in non-strict mode, which pi-ai uses by default.

Verification.

  • bun types and bun run ci pass.
  • I did not get a real gpt-4.1-mini acceptance check. I sent the full 36-tool list through pi-ai's openai-responses path with the shell's OPENAI_API_KEY, both before and after the fix. Both requests failed with 401 invalid_organization, so authentication failed before OpenAI checked the schemas. The only other OpenAI credential is in the ace-dev keychain, and reading it needs an interactive macOS keychain prompt, so I didn't use it. Someone with a working key should confirm that a gpt-4.1-mini channel's first turn succeeds.

Built in Ace

No. Made by a Claude Code subagent in a terminal at the maintainer's choice for this session; not an Ace capability gap. Dogfooding: #5.

@iamnbutler
iamnbutler merged commit 04660d9 into main Oct 14, 2026
1 check passed
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.

OpenAI rejects desktop_clipboard_write top-level union schema on gpt-4.1-mini

1 participant