Skip to content

CLI: bb thread spawn inside a thread errors with required option '--project' instead of inferring the calling thread's project #2223

Description

@dhiyaancnirmal

Version

bb 0.39.0 (macOS host app + CLI)

Summary

Running bb thread spawn from inside an existing bb thread fails with
error: required option '--project <id>' not specified, even though the
calling process has full ambient context (BB_THREAD_ID, BB_PROJECT_ID,
BB_ENVIRONMENT_ID) that identifies the project unambiguously.

The spawn help text says omitted execution flags use "remembered project
defaults", but nothing is remembered for a fresh agent shell inside a thread,
so every in-thread delegation must hand-thread --project manually.

Repro

  1. Open any bb thread and get an agent shell inside it (the environment sets
    BB_THREAD_ID, BB_PROJECT_ID, BB_ENVIRONMENT_ID).

  2. Run:

    bb thread spawn --prompt "hello" --json
  3. Observe:

    error: required option '--project <id>' not specified
    
  4. Re-run with --project "$BB_PROJECT_ID" and it succeeds.

Expected

Inside a thread, spawn should default --project (and reasonably
--environment) from the calling thread's context, so
bb thread spawn --prompt "..." --parent-self just works.

Why it matters

Thread-to-thread delegation is a core agent workflow; this turns every
delegation call-site into boilerplate and fails hard instead of degrading to
an inferred default.

Activity

  1. added
    threads
    cli
    on Aug 23, 2026
  2. lanjak commented on Nov 12, 2026

    @lanjak
    Contributor

    Still present on bb 0.49.0 and on main at 030b1b729. apps/cli/src/commands/thread/spawn.ts:342 still declares --project with requiredOption. The error now gives the fix:

    error: required option '--project <id>' not specified
    This thread's project is proj_personal; add --project proj_personal.
    

    So the CLI already resolves the project from BB_THREAD_ID. It uses that only for the hint, not as a default. A possible fix: change to .option("--project <id>") and use the same resolved project when the flag is missing and BB_THREAD_ID is set. Keep the error outside a thread.

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

    clithreads

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions