Skip to content

fix(computer-use): stop computer_run schema from emitting $ref pointers - #6480

Open
horizonbymuneeb wants to merge 1 commit into
different-ai:devfrom
horizonbymuneeb:fix/computer-run-json-schema-ref
Open

horizonbymuneeb wants to merge 1 commit into
different-ai:devfrom
horizonbymuneeb:fix/computer-run-json-schema-ref

Conversation

@horizonbymuneeb

Copy link
Copy Markdown

What is this about?

Fix the "Invalid schema for function 'computer_run': Pointer '/$defs/__schema0' does not exist" error that blocks every chat on 0.18.60+.

What problem does it solve?

computer_run's input argument is declared z.json(). Zod 4 serializes that to {"$ref":"#/$defs/__schema0"} with the definition in a top-level $defs. The engine hands the tool schema to the model provider, the $defs does not travel with the $ref, and providers reject the request — every message carries the computer-use tools, so every message fails.

What was the situation before?

Every chat, old or new, fails with Invalid schema for function 'computer_run': Pointer '/$defs/__schema0' does not exist (request_id: ...) after upgrading from 0.18.58.

How is this implemented?

  • apps/server/src/opencode-plugins/openwork-computer-use.ts: new jsonValue union (string | number | boolean | null | array | object) that validates the same JSON values as z.json() but serializes to plain nested JSON Schema; both computer_run uses of z.json() now use it.
  • apps/server/test/computer-use-tools.vitest.test.ts: regression test asserting no computer tool schema serializes $ref.

What else changed?

none

Release note

Computer use no longer breaks every chat with a provider schema error.

Evidence

  • Before → after, on the real plugin file: z.toJSONSchema of computer_run args contains "$ref":"#/$defs/__schema0" → no $ref, input is an anyOf of the six JSON value types.
  • apps/server/test/computer-use-tools.vitest.test.ts: 3 existing + 1 new test pass.
  • Run with npx vitest run on the two changed files; full repo typecheck/build left to CI (heavy monorepo install).

z.json() serializes to {"$ref":"#/$defs/__schema0"} plus top-level $defs.
Model providers reject the dangling pointer, so every chat request carrying
the computer_run tool failed with 'Invalid schema for function computer_run'.
Spell the JSON value union out instead so the tool schema is plain nested
JSON Schema.

Signed-off-by: Muneeb Anjum <horizonbymuneeb@users.noreply.github.com>
@vercel

vercel Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Skipped Skipped Oct 25, 2026 9:48am UTC
openwork-den Skipped Skipped Oct 25, 2026 9:48am UTC
openwork-diagnostics Skipped Skipped Oct 25, 2026 9:48am UTC
openwork-landing Skipped Skipped Oct 25, 2026 9:48am UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – openwork-landing October 25, 2026 09:48 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den October 25, 2026 09:48 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics October 25, 2026 09:48 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app October 25, 2026 09:48 Inactive
@github-actions

Copy link
Copy Markdown
Contributor

Contributor screen: passed

Commit 799d3795a9 · run

No hidden characters, dependency, database or obfuscation concerns.

Nothing else runs yet. A maintainer reviews the changes then comments /test to start the AI screen, the tests and the Warden security review.

This branch was previously deployed

4 inactive deployments
Preview – openwork-landing — 799d3795 Deployed Oct 25, 2026 by vercel[bot]
Preview – openwork-den — 799d3795 Deployed Oct 25, 2026 by vercel[bot]
Preview – openwork-diagnostics — 799d3795 Deployed Oct 25, 2026 by vercel[bot]
Preview – openwork-app — 799d3795 Deployed Oct 25, 2026 by vercel[bot]
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.

1 participant