Skip to content

Fix Pi process notification wake projection #1681

Closed

Description

@ryanbbrown

Problem

In bb 0.38.0, Pi process notifications with details.attention: "turn" could appear not to wake an idle thread.

Recorded example:

  • Thread: thr_nm2vjgvedq
  • Process: proc_551c (review-panel-fast-local-play-ui)
  • Notification event: 04eb7ac5
  • Custom type: ad-process:notification
  • Kind: success
  • Attention: turn

Pi did start a provider run, but bb translated the notification's sdk/message_start and sdk/message_end envelopes as provider/unhandled. The process input was absent from the projected turn. When Pi returned an empty assistant message, the UI showed no useful activity.

A second failure appeared after the first fix: Pi includes the custom process message in the full agent_end.messages history with string content. bb expected array content for every history entry and rendered the terminal envelope as “Unhandled Pi event.”

Expected behavior

  • One idle attention: "turn" notification starts exactly one projected turn.
  • The process event is visible as turn input.
  • Matching message_end and clustered notifications do not create duplicate turns.
  • Idle context and ignore notifications do not start turns.
  • Custom process entries in agent_end.messages are accepted.
  • Empty or missing assistant output produces an explicit warning.

Validation

Reproduce with a Pi-managed command such as sleep 5; echo done, end the initial agent turn, and verify that process completion starts one new turn with no provider/unhandled event.

AGENT GENERATED: by GPT-5.6 Sol

Activity

  1. added theissue type on Aug 17, 2026
  2. added
    providers
    provider-pi
    on Aug 18, 2026
  3. SawyerHood commented on Aug 18, 2026

    @SawyerHood
    Collaborator

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

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): Pi extension-triggered turns (pi.sendMessage custom message with triggerTurn) emit role:"custom" message_start/message_end envelopes that bb's Pi translator classifies as provider/unhandled, and Pi's agent_end.messages contains that custom entry with string content which bb's piConversationMessageSchema (array-only) rejects, so agent_end becomes provider/unhandled and no turn/completed is ever emitted — the extension-started turn has no pi/prompt/settled fallback, so the thread stays 'Working…' forever with no input shown.
    • Linked PR review: Fix Pi custom message turns #1682 → REQUEST CHANGES — The string-content schema widening (the Fix Pi extension-triggered turn completion #1663 commit) correctly unsticks the turn, but the new item/completed userMessage projection is rendered by nothing in thread-view/app/CLI (verified live: bb thread log shows two consecutive 'ok' rows with no input), so 'process event is visible as turn input'
    • Proposed fix: (1) Widen piConversationMessageSchema.content to z.union([z.string(), z.array(block)]) (as in Fix Pi extension-triggered turn completion #1663) — sufficient to emit turn/completed for extension-triggered turns; also JSON-round-trip raw events in toProviderRawEvent so unhandled payloads are not replaced by the serialization-error stub. (2) Handle message_start/message_end with role:'custom' generically in the Pi translator (project display:true custom messages as turn input when a bb turn is open, mark the rest as noise in visibility.ts) rather than matching customType 'ad-process:notification'. (3) Add a rendering path for provider-ori…
    • Caveats: @aliou/pi-processes itself was not installed; the live repro uses a 30-line stand-in Pi extension sending the identical message shape (copied from pi-processes 0.10.9 source) via pi.sendMessage(..., {triggerTurn:true, deliverAs:'steer'}), run in a trusted scratch project via PI_CODING_AGENT_DIR pointing at a copy of ~/.pi/agent (bb's bridge has no Pi trust prompt, so project extensions are otherwi…

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

    AGENT GENERATED: by Claude Opus 5

  4. added
    confirmed-repro
    on Aug 18, 2026
  5. self-assigned this
    on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

confirmed-reproprovider-piproviders

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions