You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(pi): draw extension notify, setStatus and setWidget in the chat - #45081
A Pi extension can draw things in its host: a todo list above the input, a status line, a notification. In a Pi native chat Orca threw all of those drawings away, so the extension looked broken even though its tools still ran. This PR draws them.
What Changed
Before:src/main/pi/rpc/rpc-dialog-callbacks.ts held
so every fire-and-forget extension_ui_request died in the main process. Two setStatus keys were already consumed further down (Orca's own background-work bridge and the subagent roster); everything else — widget panels, notifications, arbitrary status keys — reached no UI and told the extension nothing. Only the dialogs (select / confirm / input / editor) worked.
a notice row in the transcript, toned by notifyType (info plain, warning, error)
setStatus
one keyed entry in a quiet strip on the composer's top edge; a second send for the same statusKey revises that row, pi clearing the key removes it
setWidget
a keyed mono panel above or below the composer in the requested widgetPlacement; same-key sends revise in place, widgetLines: undefined removes it
setTitle
consumed, not drawn — see below
set_editor_text
consumed, not drawn — see below
Mechanism, reusing what the journal already does: rows ride the existing agent journal as kind: 'status' items with additive presentation hints (extension-notice, extension-status, extension-widget, extension-widget-below), the documented channel for "optional display hints; unknown values retain the ordinary text fallback". A shared reader (agentSessionExtensionStripRows) turns those rows into the composer's strips, and the shared row-content projection drops them from the transcript so nothing is drawn twice. Keyed rows are derived from the extension's own key, so the same key always revises the same journal row.
Two things the old list got wrong, fixed here:
set_editor_text is spelled with underscores in Pi's protocol; the old camelCase setEditorText entry never matched, so those frames fell through to the dialog path and were answered with a bogus extension_ui_response { cancelled: true } for a call that takes no answer. All five methods are now consumed for real.
setTitle / set_editor_text cannot be drawn today: Orca owns the chat tab title (structured-chat-naming / user rename) and the composer draft, and no host channel lets a provider child claim either. They are consumed with a one-line reason in the code rather than pretended into a surface. When a channel exists they drop in beside the other three.
Bounded at the boundary, since this is third-party text aimed at the DOM: 64 widget lines, 500 chars per line, and a repeated identical value costs no journal revision.
Why
Pi's RPC mode documents these calls as its only extension UI channel, so dropping them means every widget-style extension is invisible in Orca chat while its tool rows keep working — the failure mode is silence, not an error (see the issue's rpiv-todo reproduction). The four dialog methods already work, so the gap is only the fire-and-forget half.
Alternatives considered: a dedicated journal item kind for widgets (schema, projection and mobile work for ephemeral text, and rows that outlive the child), and a bespoke IPC channel (a second transport for one provider). The status-row + presentation route is additive for older clients and needs no new persistence.
Before: nothing renders for setWidget / setStatus / notify; the transcript shows only the tool rows. The old guard is quoted above — the absence is the bug, and the reverted-code run below shows the new tests failing without the change.
After (component fixture, NativeChatComposerExtensionUi, light and dark):
Reproduce locally:
pnpm fixtures:shot native-chat/composer/controls/NativeChatComposerExtensionUi --theme both
The panel is mono text in one of the composer's dock cards — a full-width bordered card since #48792 — placed between the thread-goal strip and /mcp's tray, and the extension's status line is the quiet strip card under it. Screenshots live on the throwaway fork branch pi-widgets-proof, not in this PR's files, and were re-shot against main after #48792 restyled these strips.
Testing
I manually tested these changes locally (macOS, light and dark, fixture render)
Automated tests added
Every added test fails without this change
Linux / Windows / SSH not run locally — CI covers the type level; the change is platform-neutral (no paths, shells, or shortcuts)
pnpm test src/main/pi/rpc/rpc-extension-ui.test.ts \
src/shared/agent-session/view/agent-session-extension-ui.test.ts \
src/renderer/src/components/native-chat/composer/controls/NativeChatComposerExtensionUi.test.tsx \
src/main/pi/rpc/rpc-subagents.test.ts --maxWorkers=2
# Test Files 4 passed (4) Tests 13 passed (13)
What each test pins, all through the real lane + sink + on-disk journal (so a frame that is still dropped cannot pass):
notify → one transcript row per call, in the extension's tone, and no strip entry.
setStatus → one keyed strip entry that revises on a second send (same journal item id) and disappears when pi clears the key.
setWidget → keyed panel with the sent lines, aboveEditor/belowEditor placement, in-place revision, removal on clear.
setTitle / set_editor_text → no rows and no response frame (a cancelled reply would be protocol noise).
Child exit → the child's keyed rows stop drawing.
Reader → strip rows only, cleared rows skipped; strip rows take no transcript row while notify still draws one.
Fail-without-the-change check (temporarily restoring the old drop):
pnpm test src/main/pi/rpc/rpc-extension-ui.test.ts # 3 failed | 2 passed# notify, setStatus and setWidget tests fail; the two "not drawn / nothing left" tests still pass
pnpm tc exits 0. pnpm check:code-quality:changed origin/main → 0 new findings across 13 changed files. pnpm check:changed passes every gate except its repo-wide unit selection, which fails on unrelated orchestration/federation suites; I verified those same failures on a clean origin/main checkout with this branch stashed (e.g. peer-mail.test.ts, agent-session-subscriber-catch-up.test.ts), so they are pre-existing here and not from this diff.
Performance
Bounded by construction, because third-party extension text is the input: a widget is capped at 64 logical lines and 500 characters per line, and a repeated identical value costs no journal revision, so a chatty extension cannot grow the journal. Nothing polls or re-parses — notify, setStatus and setWidget ride journal items the chat already writes, and the strips are projected from those rows when the composer renders, so the added work per frame is a keyed lookup in the strip map.
Risk
Level: Low
The change is additive: no persisted schema, no option or wire change, and every new row field (presentation) was already optional and already documented as a display hint. Older hosts/clients simply render the row's text.
New journal rows come from a provider child, so the surfaces are bounded (64 lines, 500 chars, per-key dedupe). A badly behaved extension can still create many distinct keys, each one journal row.
Strips are desktop-only today: mobile shares the transcript filter, so widget/status rows are correctly invisible there, and the notification rows (not filtered) show as ordinary status text.
Riskiest part: a widget whose clearing write is refused at child exit. That path is the lane's existing "final timeline could not be transferred" failure, identical to any other pending write at exit, and it fails loudly rather than leaving a stale panel.
Backout is a plain revert; the journal rows it wrote stay readable as ordinary status text.
AI Disclosure
Implemented with Pi (model workbuddy/deepseek-v4.1-flash) driving the repo's own typecheck, lint and test gates; no human-authored code in this PR.
Pi's RPC extension UI sub-protocol is the only channel an extension has to draw
in a native chat, and Orca discarded every fire-and-forget call before any UI
saw it, so widget extensions rendered nothing while their tools kept working.
- notify: a notice row in the transcript, in the extension's own tone
- setStatus: one keyed entry in a strip above the composer, revised in place
and dropped when pi clears the key
- setWidget: a keyed panel above or below the composer, in pi's placement
- setTitle and set_editor_text stay undrawn: the chat owns the tab title and
the composer draft. The frames are now consumed instead of being answered
with a cancelled dialog reply, which the old method list got wrong for
set_editor_text (pi spells it with underscores).
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
No actionable comments were generated in the recent review.
Walkthrough
Pi RPC callbacks now route extension UI frames to a handler that writes notices, keyed statuses, and widgets to the timeline. Shared selectors derive composer rows from journal items. Native chat renders eligible statuses and widgets around the composer and excludes strip content from transcript rows. The structured composer now receives session state and renders extension UI rows below the composer.
Merge Risk: Low · up to 934cc
Pi extension notices, statuses and widgets now render in native chat. In a very short pane, widgets in both placements could still crowd the composer. This is a bounded layout risk and does not block merge, but it deserves a check in a short pane.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(pi): draw extension notify, setStatus and setWidget in the chat" names the main change: Pi extension notify, setStatus and setWidget calls are now rendered in the native chat instead o…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the repository template closely. It covers ELI5, What Changed (before/after with a mechanism table), Why (with alternatives), Linked Issue (Fixes #43862), Visual Proof (fixture…
Full details: Title check
Explanation
The title "feat(pi): draw extension notify, setStatus and setWidget in the chat" names the main change: Pi extension notify, setStatus and setWidget calls are now rendered in the native chat instead of being dropped. The changeset matches this (rpc-extension-ui.ts, composer strips, transcript notices, presentation hints). The title is specific and concise, and it is 68 characters long.
Full details: Description check
Explanation
The description follows the repository template closely. It covers ELI5, What Changed (before/after with a mechanism table), Why (with alternatives), Linked Issue (Fixes #43862), Visual Proof (fixture screenshots and a reproduction command), Testing (commands, results, and fail-without-change check), Performance, Risk (level Low with backout), and AI Disclosure. Remaining gaps: the Review and Agent skill upstream boundary sections are absent, the Notes and Checklist sections are not addressed, and the Testing checklist leaves Linux/Windows/SSH unchecked, which the author states openly. The Visual Proof section points to images on a fork branch rather than attaching them to the PR, which the template's instructions discourage. The 'Before' visual is described in text only. These gaps are non-critical, so the description is mostly complete.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The current assertions also pass if above and below widgets are swapped. Both texts still appear once, and no single panel contains both texts.
Render a separate container for each placement. Assert that each container contains its requested widget and excludes the other widget. This makes the test detect a regression in the placement contract.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 4a598973-4eba-4bbf-ac9e-14a858b7fdcc
Commits
Reviewing files that changed from the base of the PR and between 642150a and 799c92d.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
The composer's widget stack had a per-panel cap but no total, so a child
drawing four panels pushed the transcript to zero and the composer out of
the pane. Each placement now keeps its panels in one capped, scrollable
stack, and the transcript and composer keep usable room.
MAX_WIDGET_LINES counted array entries, so one string with embedded
newlines slipped past the 64-line budget. It now counts logical lines.
The composer input moves beside the extension widgets it draws underneath
(NativeChatStructuredComposerInput): NativeChatStructuredSession sat at the
oxlint max-lines budget on main, so any addition there must split instead.
Out of Scope Changes — checked, nothing to extract. This PR touches 14 files and none carries AI Vault / subagent-listing / transcript-count / roster changes: git diff origin/main...HEAD | grep -i vault is empty, and the only shared-layer edits are extension-UI presentation guards in agent-chat-entries.ts and native-chat-row-content.ts (an extension's own notice is not an agent failure; strip rows take no transcript row). That work lives in #45085 (feat/pi-foreground-subagents, still open), so the flag appears to describe an earlier revision of this branch before it was reduced to its two current commits.
Why this PR also adds composer/NativeChatStructuredComposerInput.tsx: NativeChatStructuredSession.tsx sits at 399 of the 400-line oxlint max-lines budget on main, so any addition to it breaks CI. config/max-lines-baseline.txt is a ratchet that may only shrink and explicitly says not to add entries to get CI green — new over-budget files must split instead. So the composer input moved next to the extension widgets it draws underneath, rather than adding a max-lines suppression. The move is mechanical: same props, same order, same behaviour; the only new indirection is forwarding ref to NativeChatComposer. No other file was refactored.
Add an id to the set_editor_text test frame so the no-send assertion can detect a regression.
Without an id, the dialog fallback sends nothing for this frame. If PiRpcExtensionUi stops consuming set_editor_text, the test still passes. With a string or numeric id, that fallback sends cancelled: true, and the existing not.toHaveBeenCalled() assertion fails. A correct handler still sends nothing, because it consumes the frame before the fallback runs.
The setTitle frame on the line above has the same gap and can take an id in the same way.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Main deleted the shared provider-timeline rig in stablyai#46786, which this PR's
rpc-extension-ui.test.ts imported. Keep the slice those tests need — a real
lane sink and the journal rows it writes — beside them, built from the
primitives main still ships. No production behaviour changes.
Every review thread is answered and resolved; the branch is up to date with main and merges cleanly.
clean passes and the status rollup is green; the local gate (pnpm check:changed) is green on the merged head.
The repository's own CI needs a maintainer approval to run on a fork PR, so it has not run on this branch yet.
Two notes for whoever reviews this: the composer split into NativeChatStructuredComposerInput.tsx exists because NativeChatStructuredSession.tsx sits at the 400-line max-lines budget on main with no baseline entry, and the journal rig in pi-extension-ui-journal-rig.test-fixture.ts only covers what the Pi extension-UI tests need, since main has no equivalent.
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
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.
ELI5
A Pi extension can draw things in its host: a todo list above the input, a status line, a notification. In a Pi native chat Orca threw all of those drawings away, so the extension looked broken even though its tools still ran. This PR draws them.
What Changed
Before:
src/main/pi/rpc/rpc-dialog-callbacks.tsheldso every fire-and-forget
extension_ui_requestdied in the main process. TwosetStatuskeys were already consumed further down (Orca's own background-work bridge and the subagent roster); everything else — widget panels, notifications, arbitrary status keys — reached no UI and told the extension nothing. Only the dialogs (select/confirm/input/editor) worked.After, each method lands where Pi's
rpc-extension-ui.mdsays it can:notifynotifyType(infoplain,warning,error)setStatusstatusKeyrevises that row, pi clearing the key removes itsetWidgetwidgetPlacement; same-key sends revise in place,widgetLines: undefinedremoves itsetTitleset_editor_textMechanism, reusing what the journal already does: rows ride the existing agent journal as
kind: 'status'items with additivepresentationhints (extension-notice,extension-status,extension-widget,extension-widget-below), the documented channel for "optional display hints; unknown values retain the ordinary text fallback". A shared reader (agentSessionExtensionStripRows) turns those rows into the composer's strips, and the shared row-content projection drops them from the transcript so nothing is drawn twice. Keyed rows are derived from the extension's own key, so the same key always revises the same journal row.Two things the old list got wrong, fixed here:
set_editor_textis spelled with underscores in Pi's protocol; the old camelCasesetEditorTextentry never matched, so those frames fell through to the dialog path and were answered with a bogusextension_ui_response { cancelled: true }for a call that takes no answer. All five methods are now consumed for real.setTitle/set_editor_textcannot be drawn today: Orca owns the chat tab title (structured-chat-naming/ user rename) and the composer draft, and no host channel lets a provider child claim either. They are consumed with a one-line reason in the code rather than pretended into a surface. When a channel exists they drop in beside the other three.Bounded at the boundary, since this is third-party text aimed at the DOM: 64 widget lines, 500 chars per line, and a repeated identical value costs no journal revision.
Why
Pi's RPC mode documents these calls as its only extension UI channel, so dropping them means every widget-style extension is invisible in Orca chat while its tool rows keep working — the failure mode is silence, not an error (see the issue's
rpiv-todoreproduction). The four dialog methods already work, so the gap is only the fire-and-forget half.Alternatives considered: a dedicated journal item kind for widgets (schema, projection and mobile work for ephemeral text, and rows that outlive the child), and a bespoke IPC channel (a second transport for one provider). The status-row + presentation route is additive for older clients and needs no new persistence.
Linked Issue
Fixes #43862
Visual Proof
Before: nothing renders for
setWidget/setStatus/notify; the transcript shows only the tool rows. The old guard is quoted above — the absence is the bug, and the reverted-code run below shows the new tests failing without the change.After (component fixture,
NativeChatComposerExtensionUi, light and dark):Reproduce locally:
The panel is mono text in one of the composer's dock cards — a full-width bordered card since #48792 — placed between the thread-goal strip and
/mcp's tray, and the extension's status line is the quiet strip card under it. Screenshots live on the throwaway fork branchpi-widgets-proof, not in this PR's files, and were re-shot against main after #48792 restyled these strips.Testing
What each test pins, all through the real lane + sink + on-disk journal (so a frame that is still dropped cannot pass):
notify→ one transcript row per call, in the extension's tone, and no strip entry.setStatus→ one keyed strip entry that revises on a second send (same journal item id) and disappears when pi clears the key.setWidget→ keyed panel with the sent lines,aboveEditor/belowEditorplacement, in-place revision, removal on clear.setTitle/set_editor_text→ no rows and no response frame (a cancelled reply would be protocol noise).notifystill draws one.Fail-without-the-change check (temporarily restoring the old drop):
pnpm tcexits 0.pnpm check:code-quality:changed origin/main→ 0 new findings across 13 changed files.pnpm check:changedpasses every gate except its repo-wide unit selection, which fails on unrelated orchestration/federation suites; I verified those same failures on a cleanorigin/maincheckout with this branch stashed (e.g.peer-mail.test.ts,agent-session-subscriber-catch-up.test.ts), so they are pre-existing here and not from this diff.Performance
Bounded by construction, because third-party extension text is the input: a widget is capped at 64 logical lines and 500 characters per line, and a repeated identical value costs no journal revision, so a chatty extension cannot grow the journal. Nothing polls or re-parses —
notify,setStatusandsetWidgetride journal items the chat already writes, and the strips are projected from those rows when the composer renders, so the added work per frame is a keyed lookup in the strip map.Risk
Level: Low
presentation) was already optional and already documented as a display hint. Older hosts/clients simply render the row's text.AI Disclosure
Implemented with Pi (model
workbuddy/deepseek-v4.1-flash) driving the repo's own typecheck, lint and test gates; no human-authored code in this PR.