Skip to content

Add optional environmentId to openNewThread #2842

Closed

Description

@samanthar0se

The workflow

I maintain a plugin with a task list grouped by project and worktree. Each worktree row has a + action that should open BB's root new-thread composer with that worktree already selected.

The intended flow is:

  1. The user clicks + beside a worktree.
  2. The plugin opens the root composer for the parent project.
  3. The clicked worktree is selected as the environment.
  4. App-level new-thread customizations, such as Model Presets, apply normally.

The public navigation API stops this at step 3. actions.openNewThread accepts projectId and focusPrompt, but it cannot receive the clicked environmentId.

What happens today

The plugin has to choose between two incomplete paths.

Using the root composer makes Model Presets work, but loses the worktree selection:

actions.openNewThread({
  projectId: project.id,
  focusPrompt: true,
});

Using experimental_NewThreadComposer preserves the worktree with defaultEnvironment:

<NewThreadComposer
  defaultProjectId={projectId}
  defaultEnvironment={{
    type: "reuse",
    environmentId,
  }}
/>

That composer owns component-local provider and model state. Model Presets writes the root composer's remembered provider and model selection, so the preset label can change while the embedded composer submits with its original provider and model. The preset instructions are then not attached because the created thread does not match the active preset.

Routing through the root composer avoids that state split, but BB may select the project's default environment instead of the worktree whose + button the user clicked.

What you would expect

Please add an optional environmentId to the public openNewThread navigation API:

actions.openNewThread({
  projectId: project.id,
  environmentId: worktree.environmentId,
  focusPrompt: true,
});

When supplied, BB should open the root composer with that existing environment selected. The environment should belong to the requested project. Omitting environmentId should keep the current behavior.

This lets plugins preserve worktree context while using BB's root composer and its app-level new-thread customizations.

Context and alternatives

I searched open and closed issues for openNewThread and environmentId. The only result was #2742, which concerns a loading skeleton when changing projects and does not request environment targeting.

The current workaround is to keep the embedded composer and accept the Model Presets mismatch, or route to the root composer and ask the user to select the worktree again. A component-local provider and model selection API could solve the preset case, but environmentId on openNewThread is smaller and helps any plugin that starts work in a known existing environment.

Observed with @get-bb/plugin-sdk 0.4.21.

AGENT GENERATED

Checks

  • I searched open and closed issues for the same request.
  • If an agent wrote this, the body ends with > AGENT GENERATED.

Activity

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

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classification: Type Feature; Priority Medium; Effort Medium; labels plugins, ui.

    No pull request was safe because the final Type is not Bug. The rule therefore skipped the report and fix steps.

  3. ymichael commented on Oct 8, 2026

    @ymichael
    Collaborator

    Fixed by #4024: openNewThread accepts environmentId (and sectionId).

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

    pluginsui

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions