Skip to content

Recursive tool schemas (z.json()) break Grok 4.6: every turn fails with a generic provider error #1612

Closed

Description

@mattwyckhouse

Summary

Any bb thread on Cursor's cursor-grok-4.6-* models fails instantly, before the model does any work, with:

Error: NonRetriableError: Provider Error We're having trouble connecting to the model provider. This might be temporary - please try again in a moment.

The message is misleading — nothing is wrong with connectivity, and retrying never helps. The cause is the workflows plugin's tool schemas: bb_workflow_run.args and bb_workflow_result.value are declared with zod 4's z.json(), which compiles to a self-referential $defs entry:

"args": { "$ref": "#/$defs/__schema0" },
"$defs": {
  "__schema0": {
    "anyOf": [
      { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "null" },
      { "type": "array", "items": { "$ref": "#/$defs/__schema0" } },
      { "type": "object", "additionalProperties": { "$ref": "#/$defs/__schema0" } }
    ]
  }
}

Grok 4.6 rejects a tool list containing that recursive $ref. Grok 4.5 accepts it, which is why this only shows up on 4.6.

Reproduction

On bb 0.37.0 with cursor-agent 2026.08.11-e8db854:

bb thread spawn --provider acp-cursor --model cursor-grok-4.6-medium --prompt "Reply with exactly: PONG"
# -> NonRetriableError: Provider Error ...

bb plugin disable workflows
bb thread spawn --provider acp-cursor --model cursor-grok-4.6-medium --prompt "Reply with exactly: PONG"
# -> PONG

Isolation

Each row is a fresh session; the failure tracks the schema, not the model or the transport.

Setup Result
Grok 4.6 in bb, any reasoning level Provider Error
Grok 4.6 in bb, workflows plugin disabled works
Grok 4.5 in bb works
Grok 4.6 via cursor-agent -p works
Grok 4.6 over raw ACP, mcpServers: [] works
Grok 4.6 over raw ACP + one MCP tool carrying the z.json() schema Provider Error
Same, with propertyNames removed Provider Error
Same, but flat (non-recursive) schema works
Grok 4.5 + the recursive schema works

So the trigger is specifically the recursive $ref; propertyNames is incidental.

Fix

PR to follow replaces z.json() in the two workflow tool parameters with a flat unknown wire schema, narrowed to JsonValue at each call site so the existing JSON-compatibility validation is preserved, plus a harness test that fails if any workflow tool schema regains a $ref or $defs.

Possible follow-up

That fixes the two shipped tools, but nothing stops a plugin — including third-party marketplace plugins — from registering another recursive schema and breaking the same providers. apps/server/src/services/plugins/plugin-api.ts converts every plugin tool with z.toJSONSchema(parameters, { io: "input" }); rejecting or flattening recursive $refs at that boundary would make the guarantee general. Worth deciding separately, since it changes what every provider sees.

AGENT GENERATED: by Claude Opus 5

Activity

  1. added theissue type on Aug 14, 2026
  2. SawyerHood commented on Aug 14, 2026

    @SawyerHood
    Collaborator

    This is a great catch! I'm trying to figure out how to handle this generically since this arguably makes the tool worse for other models.

    I wonder if we could conditionally do this for grok or ideally we have some way to parse out the error and make it more clear to the user that you need to disable this tool or auto disable it

  3. added
    providers
    provider-acp
    on Aug 18, 2026
  4. added a commit that references this issue on Aug 18, 2026
    c25298f
  5. SawyerHood commented on Aug 18, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/1612.html

    • Verdict: NOT REPRODUCED · root-cause confidence: medium
    • Root cause (short): Schema shape verified (zod 4 z.json() emits a self-referential #/$defs/__schema0 for bb_workflow_run.args / bb_workflow_result.value) but Grok 4.6 accepts it today with the reporter's exact cursor-agent build (raw ACP flat+recursive, and inside bb with the workflows plugin explicitly enabled); separately, main since Agent providers as a first-class plugin surface (provider bridge protocol) #1640 builds the ACP dynamic-tool MCP server command from process.argv[1] (now the provider-bridge bootstrap), which rejects --mcp-stdio and exits 1, so ACP agents never receive any bb dynamic tool — still present on origin/main after Keep workflow tool schemas free of recursive $refs #1613 merged.
    • Linked PR review: Keep workflow tool schemas free of recursive $refs #1613 → MERGED (c25298f, 2026-08-18T05:37Z) — Part (a) (z.unknown() for the two workflow tools) is fine as merged; part (b) adds a global registration-time rejection of any recursive $ref (plugin-api.ts:1029 / plugin-service.ts:777) that fails whole plugins and silently drops a plugin's entire configure() output for all providers, to satisfy a ; Promote Cursor Grok 4.6 in the model picker #1687 → REQUEST CHANGES — One-line primaryModels change to packages/agent-runtime/src/acp/profiles.ts, a file Agent providers as a first-class plugin surface (provider bridge protocol) #1640 removed; CONFLICTING on main (policy now in packages/agent-runtime/src/acp-launch-specs.ts:30-38); unrelated to the schema bug.; Fix Cursor always selecting fast mode #1691 → REQUEST CHANGES — All touched files moved to plugins/provider-acp by Agent providers as a first-class plugin surface (provider bridge protocol) #1640 and HOST_DAEMON_PROTOCOL_VERSION is 130 on main (PR bumps 123->124); CONFLICTING/DIRTY, needs full rebase; explicitly does not address Recursive tool schemas (z.json()) break Grok 4.6: every turn fails with a generic provider error #1612.
    • Proposed fix: 1) Bridge regression (high confidence, still on origin/main): in plugins/provider-acp/src/bridge/bridge.ts resolveBridgeProcessArgsForMcpServer use const entryPoint = fileURLToPath(import.meta.url) instead of process.argv[1] (patch + failing-on-main test in /tmp/bb-reports/issues/1612/repro/); extend bridge.test.ts to actually run mcpServers[0].command/args and call tools/list. Re-verified live: with the patch a <host.js> --mcp-stdio process appears and Grok lists mcp_bb-bridge_bb_workflow_run + update_environment_directory. 2) Recursive schemas: Keep workflow tool schemas free of recursive $refs #1613 merged — keep z.unknown() for the two…
    • Caveats: The reporter's failure (Grok 4.6 rejecting recursive $ref) did not reproduce with the identical cursor-agent build 2026.08.11-e8db854 across raw ACP sessions (recursive, flat, bb tools) and 4 bb threads (2 in this revision pass on a fresh instance with the workflows plugin explicitly enabled and 3 recursive refs confirmed in the MCP server env); most likely Cursor/xAI changed server-side since 202…

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at 16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Opus 5

  6. SawyerHood commented on Aug 18, 2026

    @SawyerHood
    Collaborator

    Closing as not reproducible after #1613. We could not trigger the recursive-$ref rejection with the same cursor-agent build (2026.08.11-e8db854) across raw ACP sessions and several bb threads with the workflows plugin enabled, and #1613 has since merged the defensive change (z.unknown() for the two workflow tools). Details: https://get-bb.github.io/reports/issues/1612.html

    If it happens again, please reopen with the thread id and the exact provider error text and we will pick it back up.

    AGENT GENERATED: by Claude Opus 5

  7. added
    no-repro
    on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    no-reproprovider-acpproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions