Skip to content

fix: load under bb >= 0.40 (presentation.label + non-recursive tool schema) - #1

Open
DianaMak-Di wants to merge 1 commit into
agustif:mainfrom
DianaMak-Di:fix/bb-0.40-compat
Open

DianaMak-Di wants to merge 1 commit into
agustif:mainfrom
DianaMak-Di:fix/bb-0.40-compat

Conversation

@DianaMak-Di

Copy link
Copy Markdown

The plugin currently fails to load on bb 0.40.0 (plugin SDK >= 0.4.16). Installing from main succeeds, but the plugin never starts, so the todo tool is never registered.

Two independent breaks, one after the other:

1. experimental_statusLabels was removed

registerTool: "experimental_statusLabels" was folded into "presentation" (labels) in SDK 0.4.16 (tool "todo")

The host rejects the field outright (RENAMED_AGENT_TOOL_FIELDS). Moved to the current shape:

presentation: {
  label: { pending: "Updating todos", completed: "Updated todos" },
},

2. Recursive tool parameter schema

With the above fixed, the next load attempt fails on:

tool "todo" parameters contains recursive JSON Schema $ref "#/$defs/__schema0"

nestedTodoInputSchema was a z.lazy() self-reference through children, which emits a recursive $ref. bb validates tool parameters with assertNoRecursiveJsonSchemaReferences and refuses any cycle.

This PR unrolls the nesting to a fixed MAX_NESTED_TODO_DEPTH (5) via a buildNestedTodoSchema(depth) helper. The emitted schema is finite and well under the 128 KiB parameter cap (PLUGIN_AGENT_TOOL_PARAMETERS_MAX_BYTES).

Open question

Fix 2 is a behaviour change — children was previously unbounded in depth and is now capped at 5 levels. I picked 5 as a practical default, but it is your call: happy to change the constant, or to take a different approach entirely (e.g. keeping the recursive Zod type for internal validation and handing the host a depth-limited schema separately) if you would rather not cap the public contract.

Verification

  • npm test passes
  • Verified end to end on bb 0.40.0: bb plugin reload todo reports running, the composer todo card and header badge render, nested/dependsOn/requires items behave as before, and bb todo show --thread … prints the tree
  • dist/ is untracked, so this touches source only

🤖 Generated with Claude Code

The plugin fails to load on bb 0.40 / plugin SDK >= 0.4.16 with two
separate registerTool errors.

1. `experimental_statusLabels` was folded into `presentation` (labels) in
   SDK 0.4.16, so the host rejects the field outright:

       registerTool: "experimental_statusLabels" was folded into
       "presentation" (labels) in SDK 0.4.16 (tool "todo")

   Moved to `presentation: { label: { pending, completed } }`.

2. With that fixed, the host then rejects the tool parameters:

       tool "todo" parameters contains recursive JSON Schema
       $ref "#/$defs/__schema0"

   `nestedTodoInputSchema` was a `z.lazy()` self-reference via `children`,
   which emits a recursive `$ref`. bb validates tool parameter schemas with
   `assertNoRecursiveJsonSchemaReferences` and refuses any cycle.

   Unrolled the nesting to a fixed `MAX_NESTED_TODO_DEPTH` (5) instead. The
   emitted schema is finite and stays far below the 128 KiB parameter cap.

Note that 2. is a behaviour change: `children` was previously unbounded in
depth and is now capped at 5 levels. Happy to adjust the constant or take a
different approach if you would rather keep arbitrary depth.

`npm test` passes; verified end to end on bb 0.40.0 — plugin reports
`running`, the composer card renders, and `bb todo show` works.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant