Repository navigation
Conversation
… type bb_workflow_run.args and bb_workflow_result.value were declared with z.unknown(), which serialises to a JSON-Schema node carrying only description + default and no `type`. Strict provider validators (Azure OpenAI / Kimi K2.7) reject that node with "could not understand the instance" before the model runs. Replace z.unknown() with a non-recursive union of the JSON scalar/container types so every anyOf branch has a concrete `type`, while still accepting any JSON value (matching toJsonValue). Stays non-recursive (no $ref/$defs) so providers that reject recursive schemas still accept it. Adds a regression test asserting args/value declare a concrete type or anyOf. Existing "registers tool schemas without recursive $refs" test and all 241 workflows tests still pass. Fixes get-bb#3835
Contributor
|
Thanks @leduckhc for the PR. This repo needs approval before a PR. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ) and explain what you want to open a PR for and why. A maintainer then adds you to the allow list. This PR now closes on its own. Reopen it or open a new one after approval. |
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.
Human comments
What was wrong
The builtin Workflows plugin registered the
bb_workflow_run.argsandbb_workflow_result.valuetool parameters withz.unknown(), which serialises to a JSON-Schema node carrying onlydescription+defaultand notypekeyword. Strict provider validators (Azure OpenAI / Kimi K2.7) reject that typeless node withinvalid_request_error: "could not understand the instance"before the model runs, blocking any turn that exposes those tools on such providers. Lenient validators (GLM 5.2) accept the same node, so the failure is provider-specific.Issue: #3835.
What changed
plugins/workflows/src/server.ts— replacedconst freeformJson = z.unknown()with a non-recursive union of the JSON scalar/container types (string | number | boolean | null | array<unknown> | record<string, unknown>). EveryanyOfbranch now carries a concretetype, while the schema still accepts any JSON value (the set accepted is exactly whattoJsonValueinjson-value.tsvalidates). The union is deliberately non-recursive (no$ref/$defs) so providers that reject recursive schemas still accept it — consistent with the existingregisters tool schemas without recursive $refstest.Emitted schema for the
argsnode (with.describe().default(null)):{"default":null,"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}],"description":"..."}No wire/protocol/CLI changes.
How you verified
server-harness.test.ts: "registers typed freeform JSON parameter schemas (no typeless top-level nodes)" — asserts theargsandvaluenodes declare a concretetypeoranyOfand are not a bare$ref. This fails on the oldz.unknown()(node has neithertypenoranyOf) and passes after the fix.registers tool schemas without recursive $refstest still passes (no$ref/$defsintroduced).pnpm vitest runfor the workflows plugin: 241 tests across 14 files pass.anyOfwith typed branches and no$ref/$defs.Note: I am not on
.github/APPROVED_CONTRIBUTORS; happy to go through the approval flow (Discord #contributors or/approve @leduckhc). The fork branch is linked from the issue as a prototype.Fixes #3835