Repository navigation
Description
Summary
Using any modal agent (research / biology / physics / ml) with the DeepSeek provider fails immediately: the DeepSeek API rejects the compute_job tool schema. The fix for this already exists in the source tree (transform.ts, commit b864fd47, Aug 8) but is missing from the released 2.0.27 (published Aug 15).
Invalid schema for function 'compute_job': schema must be a JSON Schema of 'type: "object"', got 'type: null'.
Environment
- OpenScience 2.0.27 (latest on npm), any platform
- Provider:
deepseek(baseURLhttps://api.deepseek.com/v1) - Agent: any of
research,biology,physics,ml(the only agents that registercompute_job) - Any DeepSeek model (deepseek-v4-flash / deepseek-v4-pro / deepseek-chat / deepseek-reasoner)
Reproduction
- Configure the built-in (or a custom) DeepSeek provider pointing at
api.deepseek.com. - Start a session with a modal agent (e.g.
research) and select a DeepSeek model. - Send any message that triggers tool registration.
Expected: session proceeds. Actual: the request fails with the schema error above (the error text is returned by the DeepSeek API, not generated locally — it is not present anywhere in the bundle).
Root cause
compute_job(backend/cli/src/tool/compute-job.ts) is the only tool in the registry whose parameters are a zoddiscriminatedUnion.- zod v4's
toJSONSchemaserializes a discriminated union as a top-level{ "anyOf": [...] }with no top-leveltype. - DeepSeek's OpenAI-compatible endpoint validates function parameters strictly and requires the top level to be
type: "object"; ananyOf-only schema is rejected withgot 'type: null'.
All other tools use plain z.object schemas (top-level type: "object"), which is why everything else works with DeepSeek.
The fix already exists but was not released
backend/cli/src/provider/transform.ts in the current source contains a DeepSeek-specific branch that flattens anyOf object branches into a merged { type: "object", properties, required } schema (committed Aug 8 in b864fd47, "feat(gewu): …"). I verified by extracting the embedded source map from the installed @synsci/[email protected] darwin-arm64 binary that this branch is absent from the released build, even though 2.0.27 was published on Aug 15 — after the commit.
Request
- Include commit
b864fd47(thetransform.tsDeepSeekanyOfflatten) in the next release; and - optionally, as a belt-and-braces fix at the tool level, replace
compute_job'sz.discriminatedUnionparameters with a plain object schema (action as a required enum + optional fields), keeping the strict union only for runtime validation insideexecute— this keeps every tool DeepSeek-compatible regardless of provider transforms.
Workaround (for users on 2.0.27 meanwhile)
Route DeepSeek models through a lenient OpenAI-compatible gateway (e.g. an OpenRouter-style proxy) that does not enforce the top-level type: "object" requirement, or use a non-modal agent for DeepSeek sessions.
Activity
aayambansal commentedon Aug 18, 2026
Solved in #299. The compute_job schema is object-rooted now, including its runtime action variants. Tested with DeepSeek compatibility coverage.