Skip to content

Support private launch context for plugin-created threads #3438

Description

@samanthar0se

Problem

Plugins can create threads with threads.spawn and threads.fork, but they cannot attach private plugin-owned metadata for use when configuring the new thread. Plugins must instead use external storage or place coordination data somewhere user-visible.

Here's a fork where I've implemented a solution: https://github.com/samanthar0se/bb/tree/fix/plugin-launch-context-remediation

Proposed behavior

Add an optional pluginLaunchContext value to plugin threads.spawn and threads.fork calls.

  • Accept finite JSON values up to 16 KiB after normalization.
  • Validate the original value before transport and validate it again at the server boundary.
  • Bind supplied context to the calling plugin and persist it atomically with the thread.
  • Expose it only to that plugin during agent configuration. Freeze the context envelope and value before delivery.
  • Copy context during a fork only when the caller supplies a new value. Never inherit it from the source thread.
  • Preserve existing spawn and fork behavior when the field is absent.
  • Keep the context out of thread DTOs, prompts, provider input, and ordinary host or provider protocols.

This metadata is coordination data, not a place for secrets and not an authorization mechanism.

Example

const thread = await bb.threads.spawn({
  prompt: "Help the user review this draft",
  pluginLaunchContext: { workflowId: "review-42", step: 2 },
});

The plugin can read that value when resolving configuration for thread, without exposing it through normal thread APIs.

Acceptance criteria

  • Spawn and fork accept an optional JSON launch context.
  • Invalid, unsafe, or oversized values fail before the network request.
  • The server independently enforces the same validation and plugin ownership.
  • Persistence is atomic with thread creation.
  • Configuration receives the persisted context as frozen runtime data.
  • Forks do not inherit source context unless the caller supplies context explicitly.
  • Existing callers that omit the field behave exactly as before.
  • Public thread data and model-facing payloads do not expose the context.
  • The fake plugin host follows the same new-field behavior for plugin tests.
  • Existing databases migrate without losing thread or title-search data.

Activity

  1. added
    plugins
    threads
    on Sep 10, 2026
  2. bb-slop-cop commented on Sep 10, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied Type: Feature, Priority: Medium, Effort: High, and labels: plugins, threads. All classification fields were previously empty; verified the final values.

    This adds plugin API behavior and persisted coordination data, with external storage available as a workaround. No reproduction report or pull request: the final Type is Feature, so the rule skips those steps.

    AGENT GENERATED

  3. added a commit that references this issue on Sep 12, 2026
    c00476e
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

    pluginsthreads

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions