Repository navigation
fix(computer-use): stop computer_run schema from emitting $ref pointers - #6480
Open
horizonbymuneeb wants to merge 1 commit into
Open
horizonbymuneeb wants to merge 1 commit into
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>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Contributor
Contributor screen: passedCommit No hidden characters, dependency, database or obfuscation concerns. Nothing else runs yet. A maintainer reviews the changes then comments |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).