Repository navigation
Description
Summary
Starting any agent turn on a provider with a strict JSON-Schema validator (Kimi K2.7 via an Azure OpenAI-compatible endpoint) fails with a 400 invalid_request_error: "could not understand the instance ..." before the model runs. The builtin Workflows plugin registers the bb_workflow_run.args and bb_workflow_result.value tool parameters as z.unknown(), which serialises to a JSON-Schema node with only description + default and no type. Strict validators reject that typeless node; lenient ones (e.g. GLM 5.2) accept it, so the failure is provider-specific.
Versions and environment
- bb 0.43.1 (desktop app,
/Applications/bb.app), macOS - Provider: pi harness routed to Kimi K2.7 through an Azure OpenAI-compatible proxy (strict request validator). GLM 5.2 through the same proxy does not reproduce.
- Reproduced on
mainat3e9bef8(plugins/workflows/src/server.ts). - Not specific to remote machines/Connect/worktree; happens on a personal-workspace environment.
Steps to reproduce
- Install/enable the Workflows plugin (
bb plugin enable workflows) and configure a provider whose tool-parameter validator rejects typeless JSON-Schema nodes (Kimi K2.7 via Azure is a confirmed example). - Start any agent turn that exposes the
bb_workflow_run/bb_workflow_resulttools on that provider (e.g. a bot conversation from the Bots sidebar, or any thread where the workflows tools are registered). - The provider rejects the request before the model runs.
Did not reproduce with: GLM 5.2 (same harness, same tools); disabling the Workflows plugin (bb plugin disable workflows) makes Kimi K2.7 accept the same turn.
Expected vs actual
Actual (from the provider response, verbatim):
400: {"object":"error","type":"invalid_request_error","code":"invalid_request_error","message":"JSON Schema not supported: could not understand the instance `{'description': 'Optional input value exposed to the script as the global `args`, verbatim. Pass arrays/objects as actual JSON values, NOT as a JSON-encoded string — a stringified list breaks `args.filter`/`args.map` in the script. Use for parameterized named workflows (e.g. a research question).', 'default': None}`."}
Expected: the tool schemas are accepted by strict validators and the turn runs.
Evidence
- Source:
freeformJson = z.unknown()atplugins/workflows/src/server.ts(3e9bef8), used byargs(L63) andvalue(L80). Permalink:bb/plugins/workflows/src/server.ts
Lines 44 to 63 in 3e9bef8
const freeformJson = z.unknown(); const runInputSchema = z .object({ ...sourceInputFields, args: freeformJson .describe( "Optional input value exposed to the script as the global `args`, verbatim. Pass arrays/objects as actual JSON values, NOT as a JSON-encoded string — a stringified list breaks `args.filter`/`args.map` in the script. Use for parameterized named workflows (e.g. a research question).", ) .default(null), resumeRunId: z .string() .min(1) .nullable() .describe( "Run ID of a prior BB workflow to resume from. Calls in the causally safe, longest unchanged prefix return cached results; the first edited, new, or concurrent call and everything after it run live. The prior run must be terminal and from the same project and environment.", ) .default(null), }) .strict(); - The emitted JSON Schema for
z.unknown().describe(...).default(null)is{"default":null,"description":"..."}with notypekeyword — that is the exact node the validator rejects. - An existing test already guards against recursive schemas:
server-harness.test.ts"registers tool schemas without recursive $refs" asserts no$ref/$defs. A typeless node is a separate strict-validator failure mode not currently covered.
Proposed fix: replace z.unknown() with a non-recursive union of the JSON scalar/container types so every branch carries a concrete type, while still accepting any JSON value (matching toJsonValue in json-value.ts):
const freeformJson = z.union([
z.string(), z.number(), z.boolean(), z.null(),
z.array(z.unknown()), z.record(z.string(), z.unknown()),
]);This emits {"default":null,"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}],"description":"..."} — concrete types, no $ref/$defs. Verified: the plugin's 241 existing tests still pass, plus a new regression test asserting the args/value nodes declare a concrete type/anyOf.
What you ruled out
- Not a Bots-sidebar issue (a separate plugin); the error is raised by the provider, not the bots plugin's RPC validation.
- Still happens on
mainat3e9bef8. - Does not happen with GLM 5.2 (lenient validator) through the identical proxy/harness.
- Disabling Workflows is a workaround, not a fix: any other tool with a typeless parameter would hit the same validator.
Suggested priority and effort
Medium — blocks strict-validator providers (Kimi K2.7 confirmed; likely other Azure-fronted models) whenever the Workflows plugin is enabled, including Bots-sidebar conversations. Workaround exists (disable Workflows or use a lenient provider). Effort Low (one schema definition + test).
AGENT GENERATED — reported from a live debugging session; fix available in fork branch https://github.com/leduckhc/bb/tree/fix/workflows-typed-freeform-json
Activity
bb-slop-cop commentedon Sep 17, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotClassified as Bug · Priority Medium · Effort Low, with
pluginsandworkflowslabels.Reproduction and root-cause report: PARTIALLY REPRODUCED, high confidence in the schema finding. Two clean checkouts of trusted main emitted unconstrained
argsandvalueparameter schemas and failed the focused regression. All 240 existing workflow tests passed. The live Azure/provider rejection remains unverified. Reproduction label:partial-repro.No PR opened: changing the exposed tool parameter schema is outside this rule’s simple-fix allowance. Linked PR #3836 is closed and unmerged.