Skip to content

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

Open

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

Activity

  1. uje-m commented on Aug 25, 2026

    @uje-m
    Author

    Root cause boundary narrowed with a standalone generic plugin:

    • configure false on first construction, then true after an idle runtime release and resume: tool missing on Codex and Claude Code.
    • configure true on first construction: the same tool is callable on both providers and returns the expected fixed result.

    The callback logs selected: true for the failing resumed Codex turn, so the failure is downstream of plugin selection. This is a late-add-on-resume defect, not a general registration or execution failure.

  2. changed the title [-]Plugin agent tool selected by agents.configure is absent from fresh Codex/Claude session schemas[/-] [+]Conditionally selected plugin tool is not added when a released thread resumes[/+] on Aug 25, 2026
  3. added theissue type on Aug 25, 2026
  4. added
    plugins
    providers
    on Aug 25, 2026
  5. SawyerHood commented on Aug 27, 2026

    @SawyerHood
    Collaborator

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

    • Verdict: PARTIALLY REPRODUCED · root-cause confidence: high
    • Root cause (short): Codex app-server ignores dynamicTools on thread/resume because its resume contract has no such field. Claude Code now works.
    • Proposed fix: Add dynamicTools support to Codex thread/resume and regenerate its types. If Codex cannot support this, start a history-preserving replacement session.
    • Caveats: The complete script reproduced the Codex fault and passed the Claude Code test. No open pull request was linked. The report includes sanitized wire evidence only.

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

    AGENT GENERATED: by GPT-5.6-Sol

  6. added
    partial-repro
    on Aug 27, 2026
  7. karstenisdope commented on Sep 13, 2026

    @karstenisdope

    Another data point on 0.43.1, with a different trigger: a tool added by a plugin update, not a configure flip.

    • bb desktop 0.43.1 (macOS 27.0, arm64). Codex CLI 0.154.0-alpha.6.2. Claude Code 2.1.270.
    • A local-path plugin owns two long-lived threads, one Codex and one Claude Code. Its bb.agents.configure callback returns its tool list for both.
    • Two separate plugin updates each registered one new tool with bb.agents.registerTool and added it to the configure result, followed each time by bb plugin reload. The first added command_center_record_ruling, and the second added command_center_attach_image.
    • After each reload, the Claude Code thread could call the new tool on its next turn, without a stop.
    • The Codex thread never got either one. It still had only the tool it was created with. bb thread stop <id> followed by a new turn resumed the same provider session ID, and both new tools were still missing.

    This matches the root cause in the reproduction report: Codex thread/resume ignores dynamicTools. It shows the bug also hits plugin updates, not only configure changes. Any plugin that ships a new tool to a long-lived Codex thread will miss it. We worked around it in the plugin by letting a seat attach through a validated marker in its reply. A history-preserving replacement session, the report's fallback, would fix it for plugin-owned threads like these.

    Drafted by Claude Code (Liara) from EDI's diagnosis in bb, reviewed by the reporter before posting. Threads on the reporter's machine: the Codex seat thr_ek3fbafj52 and the Claude Code seat thr_xwr8ajpyg3.

    AGENT GENERATED

  8. uje-m commented on Sep 14, 2026

    @uje-m
    Author

    Not a duplicate of this issue, but the same construction-time dynamicTools snapshot showed up in a different failure: live Claude Code session lost all mcp__bb-bridge__* deferred tools after host-daemon reconnect + /compact, recovered only on process rebuild.

    Filed separately as #3626 (symptom + unresolved omitted-at-attach vs Claude-index-loss fork) and #3628 (positive capability probe; not implementation-approved).

    This issue remains the false→true configure selection on release/resume. Please keep them distinct.

  9. salemsayed commented on Sep 14, 2026

    @salemsayed
    Contributor

    Confirmed on Linux with BB 0.43.1 and Advisor, using a small local checkout fixture.

    1. Start a Codex thread with Advisor disabled.
    2. Enable Advisor for that thread. The composer switch and backend both report enabled.
    3. Ask the agent to call advisor_review: it is absent from the callable tool list.
    4. Stop the thread and send another turn: the tool is still absent.
    5. Clear model context in this disposable thread, then send a new turn: advisor_review is callable and returns a real review.

    The fresh-session control caught the seeded arithmetic defect (3 failing tests), then verified the corrected implementation (3 passing tests). The Advisor panel's Review now action also worked while the existing Codex session lacked the tool. We have documented both the workaround and the fact that clearing context resets the agent's working context; it is not a transparent fix.

    This supports the existing configure-selection/resume diagnosis. Advisor v0.1.1 documents the limitation and does not claim to fix the provider session contract.

    Agent-assisted reproduction and report.

  10. MPIsaac-Per commented on Sep 27, 2026

    @MPIsaac-Per
    Contributor

    Still reproduces on 0.43.3, with the root cause in the Codex app-server protocol. New evidence for this issue.

    Versions: bb-app 0.43.3 (npm global install, desktop-v0.43.3 / e865697), Linux x64, Codex CLI 0.153.3 (codex app-server).

    Repro against Codex itself, without bb (throwaway CODEX_HOME):

    1. thread/start with dynamicTools: [native_a], then run one turn.
    2. thread/resume the same thread with dynamicTools: [native_a, added_b].
    3. The rollout's session_meta.dynamic_tools is still ["native_a"], and the resumed model can call only native_a. No error is returned.

    Repro through bb: use the plugin from this issue's body with a Codex thread. After the tool set changes, bb thread stop <id> and a new turn resume the same provider session, and the added tool is still missing. A brand-new thread gets it immediately.

    Cause (observed in source):

    • Codex persists dynamic tools once, at thread start: "Dynamic tools are defined at thread start and persisted in rollout session metadata" (codex-rs/core/src/session/mod.rs L704-709 at rust-v0.153.3). On resume and fork it restores them from history (codex-rs/history/src/lib.rs L325-336).
    • In the generated 0.153.3 app-server schema, dynamicTools exists only on ThreadStartParams. ThreadResumeParams, ThreadForkParams and TurnStartParams have no such field, and no method updates tools on an existing thread.
    • bb's Codex bridge sends dynamicTools on thread/resume and thread/fork (plugins/provider-codex/src/bridge/bridge.ts L1073-L1087 at e865697f5), and Codex silently drops them. main at 4354b88 still sends them the same way.
    • The configure side is fine. Server-side tool resolution is provider-neutral (apps/server/src/services/threads/thread-runtime-config.ts L92-226), and the callback returns the tool for the resumed turn.

    Ruled out:

    • not a stale plugin build;
    • bb thread stop plus a new turn doesn't help;
    • clearing context or starting a new thread does help;
    • Claude Code is a separate path, because its bridge rebuilds an in-process MCP server from the current list on each construction (plugins/provider-claude-code/src/bridge/bridge.ts L2058-2064). That differs from what this issue reports for Claude Code, so those comments remain separate.

    Suggested approach, in prose; patch available if a maintainer approves the direction:
    Codex offers no way to update native dynamic tools after thread/start. On resume, fork and rebuild, the bridge can read the thread's persisted tool set, then serve every configured tool missing from it through a per-session MCP server passed in the resume config (mcp_servers.<name>, with a per-session token). Codex's own TUI serves its task tools the same way (codex-rs/tui/src/dynamic_tools_mcp.rs).

    • Codex 0.153.3 defers MCP tools behind tool search by default when the model supports it (codex-rs/core/src/tools/spec_plan.rs L244-265). So the server must set omit_tools_from = ["deferred"]; otherwise the model never sees the tools in its list.
    • Native calls to a persisted tool that the current configure no longer returns would be refused.
    • Verified against real Codex 0.153.3 (throwaway CODEX_HOME): after resume, the model's tool list includes the late-added tools as mcp__<server>__<tool>.
    • Longer term, the clean fix is Codex accepting dynamicTools on thread/resume, which is worth raising with openai/codex.

    Workaround: start a new Codex thread; thread/start receives the current tool set.

    AGENT GENERATED

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

    partial-repropluginsproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions