Skip to content

pi: thread stuck on Working... #1180

Closed

Description

@tekumara

And nothing appears to be happening. No relevant logs.

[email protected]

Activity

  1. SawyerHood commented on Aug 8, 2026

    @SawyerHood
    Collaborator

    Do you have any pi extensions installed?

  2. added theissue type on Aug 8, 2026
  3. raincodes64 commented on Aug 8, 2026

    @raincodes64
    Contributor

    Hi, I've encountered the same bug , I've been investigating this and yes, they're caused by extensions.

    Extensions polluting the stdout specifically, which bb expects to be a valid json/rpc

    In my case a Pi Notification Extension emitted an OSC 777 desktop-notification escape sequence on agent_end:

    ESC ] 777 ; notify ; π ; <assistant text> BEL
    

    That was written immediately before BB’s bridge JSON-RPC notification on the same stdout line:

    <OSC notification>{"jsonrpc":"2.0","method":"sdk/message","params":{"message":{"type":"agent_end",...}}}
    

    The host daemon runtime expects each provider stdout line to be valid JSON-RPC. Because the line no longer starts with JSON, the runtime drops it before the Pi adapter sees it.

    Disabling the specific stdout-writing notification extension makes Pi threads complete normally again, but that is only a workaround.

    I would like to propose this fix: take the raw stdout writer for bridge send(), and trash ordinary process.stdout.write / extension output to stderr while running the bridge.

    This matches the same kind of stdout-protection pattern Pi uses for structured output modes.

    Pi’s own structured-output modes use an output guard (core/output-guard, functions takeOverStdout() / writeRawStdout()). It captures the raw stdout writer for protocol frames, then redirects ordinary process.stdout.write calls to stderr so
    extensions/logging cannot corrupt the JSON/RPC stdout stream. BB’s Pi bridge likely needs the same invariant because its stdout is also a JSON-RPC transport.

    I would like to work on this issue and make my first contribution for bb!

  4. SawyerHood commented on Aug 8, 2026

    @SawyerHood
    Collaborator

    @raincodes64 please be my guest and open a PR for it!

  5. raincodes64 commented on Aug 8, 2026

    @raincodes64
    Contributor

    I was already on it, please let me know if I missed any standards to follow (or anything else!)

  6. SawyerHood commented on Aug 8, 2026

    @SawyerHood
    Collaborator

    The auto reviewer left some feedback that you can address if you want otherwise I can. tbh I think it is being a little too picky this is still better than the state main is in right now.

    TY for the contribution!

  7. SawyerHood commented on Aug 8, 2026

    @SawyerHood
    Collaborator

    Also @raincodes64 if you run into any other pi issues feel free to file and open PRs for them. Michael and myself are not daily pi users so any contributions to make it more stable are welcome

  8. raincodes64 commented on Aug 8, 2026

    @raincodes64
    Contributor

    Sure!

  9. added a commit that references this issue on Aug 8, 2026
    0cd5011
  10. added a commit that references this issue on Aug 14, 2026
    c945640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions