Skip to content

Conditionally selected plugin tool is not added when a released thread resumes #2384

Description

@uje-m

Summary

On BB 0.39.1-nightly.32633481796.1, a third-party plugin tool selected by bb.agents.configure(...) on the first provider construction is callable, but the same tool is not added when an already-created BB thread is released and resumed after its configure selection changes from false to true.

This reproduces independently on Codex and Claude Code.

Environment

  • BB: 0.39.1-nightly.32633481796.1
  • BB package gitHead: 7e10ea4b3742f3d14bde086c2963118238fec3ab
  • Host: Linux, daemon-managed bb.service
  • Plugin source: local path
  • Providers tested: Codex and Claude Code

Minimal plugin

import { existsSync } from "node:fs";
import { z } from "zod";

const marker = "/tmp/bb-dynamic-tool-resume-enabled";

export default function plugin(bb) {
  bb.agents.registerTool({
    name: "dynamic_tool_resume_probe",
    description: "Return a fixed generic probe result.",
    parameters: z.object({}).strict(),
    async execute() {
      return "DYNAMIC_TOOL_RESUME_OK";
    },
  });

  bb.agents.configure((context) => ({
    tools:
      context.thread.title.includes("DynamicToolResumeRepro") &&
      existsSync(marker)
        ? ["dynamic_tool_resume_probe"]
        : [],
    skills: [],
  }));
}

Reproduction

  1. Ensure the marker file is absent.
  2. Spawn Codex and Claude Code threads whose titles contain DynamicToolResumeRepro.
  3. Confirm the tool is absent on their first turns.
  4. Create the marker file.
  5. Run bb thread stop <id> for each idle test thread. Both commands return { "ok": true }.
  6. Send a new turn to each same BB thread asking it to call the tool.
  7. Log the configure callback result. It resolves selected: true for the resumed thread.

Actual

  • Codex reports dynamic_tool_resume_probe missing.
  • Claude Code reports mcp__bb-bridge__dynamic_tool_resume_probe missing.
  • Both provider sessions are resumed under their existing provider-thread identities after runtime release.
  • The plugin's configure callback runs and returns the selected tool for the resumed turn.

Control

With the marker already present, newly spawned Codex and Claude Code threads both call the tool successfully and receive DYNAMIC_TOOL_RESUME_OK.

This proves registration, selection, tool execution, and both provider encodings work. The defect is specifically the false-to-true tool-set change across release/resume.

Expected

The resumed provider construction should receive the newly selected tool because turn.submit.resumeContext.dynamicTools and both provider bridges expose construction-time dynamic-tool inputs.

If adding tools to an existing provider-thread identity is intentionally unsupported, BB needs an explicit supported contract for rebuilding the provider session with the current configured tool set.

AGENT GENERATED

Metadata

Metadata

Assignees

No one assigned

    Labels

    pluginsPlugin SDK, runtime, marketplaceprovidersCross-provider bridges, models, login

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions