Repository navigation
fix(provider-pi): surface Pi extension dialogs as answerable bb interactions - #3228
Merged
Merged
Conversation
…actions
Pi extensions prompt users through ctx.ui.select/confirm/input/editor, which
in RPC mode emit an extension_ui_request line and block until the client
answers. bb's bridge answered every such request with {cancelled: true}, so
permission prompts from extensions like pi-landstrip were silently dismissed
(get-bb#1668).
Forward extension_ui_request dialogs as provider-pi/extension-ui pending
interactions rendered by the plugin's app component:
- rpc-child.ts forwards dialog requests to an optional handler; without one
the old auto-cancel remains, so behavior is unchanged unless the bridge
opts in.
- extension-ui-contract.ts validates dialog requests at the boundary (method
enum, bounded title/options/message/placeholder/prefill, select requires
non-empty options).
- extension-ui.ts forwards each dialog as a pending interaction and maps
resolutions back (value for select/input/editor, confirmed for confirm,
cancelled on error, unknown value, or session close). Request ids use a
pi-ui-N string space so they cannot collide with numeric item/tool/call
ids. Pending dialogs are cancelled on thread stop, session replace, and
discard. Fire-and-forget methods (notify, setStatus, setWidget, setTitle,
set_editor_text) are dropped.
- app.tsx renders the four dialog shapes. The host passes plugin components
the interaction's data object (not the stored {kind, title, data}
wrapper), so the renderer parses the unwrapped payload directly.
Verified with bridge round-trip tests over the fake Pi harness (/ui
directive), rpc-child unit tests, jsdom renderer tests, and live
pi-landstrip permission prompts rendering and enforcing user answers.
Known gaps (better than the current always-cancelled behavior, candidates
for follow-ups): dialogs raised outside an active turn fail cancelled; a
dialog can outlive a Pi-side timeout since there is no withdrawal
notification; dialogs arriving before the session is announced are dropped;
fire-and-forget state is dropped.
Fixes: partial groundwork for get-bb#1668.
> AGENT GENERATED
fgrehm
force-pushed
the
fix/pi-extension-dialogs
branch
from
September 8, 2026 00:10
14a3e75 to
4bf45f6
Compare
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
yet another PR for making the pi provider more polished here. I’ve been running this and my other PRs on my local install of bb and been working fine
What was wrong
Pi extensions prompt the user through
ctx.ui.select,ctx.ui.confirm,ctx.ui.input, andctx.ui.editor. In RPC mode these emit anextension_ui_requestline on stdout and block until anextension_ui_responsearrives on stdin (seedocs/rpc.md, "Extension UI Protocol"). bb's provider-pi bridge answered every such request with{cancelled: true}, so any extension that raises a permission prompt had it silently dismissed — pi-landstrip sandbox-approval prompts were unusable over bb. Investigation and reproduction trail: #1668.What changed
plugins/provider-pi/src/bridge/rpc-child.tsforwardsextension_ui_requestdialogs to an optional handler; with no handler the old auto-cancel remains, so behavior is unchanged unless the bridge opts in.plugins/provider-pi/src/extension-ui-contract.tsvalidates dialog requests at the boundary: method enum, bounded title/options/message/placeholder/prefill,selectrequires a non-empty options list.plugins/provider-pi/src/bridge/extension-ui.tsforwards each dialog as aprovider-pi/extension-uipending interaction and maps resolutions back (valuefor select/input/editor,confirmedfor confirm,cancelledon error, unknown value, or session close). Request ids use api-ui-Nstring space so they cannot collide with numeric item/tool/call ids. Pending dialogs are cancelled on thread stop, session replace, and discard. Fire-and-forget methods (notify,setStatus,setWidget,setTitle,set_editor_text) are dropped.plugins/provider-pi/app.tsxrenders the four dialog shapes in the plugin pending-interaction slot. The host passes plugin components the interaction's data object rather than the stored{kind, title, data}wrapper, so the renderer parses the unwrapped payload directly.No protocol or wire changes: no
HOST_DAEMON_PROTOCOL_VERSIONbump, no new grammar, no new plugin API surface — this reuses the existinginteraction/requestplugin-extension payload kind and pending-interaction slot.This is deliberately the minimal bridge-only subset of #2446/#2447 (both still open): thread-scoped requests outside an active turn, withdrawal notifications, and queued-before-announcement dialogs are left as follow-ups — and the behavior is strictly better than the current always-cancelled path.
How you verified
pnpm exec turbo run test --filter=bb-plugin-provider-pi(26 files, 143 tests) andturbo run typecheck --filter=bb-plugin-provider-pi— clean.pnpm exec turbo run test typecheck --filter=bb-plugin-provider-pipassed with 26 test files and 143 tests. The working-tree and commit-range secret scan was clean./uidirective infake-pi-rpc.mjs), rpc-child handler unit tests, and jsdom renderer tests covering select/confirm/input/editor and the host-unwrapped payload shape.Fixes: partial groundwork for #1668
Generated with "Omen Alpha" (Opencode Go) via BB / Pi