Skip to content

Wake an exact thread from native GitHub PR state changes #1543

Description

@pixexid

Problem

BB already knows PR/check/review state in its native GitHub plugin and displays it on the owning environment/thread. A thread can show, for example, checks_pending and later ready_to_merge without a shell GitHub watcher.

That state change does not wake an orchestrator session. Today the agent must poll gh, manually run bb github sync, use a scheduled shell check, or wait for an operator message. The first three duplicate the GitHub plugin's existing cache/sync work; the last loses autonomous continuation.

Observed on BB 0.37.0 with built-in [email protected]:

  • plugin and central sync service run successfully;
  • bb github exposes repos, cached issues, cached prs, and manual sync;
  • bb thread show exposes the environment PR, check counts/state, review state, mergeability, and attention such as checks_pending or ready_to_merge;
  • no plugin command or thread event exposes a subscription/wake for changes to that cached PR state.

Requested capability

Reuse the GitHub plugin's existing sync/delta seam to support an opt-in, exact-thread subscription to semantic PR state changes. Do not add a second GitHub poller.

Smallest useful shape:

  1. A thread/session subscribes its exact thread ID to one repository plus PR or branch identity.
  2. The existing GitHub sync detects a semantic change in checks, review, mergeability, or terminal PR state.
  3. BB emits one coalesced system wake/queued turn to that exact thread, carrying the normalized before/after state and PR identity.
  4. Unchanged syncs are silent. If the target is active, queue once rather than interrupting or duplicating turns.
  5. Subscription expiry/removal follows thread/PR terminal lifecycle.

The existing five-minute BB-native GitHub sync may remain the single detector;
"no polling" here means no second shell watcher, cron job, per-thread poller, or
legacy project-owned process. Before sending, the coalescer must durably reserve
the pending wake. An ambiguous threads.send result retains that reservation
and suppresses blind retry rather than risking a duplicate turn.

The mechanism should work for any native BB project. It must not require a legacy llm-collab project owner, marker file, watcher process, visible pointer tell, or per-thread cron.

Acceptance

  • One central GitHub sync remains the only GitHub polling source.
  • A subscribed exact thread wakes once when a pending check becomes passing or failing, or another configured terminal PR state changes.
  • Repeated identical syncs produce no wake.
  • Multiple intermediate updates coalesce to the latest semantic state while the target thread is active.
  • An ambiguous send result remains pending/inspectable and does not trigger an automatic duplicate send.
  • Wrong project/repository/PR/thread identity fails closed; archived/deleted targets do not wake.
  • The payload includes repository, PR number, base/head refs and SHA, checks summary, review summary, mergeability/attention, and a stable semantic digest or equivalent dedupe key.
  • No GitHub write permission is required; this is read-only observation and BB-local delivery.

Why this belongs in BB

The GitHub plugin already owns the normalized cache and the environment/thread PR projection. Emitting the state-change event there avoids a second daemon, shell watcher, schedule, or project-specific transport. It also lets agent sessions continue from the same canonical state the BB UI displays.

Reproducer: pixexid/bb-collab PR #27 moved from one pending check / checks_pending to one passing check / ready_to_merge; BB displayed both states correctly, but the orchestrator had to perform a new read to discover the transition.

Activity

  1. pixexid commented on Aug 15, 2026

    @pixexid
    Author

    Observed upstream wake/interaction gap on bb 0.37: requestInput/pendingInteraction is bound to the desktop renderer; the phone web client shows a normal composer. Operator-on-phone flows need global client surfacing or active-device targeting, otherwise a doorbell can point at an approval form the operator cannot reach.

  2. added
    automations
    github
    threads
    on Aug 18, 2026
  3. lanjak commented on Nov 21, 2026

    @lanjak
    Contributor

    Hi, I'd like a maintainer's sign-off on this feature before #7894 goes up for review. I opened it too early, so I've moved it to draft. Please treat it as a prototype for now.

    What #7894 does: the github-pr-status plugin gets bb pull-request watch. A watched pull request sends one message to its thread when a check fails, all checks pass, someone else comments or reviews, or the branch starts to conflict. The watch ends on merge or close, or after 10 comment-only messages in a row. Everything is inside the plugin, with no daemon change.

    Happy to change the approach, or close it if you'd rather solve this another way.

  4. lanjak commented on Nov 21, 2026

    @lanjak
    Contributor

    Update: I closed #7894. The prototype stays on my fork: main...lanjak:bb:feat-pr-watch (head 62e3190c24).

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

    automationsgithubthreads

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions