Skip to content

compute_job tool sends invalid JSON Schema (type: null) to strict providers like DeepSeek — every request fails #283

Description

@bencheye

Bug description

Every API request fails when using a strict-schema provider (observed with BYOK opencode-go / Console Go + deepseek-v4-flash / deepseek-v4-pro):

Error from provider (Console Go): Upstream request failed: [invalid_request_error] Invalid schema for function 'compute_job': schema must be a JSON Schema of 'type: "object"', got 'type: null'.

Environment

  • openscience version: 2.0.23 (latest, installed via npm @synsci/openscience)
  • OS: Linux (x64)
  • Provider: BYOK key on opencode-go (Console Go); DeepSeek-family models

Root cause (from inspecting the shipped binary)

The compute_job tool's parameters are defined with zod discriminatedUnion("action", [...]) (see createComputeJobTool). When serialized to an OpenAI-compatible tool schema the result has no top-level type: "object" (reported as type: null). Strict validators (DeepSeek official API, and proxies routing to it) reject the whole request — this is the same bug class as vercel/ai issue #7924 (tool schemas generated from jsonSchema({properties:{}}) / unions missing type: "object").

Repro

  1. Add a BYOK key for opencode-go (Console Go) and select any deepseek model
  2. Start any session in the Web UI / CLI
  3. First provider call fails immediately with the error above — no tools are even invoked; the malformed compute_job schema is included in every request's tools array

Impact

  • DeepSeek-based models (via opencode-go or direct BYOK DeepSeek) are completely unusable
  • compute_job is registered unconditionally (ComputeJobTool = createComputeJobTool()), so there is no config escape hatch (the tools config setting is rejected as unsupported)

Suggested fix

  • Ensure every tool schema emitted to OpenAI-compatible endpoints has type: "object" at the parameters root (patch the AI SDK jsonSchema conversion, e.g. add type: "object" when properties is present)
  • Or convert ComputeJobParameters from discriminatedUnion to a plain z.object with a validated action enum, which serializes to a standard object schema

Workarounds tested

  • Switching to non-DeepSeek models (claude/gpt/gemini) avoids the error (they don't validate strictly)
  • No config option can disable the compute_job tool in 2.0.23

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions