Repository navigation
fix(computer-use): stop computer_run schema from emitting $ref pointers - #6480
horizonbymuneeb wants to merge 1 commit into
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Contributor screen: passedCommit No hidden characters, dependency, database or obfuscation concerns. Nothing else runs yet. A maintainer reviews the changes then comments |
|
Closing this one — #6491 landed the same fix on For the record, this branch reached the same diagnosis independently: Thanks for the review time. |
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'sinputargument is declaredz.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$defsdoes 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: newjsonValueunion (string | number | boolean | null | array | object) that validates the same JSON values asz.json()but serializes to plain nested JSON Schema; bothcomputer_runuses ofz.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
z.toJSONSchemaofcomputer_runargs contains"$ref":"#/$defs/__schema0"→ no$ref,inputis ananyOfof the six JSON value types.apps/server/test/computer-use-tools.vitest.test.ts: 3 existing + 1 new test pass.npx vitest runon the two changed files; full repo typecheck/build left to CI (heavy monorepo install).