Repository navigation
fix: normalize compute_job's tool schema for openai-compatible providers too - #471
Closed
Satya Arjunan (satya-arjunan) wants to merge 1 commit into
Conversation
…ers too compute_job's parameter schema is a discriminatedUnion, which Zod compiles to a root oneOf in JSON Schema. normalizeDeepSeekToolSchema already exists to rewrite that into an object-rooted anyOf that plain function-calling parsers accept, but the call site in transform.ts only applied it when model.api.npm === "@ai-sdk/deepseek". openai-compatible providers (e.g. a local Ollama model) hit the exact same schema defect, just with a different failure mode: instead of the whole request being rejected the way DeepSeek's strict validator rejects it, the one tool with the unparseable root oneOf is silently dropped from the model's tool list. compute_job has "allow" permission for the research agent but never actually reached the model for an openai-compatible provider - confirmed against a real local Ollama session. Broadens the gate to include @ai-sdk/openai-compatible, and updates the existing test that had locked in the old (incorrect) boundary as expected behavior. Adds a regression test using compute_job's real discriminated schema shape.
|
Satya Arjunan (@satya-arjunan) is attempting to deploy a commit to the InkVell Team on Vercel. A member of the Team first needs to authorize it. |
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.
Fixes #472
Problem
compute_job's parameter schema is az.discriminatedUnion("action", [...])(backend/cli/src/tool/compute-job.ts:110), which Zod compiles to a rootoneOfin JSON Schema.normalizeDeepSeekToolSchema(backend/cli/src/provider/tool-schema.ts) already exists to rewrite that into an object-rootedanyOfthat plain function-calling parsers accept — but the call site (backend/cli/src/provider/transform.ts) only applied it whenmodel.api.npm === "@ai-sdk/deepseek":openai-compatibleproviders (e.g. a local Ollama model) hit the exact same schema defect, just with a different failure mode: instead of the whole request being rejected the way DeepSeek's strict validator rejects it (#283, #298), the one tool with the unparseable rootoneOfis silently dropped from the model's tool list — no error, nothing in the logs.compute_jobhas "allow" permission for theresearchagent, but a real session running a local Ollama model never saw it in its own available-tools list at all.The existing test even locked this gap in as expected behavior:
Fix
Broaden the gate to
@ai-sdk/deepseek || @ai-sdk/openai-compatible. The normalization function itself has no DeepSeek-specific logic — it's a generic root-oneOf-to-anyOfrewrite — so this just closes the gap for the other provider family that needs the same treatment. Also updated the doc comment (it previously read as if the fix were DeepSeek-exclusive) and fixed the test that asserted the old, incorrect boundary.Verification
test("runs only at the native DeepSeek provider boundary")→ now also asserts@ai-sdk/openai-compatiblegets normalized, and that an unrelated provider (@ai-sdk/anthropic) does not.compute_job's real discriminated-union schema shape against anopenai-compatible-shaped model.bun testacrossbackend/cli: 2852 pass / 92 fail with this fix, vs. 2851 pass / 92 fail on a cleanmainbaseline — identical failure set (unrelated, pre-existing), one new passing test, zero regressions.bun run typecheckandprettier --checkon all three changed files — clean.