Skip to content

feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends - #2953

Merged
LordMelkor merged 9 commits into
block:mainfrom
LordMelkor:clod/plugin-tool-approval
Nov 22, 2026
Merged

LordMelkor merged 9 commits into
block:mainfrom
LordMelkor:clod/plugin-tool-approval

Conversation

@LordMelkor

@LordMelkor LordMelkor commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

A plugin tool that acts on the owner's behalf—such as clearing notes or sending mail—can only be fully on or fully off today; this PR lets plugins ask the owner first in a cross-page notice and wait for their answer.

What changes

  • ctx.notices.show(content, { signal }) (src/features/notices/service.ts, ShellNotices.tsx): displays a notice in the app's toast stack over any page or Settings, with a title, optional description, up to three action buttons, and "From <plugin name>". Resolves with the chosen button's id, or undefined if dismissed, aborted, or the plugin stops.
  • Turn & MCP cancellation (src/buzz-mcp/external.ts, src/bundled/claude-code/claude.ts): client.signal now aborts when a Claude turn ends or an external MCP client closes or sends notifications/cancelled, withdrawing waiting asks automatically.
  • Keyboard over modals (src/shared/design-system/ui/Toast.tsx, patches/sonner@2.0.8.patch): notices with buttons opt into reachableOverModal, letting F6 move from Settings to the notice, Tab across buttons, and F6/past-last-Tab return to an uncovered Settings control.
  • Size: production +344/−21 (FOUNDATION +6 in services.ts +3, App.tsx +2, author.ts +1), tests +715/−1, docs +98/−11.

What to decide or check

  • macOS keyboard navigation untested: F6/Tab focus return over Settings was tested on Linux WebKitGTK and Chromium only. On macOS WebKit, Tab skips buttons unless Full Keyboard Access is on (Option+Tab reaches them).
  • Known limitations:
    • Notices don't show during onboarding, don't alert an owner who is away from Buzz, and still cover most of Settings' Close button (plain Tab can reach it; under heavy CPU load, focus can rest on Close briefly before moving).
    • Under ctx.agents.harness or Codex watch/timer runs, waiting asks stay until answered or dismissed (no per-turn signal).
    • Cancelled external MCP calls still send their reply/writes (app-client.ts:61-64).
    • Stacked dialogs, multiple waiting notices, scrolled-off return targets, and F6 scrolling an overflowing stack are not handled/tested.
    • Because plugins share the app's JS context, fail-closed approval policy stays in each plugin.

Testing

All runs at eeecb028f (main 38c627a7b) on a separate Linux machine:

  • Suites & CI: unit and pre-push lanes (286 files, 10,106 tests, design), shell-notices.spec.mjs (160/160 WebKit, 80/80 Chromium; 6/6 on 2-CPU flake check), focus-navigation.spec.mjs (11/11 each), and hosted CI (71 pass, Windows native skipped) pass. Six parts of the focus change each fail a test in both engines when reverted alone.
  • Desktop E2E (82691d6f6, test-only diff to eeecb028f): real Linux desktop app (WebKitGTK), local relay, and real Claude agent passed 11/11 steps and 50/50 checks, including keyboard-only F6/Tab/Shift+Tab/Enter/Escape flows over Settings.

Core change check

Core change Necessity Minimality
src/features/notices/service.ts (+122): ctx.notices.show Plugins can't import ToastNotice (@buzz/author is type-only); a second toast system isn't allowed (DESIGN.md); notifications lack buttons; accessories only show in-thread. One method (title, description, up to 3 buttons) resolving to picked id; host owns placement, stacking, Dismiss, and plugin name.
src/features/notices/ShellNotices.tsx (+58) Notices need a shell mount beside InterruptedNotice. Renders via ToastNotice with plugin name in details, setting reachableOverModal when buttons exist.
Toast.tsx (+110/−6), sonner@2.0.8.patch (+4) guardModal blocks F6 while a modal is open, trapping keyboard users out of waiting notices. One opt-in reachableOverModal prop; returns focus to first uncovered modal control (Sonner patch restores origin when target is hidden).
src/buzz-mcp/external.ts (+26/−2) Core drops notifications without an id, so notifications/cancelled never reaches tools. Per-connection tools/call abort map cleaned up on completion.
services.ts (+3), App.tsx (+2), author.ts (+1) (FOUNDATION) Wires service creation, shell mount, and Notices type export. One construction, one mount element, one type re-export.
Example tool, extra details, lint notes, and Try it steps

Example tool (notes_clear)

ctx.agents.addTool({
  name: "notes_clear",
  description: "Clear this plugin's saved notes, once the owner allows it.",
  inputSchema: { type: "object" },
  async call(client) {
    const always = "example.notes.always-clear";
    if (localStorage.getItem(always) !== "yes") {
      const notices = ctx.reflect.get("notices");
      if (!notices) throw new Error("This Buzz can't ask the owner first");
      const agent = ctx.agents
        .snapshot()
        .running.find((item) => item.key === client.key);
      const answer = await notices.show(
        {
          title: `Let ${agent?.name ?? "your agent"} clear your notes?`,
          actions: [
            { id: "once", label: "Allow once", prominent: true },
            { id: "always", label: "Always allow" },
            { id: "deny", label: "Deny" },
          ],
        },
        { signal: client.signal },
      );
      client.signal?.throwIfAborted();
      if (answer !== "once" && answer !== "always")
        throw new Error("The owner did not allow this");
      if (answer === "always") localStorage.setItem(always, "yes");
    }
    localStorage.removeItem("example.notes");
    return "Cleared the notes";
  },
});

Extra notes

  • src/bundled/claude-code/claude.ts (+15/−6) is plugin code; a grep of added core runtime lines for src/bundled folder names and approv finds nothing.
  • When a focused notice with waiting buttons closes, focus now returns to where it was before the notice (even with no modal open), rather than resetting to the page.
  • Automated review raised 3 findings, all listed under Known limitations.
  • Added-lines lint had 6 intentional findings: spec filename (shell-notices.spec.mjs, 2), localStorage failure double (appearance.spec.mjs:383), two vi.fn doubles matching claude.test.ts, and @vitest-environment pragma in ShellNotices.test.tsx.

Try it

  1. In a dev plugin with inject: ["agents"], add the notes_clear example tool (docs/plugin-architecture.md → "Shell notices").
  2. Ask an agent to clear your notes; a notice appears with "From <your plugin>" while the agent waits.
  3. Open Settings: the notice stays on top; press F6 to reach it, Tab across buttons, and F6 again to return.
  4. Deny / Escape returns "The owner did not allow this"; Allow once clears and asks next time; Always allow skips future prompts; stopping the agent mid-prompt dismisses the notice.

Made with human guidance from the maintainer driving this work.

🤖 Generated with Claude Code

@LordMelkor
LordMelkor requested a review from a team as a code owner November 7, 2026 02:06
@LordMelkor
LordMelkor force-pushed the clod/plugin-tool-approval branch 3 times, most recently from 08647b1 to c68a2e0 Compare November 15, 2026 14:36
@LordMelkor
LordMelkor force-pushed the clod/plugin-tool-approval branch from c68a2e0 to 6963e63 Compare November 17, 2026 20:05
@LordMelkor LordMelkor changed the title feat(plugins): let a plugin tool ask the owner before it runs feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends Nov 17, 2026
@LordMelkor
LordMelkor force-pushed the clod/plugin-tool-approval branch 4 times, most recently from 41adb74 to c4fd305 Compare November 19, 2026 16:30

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 I read the notices service, ShellNotices, the Claude turn-abort change and the external-MCP cancel handling, and found no correctness problems: abort, dismiss and plugin-scope teardown all settle the promise once, and in-flight cancel entries are cleaned up in finally. This adds a user-visible toast surface, and src/app/App.tsx, src/app/services.ts and src/plugins/author.ts are FOUNDATION files, so it needs a design or core-team reviewer and a maintainer's sign-off on those three files. Joah isn't approving UI changes, and this author isn't on the Buzz maintainer list, so a human Buzz maintainer needs to review it.

@LordMelkor
LordMelkor requested a review from a team November 19, 2026 19:04
@LordMelkor
LordMelkor force-pushed the clod/plugin-tool-approval branch 2 times, most recently from c755681 to 3c4f62a Compare November 19, 2026 23:12

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Re-reviewed through e03be2d. The changes since my last review are small: the pi and agents call-signal lines were dropped because main now provides them, the scroll-bound wording in the docs was fixed, and the browser journey now closes Settings with Escape.

I found no problems with stopping a plugin's tool calls when the turn ends. The Claude abort uses a per-turn controller that is replaced at each turn end, so the next turn's calls get a fresh signal, and the Claude test covers that. An external notifications/cancelled aborts only the call whose id matches on that connection, and a service test checks that a second call is untouched. Notice listeners are removed when a notice settles, and in-flight entries are deleted in finally. The notices, Claude, buzz-mcp and external-connection tests pass locally.

My earlier point still stands. This adds a user-visible notice surface and touches FOUNDATION files (App.tsx, services.ts, author.ts) plus DESIGN.md. The author is outside the core maintainer group, so this is a COMMENT, not an approval, and it needs review from a human core-team maintainer and a design reviewer before merge.

@LordMelkor
LordMelkor force-pushed the clod/plugin-tool-approval branch from e03be2d to f58bf5f Compare November 20, 2026 00:58
@LordMelkor
LordMelkor requested a review from a team November 20, 2026 01:28

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Re-checked f58bf5f. It is a rebase of e03be2d onto current main. The only delta is merging the new seen service lines beside notices in the docs, author.ts and author.test.mjs, and those merge correctly. My earlier review stands. Because the author is outside the core maintainer group, this is a comment only. It still needs a human core-team maintainer and a design reviewer.

@LordMelkor
LordMelkor requested a review from a team November 20, 2026 02:20
@LordMelkor
LordMelkor force-pushed the clod/plugin-tool-approval branch from 678811d to 8d05192 Compare November 20, 2026 22:26

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 :bot: Jude’s code review agent

Verdict: REQUEST CHANGES recommended (submitted as COMMENT under this repository’s agent-review policy). Reviewed: live base 27a83bb658105df0a490983a184abe7a09f6927b → head 8d0519208cfe01002f3379d43954343ac7eb6453; PR changes inspected from merge-base 16a65437ba0cedf3ff53131a6b35680b5a7e6a79 (17 files, clean worktree). Risk: high—an agent tool can wait on an owner’s answer across the shell while cancellation must withdraw that wait.

Blocking finding (P2, accessibility): The new global notice is visible and pointer-clickable over Settings, but is unreachable by keyboard while Settings is open. In the exact-head browser journey, focus began on “Close Settings” inside [aria-modal=true]; F6 left focus there, and 40 Tabs never reached the notice’s “Allow once” action. src/app/App.tsx:835 mounts ShellNotices outside the modal, src/features/notices/ShellNotices.tsx:29–54 puts the waiting request in the portaled toast stack, src/shared/design-system/ui/Toast.tsx:95–103 deliberately suppresses F6 under a modal, and src/shared/design-system/ui/Dialog.tsx:67,252–283 owns the modal focus boundary. A keyboard-only owner must leave Settings before answering or refusing the waiting request, contrary to this PR’s cross-page action contract. Make this pending request answer and dismissal reachable within the active modal’s keyboard/focus boundary (without globally bypassing modal containment for unrelated toasts); add a browser regression that opens Settings with the request pending and answers it by keyboard without closing Settings.

Behavior/contracts traced: NoticesService ties the request to its plugin effect, validates chosen action IDs and settles once on pick/dismiss/abort/scope disposal (src/features/notices/service.ts:84–120). External MCP cancellation aborts the matching connection/request call and deletes in-flight state in finally (src/buzz-mcp/external.ts:37–43,97–110); Claude’s turn-end abort gives subsequent turns a fresh signal (src/bundled/claude-code/claude.ts:936–952,1011–1022,1114–1155). The dispatcher seam has regression tests in src/features/agents/service.test.ts:20809–20926. No separate systems blocker found. The author-reported Dismiss-X point hit-testing alone is not a proven defect: the shared close control intentionally appears on hover/focus.

Author action: fix and test the modal keyboard path above. Verification owner: author for the fix; reviewer for the exact-head keyboard/browser retest; human maintainer/design review for FOUNDATION/UI scope before merge.

Validation: At matching clean HEAD, git diff 16a65437..HEAD --check passed. Hosted run 44829025434 reports exact head, attempt 3 completed/success (73 successful checks, Windows native skipped); its earlier WebKit shard failed and was rerun. The PR reports vitest run at this head (1,187 passed files, 25,193 passed tests) and a Linux WebKitGTK Tauri debug-build/Claude/local-relay end-to-end drive at this head; these are author evidence, not a reviewer-run package/native pass. Reviewer browser inspection reproduced the keyboard failure above at the exact head.

Manual/native evidence and residual risk: The author’s Linux Tauri debug-app drive covers Allow once/Always allow/Deny/Stop, but not keyboard-only approval over a modal. macOS-native, both-theme, narrow and enlarged-text journeys were not independently exercised here; Windows native was skipped. Those are verification gaps, not additional author defects. No relay sends/accepts changed, so no desktop/mobile relay-contract flag.

@LordMelkor

Copy link
Copy Markdown
Contributor Author

🤖 Fixed in d09fac7c9. With Settings open, a keyboard user can now answer or refuse the waiting request without closing Settings.

  • F6 moves from Settings to the notice, Tab reaches its buttons, and Enter answers. F6 again, Tab past Deny, or Shift+Tab from the notice returns focus to Settings. Escape on the notice refuses it, and Settings stays open.
  • Only notices whose buttons wait for an answer opt in, through a new reachableOverModal prop. Other toasts keep main's behaviour under a modal.
  • Regression in tests/browser/shell-notices.spec.mjs: with Settings open and the request pending, one test answers it with F6, Tab and Enter. Another moves between the notice and Settings with F6, Tab and Shift+Tab, then refuses with Escape. Both check that Settings stays open and that focus lands back on its close button. WebKit passed 160 of 160 runs and Chromium 80 of 80, and each keyboard test fails when its part of the focus change is removed. A third test checks that a toast that doesn't opt in keeps its Tab order over Settings; it passes on main's focus code too.
  • On macOS, WebKit's Tab skips buttons unless full keyboard access is on, and Option+Tab reaches them there. macOS was not tested.
End-to-end run at d09fac7c9: real app, local relay and Claude agent

On a separate Linux machine, from a clean state, with screenshots. Every key in steps K1 to K3 was a real key event, and none of those steps moved focus by script.

Step Result at d09fac7c9
1. Install the plugin; create the agent Installed. The agent called notes_add (one note kept) and said notes_clear was in its tool list.
2. Ask the agent to clear the notes A notice on the conversation page: "Let Juniper clear your notes?", "From Notes keeper", and the buttons Allow once, Always allow and Deny. The agent's turn kept working, with its Stop control in the page. In the conversation view the waiting turn showed notes_clear running.
3. Open Settings while the notice shows The notice stayed above Settings. The Deny button's centre hit-tested to the button.
4. Deny (clicked with Settings open) The notice closed and Settings stayed open. Tool error: "The owner did not allow this". The note was kept.
K1. Ask again; with Settings open, F6, Tab to Allow once, Enter F6 moved focus from Close Settings to the notice's toast item, with a 2 px solid focus ring (:focus-visible). Tab went to Dismiss notification, then Allow once. Enter answered: "Cleared the notes", and example.notes went from set to empty. Settings stayed open, and focus was on Close Settings, inside the dialog, at once.
K2. Ask again; with Settings open, F6, F6, F6, Escape F6: the notice. F6 again: back to Close Settings, inside the dialog. F6 once more: the notice. Escape refused it: tool error "The owner did not allow this", and the note was kept. Settings stayed open, and focus was on Close Settings, inside the dialog.
K3. Ask again; with Settings open, F6, Tab past the last button, F6, Shift+Tab Tab went Dismiss notification, Allow once, Always allow, Deny, then back to Close Settings, inside the dialog. F6 went back to the notice, and Shift+Tab from it went to Close Settings, inside the dialog. Focus did not reach the page behind Settings. Deny (a click) then gave "The owner did not allow this".
5. Ask again, then Escape on the notice The notice closed. Same tool error. The note was kept.
6. Ask again, then Allow once "Cleared the notes". example.notes went from set to empty. The next ask showed the notice again.
7. Always allow, then ask again "Cleared the notes", and always-clear was set to yes. With a new note, the next ask ran with no notice and returned "Cleared the notes".
8. Clear always-clear, ask, then Stop the turn The notice went away by itself 49 ms after the Stop click (page clock; 55 ms in the last run), with no answer. 8 s later no notice had come back and no Stop control was left. The turn shows "Stopped", and the note was kept.
  • Keyboard and the accessibility tree: at every focus reading in K1 to K3 (23 in all), no ancestor of the focused element, and not the element itself, had aria-hidden="true" or inert. A trial drive of an earlier version of this fix showed what this guards: there, Tab past Deny went to the page's "Skip to content" link and Shift+Tab from the notice went to the composer's Send message button, both behind Settings and both under aria-hidden="true".

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 :bot: Jude’s code review agent

Verdict: COMMENT — request changes recommended (agents do not submit Request Changes in this repository). Reviewed: base 27a83bb658105df0a490983a184abe7a09f6927b → head d09fac7c9d77bb8742c4a9acae0489768fe3700f (clean exact-head checkout). Risk: high: owner-mediated plugin actions remain pending across the app while keyboard focus traverses modal and toast boundaries.

Blocking finding (P2, focus visibility): Returning from an actionable notice over Settings can focus a control that the notice completely covers. The new keyboard journey focuses Settings Close before F6 and expects focus back there after Shift+Tab/F6 or after answering (tests/browser/shell-notices.spec.mjs:42–50,75–93); Sonner restores that saved target (patches/sonner@2.0.8.patch:121–137). In a reviewer-run Chromium probe at this head, after F6 → Shift+Tab the Close control was document.activeElement with a computed 2px outline, but its entire 32×32 box (1231,126)–(1263,158) was covered by the actionable toast (1022.5,116.05)–(1421.5,193.92). The captured frame shows no usable focus indicator. The toast deliberately paints above dialogs (src/shared/design-system/styles/overlays.css:575–600); src/shared/design-system/DESIGN.md:819–825 requires visible keyboard focus and a ring on focused dialog buttons. An owner pressing Tab back into Settings cannot see what Enter would activate. Return to an unobscured modal control or reposition the notice to leave the return target and its focus ring visible; add a regression that checks actual occlusion/visibility, not just toBeFocused().

Other contracts traced: F6 selects only opt-in, non-inert notice cards while a modal is active; the focus listeners unregister on unmount (Toast.tsx:96–140). The CSS guard and Sonner blur restoration provide the Tab handoff; the changed browser journey exercises F6, both Tab directions, Enter, Escape and a non-opt-in toast. Existing pointer-dismissal coverage remains. No further systems or relay-contract defect was established; this is a renderer focus/stacking issue, not a desktop/mobile relay-contract change.

Author action: fix the occluded return focus and protect it with a visual/geometry regression. Verification owner: author for code/test; reviewer for exact-head Chromium/WebKit retest; maintainer for required FOUNDATION/UI review. No other author rework is requested.

Validation: git diff 8d051920..HEAD --check passed at the matching clean head. Reviewer isolated Linux environment: pnpm check, pnpm build, pnpm design:test (214 tests) and pnpm design:build passed at that head; the reviewer Chromium overlap probe reproduced the defect 1/1. First full pnpm test attempt stopped on a concurrent rustup toolchain-download race in plugin-manager-lock.test.mjs:19; pinned-toolchain reinstall and full-suite rerun are in progress, not counted as a pass. GitHub checks at this head reported 72 statuses with no failures and Windows native skipped at review time; these are not native user-journey proof.

Manual/native evidence and residual risk: The overlap was reproduced in Chromium on Linux; the author reports Linux WebKitGTK/Chromium keyboard journeys. This review did not independently run macOS-native, Windows-native, both-theme/narrow/enlarged-text, or other modal journeys. Those are verification gaps, not additional author defects. Recommendation: request changes for the one proven focus-visibility regression above.

LordMelkor and others added 5 commits November 21, 2026 19:31
…heir turn ends

A plugin tool could not wait for its owner's answer where the owner is:
an installed plugin can't reach the shared toast stack, and several hosts
never told a plugin tool to stop waiting.

Add ctx.notices.show(content, { signal }). A plugin shows a notice in
the toast stack on any page, with a title, an optional description and
at most three actions. It resolves with the picked action's id, or
undefined when the person dismissed it, the signal aborted or the
plugin stopped. The host owns placement, stacking and Dismiss, and names
the plugin from its manifest in ToastNotice's existing details slot. A
plugin reads it with ctx.reflect.get("notices"); it needs no grant.

Make client.signal reach more plugin tools: an external MCP connection
aborts a call on notifications/cancelled or when it closes, Pi passes its
per-call signal, and Claude ends each turn's call signal when the turn
ends, through one endTurn() at every turn end.

The approval policy (the answers, their wording and any Always allow
store) stays in the plugin whose tool asks.

Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
Main's block#3762 builds every app client's `client.signal` from
`callSignal ?? signal`, so Pi's tool calls and an external connection's
client already get their signal without this PR passing `callSignal`.
Remove the two lines and the Pi test that only checked main's code.

Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
The toast stack that shows plugin notices scrolls within the window's
height once expanded; it has no 40% bound.

Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
Main now shows notices at the top right, where a notice covers
Settings' Close button, so the journey closes Settings with Escape
pressed in Settings. Pressed on the page, Escape sometimes went to the
notice just answered: in some WebKit runs focus was still on its Allow
once button while it was on screen, and the notice handles Escape
itself.

Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
LordMelkor and others added 3 commits November 21, 2026 19:31
While a modal is open, F6 now moves through notices that opt in with
reachableOverModal and then back into the modal. Tab past such a
notice's last control, or Shift+Tab out of it, also returns focus to the
modal instead of the hidden page, the browser or a notice that does not
opt in. Plugin notices with actions opt in, so a keyboard user can
answer or refuse one without closing Settings. Other notices keep
today's behavior, including their Tab order.

Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
…ings

Focus that leaves a notice for an open modal goes back to where it came
from. Over Settings that is Close, which the notice stack covers, so a
keyboard user could not see what Enter would activate. After such a
keyboard return, the focused control shows its focus ring, and a
control that a notice covers, or whose focus ring it covers, hands
focus to the modal's first visible control that no notice covers.
Pointer answers, the stack's position and notices that do not opt in
are unchanged.

The keyboard journey now checks at each return (F6, Tab past the last
button, Shift+Tab, Enter on an action and Escape) that the focused
control and its ring are not under a notice, by rect and hit-test. The
pointer journey checks that a click answer leaves focus where it was,
with keyboard mode off.

Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
Tab past the last control of a notice over a modal no longer needs an
extra Tab stop after the notice stack. Focus moves on into the modal,
and the return check then gives the control keyboard focus, so its
focus ring shows. The guard element, its CSS and its two lint
exceptions are removed. Nothing else changes.

Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
@LordMelkor
LordMelkor force-pushed the clod/plugin-tool-approval branch from d09fac7 to 82691d6 Compare November 21, 2026 21:11
@LordMelkor

LordMelkor commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Update: CI's WebKit flake check failed the Enter test at 82691d6f6. Under load, the test checked focus before the app had moved it off Close. eeecb028f makes the test wait for focus to come back first; the app code doesn't change. CI passes at that head, the WebKit flake check included.

Fixed in 82691d6f6, for the review on d09fac7c9: with Settings open, focus that comes back from a waiting notice now lands on a control you can see.

  • When a notice covers the control focus goes back to (Settings' close button), focus moves to the dialog's first control that no notice covers, and its keyboard ring shows. In Settings that's "Copy community URL". This holds at every return: F6 back, Tab past the last button, Shift+Tab, Enter on an answer, and Escape.
  • A return target that isn't covered is focused again through the app's keyboard-focus path, so its ring also shows after Escape in WebKitGTK.
  • The focus guard element is gone, since no return needs it now. A pointer answer leaves focus where it was, as before.
  • Regression in tests/browser/shell-notices.spec.mjs: first it checks that the notice covers Close, so the check can fail. Then, at each return point, after the stack settles, it checks that the focused control and its ring aren't under a notice, both by geometry and by hit-testing the centre and the ring corners. With d09fac7c9's Toast.tsx it fails at all 5 return points in both engines. At this head: WebKit 160 of 160 runs, Chromium 80 of 80.
  • Not changed: plain Tab inside Settings still reaches Close under the notice (78% of its box is covered in a 1200×800 window). The PR body lists this with the other limits.
End-to-end run at 82691d6f6: real app, local relay and Claude agent

On a separate Linux machine, from a clean state, with screenshots. Every key in steps K1 to K3 was a real key event, and none of those steps moved focus by script. All 11 steps and 50 checks pass.

Step Result at 82691d6f6
1–8. Install, the notice, the notice over Settings, Deny by click, Escape, Allow once, Always allow, Stop All pass, as in the run on d09fac7c9. Stop took the notice down in 52 ms.
K1. With Settings open, F6, Tab to Allow once, Enter F6 reached the notice with its focus ring, and Tab went to Dismiss notification, then Allow once. Enter cleared the notes. Focus went to "Copy community URL" with its ring, and Settings stayed open.
K2. F6, F6, F6, Escape F6: the notice. F6 again: "Copy community URL". F6 once more: the notice. Escape refused it ("The owner did not allow this"), the note was kept, and focus went to "Copy community URL".
K3. Plain Tab, then F6, Tab past the last button, F6, Shift+Tab Plain Tab inside Settings went to "Copy community URL", then Close Settings under the notice (78% of its box covered). From the notice, Tab went Dismiss notification, Allow once, Always allow, Deny, then "Copy community URL". F6 went back to the notice, and Shift+Tab went to "Copy community URL".
  • At all 5 returns, the focused control was inside the dialog, its focus ring was solid, no notice covered it or its ring, and its centre hit-tested to it. No ancestor had aria-hidden="true" or inert.
  • The Sonner patch lines: a run of the same build without this PR's 4 lines in patches/sonner@2.0.8.patch failed K3. There, Tab past Deny left Settings for the page's "Skip to content", and Shift+Tab went to "Send message" behind Settings.

The notice journeys checked the focused control one frame after the
notice animations settled. When focus came back into Settings late,
as after Enter on an action under CPU load, that check could run in
the same frame as the return check that moves focus off a control
the notice covers, and before it. It then saw Close under the notice
and failed. The helper now waits until a control in Settings has
focus, and then settles and measures. Product code does not change.

Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 :bot: Jude’s code review agent

Verdict: APPROVE. Reviewed live base e1dc4a48080fb935faaa11b93852a4cc43c7eac3 → head eeecb028fa8664e38f53b5ce41abdc7a5c44ca3b (clean exact-head checkout; PR diff compared against merge-base 38c627a7b). Risk: high — plugin actions can wait for an owner’s answer across Settings while turn/connection cancellation must withdraw the request.

Behavior/contracts traced: NoticesService.show validates actions, settles once and withdraws on abort or plugin disposal (src/features/notices/service.ts:84–120). External MCP cancellation scopes an in-flight call to its connection and cleans it on completion (src/buzz-mcp/external.ts:13,37–43,95–110); Claude’s turn-end signal aborts waiting tools (src/bundled/claude-code/claude.ts:936–952,1007–1023,1121–1155). Actionable notices opt into modal keyboard navigation; Toast.tsx:159–187 redirects a keyboard return from a notice to an uncovered Settings control if the original is under the toast. No client↔relay event, field, auth rule, or response shape changes were found in the PR three-dot file diff.

Findings: No unresolved blocking code finding at this head. The prior d09fac7 invisible-focus finding is fixed: an exact-head browser journey verifies F6/Shift+Tab returns focus to a visible Settings control with a visible ring. Settings Close still overlaps the notice visually, but a direct center hit-test and mouse click at 1200×800 in both Chromium and WebKit targeted Close, dismissed Settings and left the unanswered notice present; a blocked pointer action was not reproduced. The visual overlap remains an acknowledged limitation, not a demonstrated failed control in this checked journey.

Author action: none from this review. Verification owner: reviewer/tooling for macOS-native keyboard and screen-reader behavior, theme/size variants; CI/release gate for any required native platform checks. The FOUNDATION/UI changes still require the repository’s applicable maintainer review.

Validation: At clean HEAD above, git diff e1dc4a48..HEAD --check passed. Reviewer-run CI=1 ./bin/pnpm exec playwright test --config tests/browser/playwright.config.mjs tests/browser/shell-notices.spec.mjs --project=chromium --project=webkit --no-deps --workers=1 passed 8/8 on this head. Hosted run 44962756554 attempt 2 reports success at this head; live PR checks show 71 successful, 1 Windows-native skipped. I did not independently run the full package suites.

Manual/native evidence and residual risk: Browser keyboard and pointer journeys above are not macOS Tauri/assistive-technology proof. The reported Linux WebKitGTK desktop acceptance was at 82691d6f6 (the following head change was test-only), not an independently witnessed final-head native run. macOS WebKit keyboard behavior, actual screen-reader output, and both-theme/narrow/enlarged-text visual checks remain unverified; these are reviewer/tooling gaps, not requests for author rework. This approval is code-review clearance, not a claim that the skipped/native release gate passed.

@LordMelkor
LordMelkor merged commit 1044a41 into block:main Nov 22, 2026
139 of 141 checks passed
johnmatthewtennant added a commit that referenced this pull request Nov 22, 2026
…ke-deadline

* origin/main: (133 commits)
  feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends (#2953)
  perf(messages): cut per-update timeline work while agents are active (#4211)
  feat(agents): file any conversation in the owner's workspaces (#4173)
  Read membership notices with each channel head (#4179)
  fix(goose): forward Databricks AI Gateway turns (#4127)
  feat(agents): let a bundled plugin choose the gateway's harnesses (#4108)
  Stabilize the sidebar presence geometry click (#4059)
  docs(channels): list the 3-day Active tile (#4118)
  feat(conversation): let plugins hold a composer message and publish it later (#2971)
  Never run the full JS suite on pre-push (#4176)
  Hold channel rows until a window's first page lands (#4154)
  Verify desktop agent reads off the renderer (#4137)
  Remove Engineering Discipline from the agent base prompt (#4175)
  feat(composer): let completion providers add rows beside the caret owner (#3836)
  feat(agents): let an agent type name its skill folders (#4002)
  perf(agents): index activity triggers so idle rows skip turn replay (#4087)
  Let agents request plugin installs from a local folder (#4158)
  docs(agents): build new features as directory plugins first (#4022)
  Reduce frozen tag scans on relay reads (#4162)
  feat(agents): let a plugin harness show its sessions in the host transcript viewer (#4153)
  ...

# Conflicts:
#	src/features/agents/service.test.ts
@LordMelkor
LordMelkor deleted the clod/plugin-tool-approval branch November 22, 2026 13:15
joahg added a commit to joahg/buzz-app that referenced this pull request Nov 22, 2026
…ds-setup

* origin/main:
  feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends (block#2953)
  perf(messages): cut per-update timeline work while agents are active (block#4211)
  feat(agents): file any conversation in the owner's workspaces (block#4173)
  Read membership notices with each channel head (block#4179)
  fix(goose): forward Databricks AI Gateway turns (block#4127)
  feat(agents): let a bundled plugin choose the gateway's harnesses (block#4108)
  Stabilize the sidebar presence geometry click (block#4059)
  docs(channels): list the 3-day Active tile (block#4118)

Signed-off-by: Joah Gerstenberg <joah@squareup.com>

# Conflicts:
#	docs/plugin-authoring-guide.md
ljknight added a commit that referenced this pull request Nov 22, 2026
…ent-creation-request

* origin/main:
  feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends (#2953)
  perf(messages): cut per-update timeline work while agents are active (#4211)
  feat(agents): file any conversation in the owner's workspaces (#4173)
  Read membership notices with each channel head (#4179)
  fix(goose): forward Databricks AI Gateway turns (#4127)
  feat(agents): let a bundled plugin choose the gateway's harnesses (#4108)
  Stabilize the sidebar presence geometry click (#4059)
  docs(channels): list the 3-day Active tile (#4118)

Signed-off-by: Laura Knight <lauraknight@squareup.com>

# Conflicts:
#	docs/plugin-authoring-guide.md
ljknight added a commit that referenced this pull request Nov 22, 2026
…t-chrome-icons

* origin/main: (402 commits)
  docs: cut implementation narration down to short references (#4213)
  chore(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 (#4222)
  feat(plugins): let plugins copy text through Buzz's clipboard (#2920)
  feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends (#2953)
  perf(messages): cut per-update timeline work while agents are active (#4211)
  feat(agents): file any conversation in the owner's workspaces (#4173)
  Read membership notices with each channel head (#4179)
  fix(goose): forward Databricks AI Gateway turns (#4127)
  feat(agents): let a bundled plugin choose the gateway's harnesses (#4108)
  Stabilize the sidebar presence geometry click (#4059)
  docs(channels): list the 3-day Active tile (#4118)
  feat(conversation): let plugins hold a composer message and publish it later (#2971)
  Never run the full JS suite on pre-push (#4176)
  Hold channel rows until a window's first page lands (#4154)
  Verify desktop agent reads off the renderer (#4137)
  Remove Engineering Discipline from the agent base prompt (#4175)
  feat(composer): let completion providers add rows beside the caret owner (#3836)
  feat(agents): let an agent type name its skill folders (#4002)
  perf(agents): index activity triggers so idle rows skip turn replay (#4087)
  Let agents request plugin installs from a local folder (#4158)
  ...

Signed-off-by: Laura Knight <lauraknight@squareup.com>
Co-authored-by: Fizz <03d4666a4a2c5eacc22719b407aa15c36e5a4380ec913485e22753d35a7d1897@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	src/shared/design-system/DESIGN.md
LordMelkor added a commit to LordMelkor/buzz-app that referenced this pull request Nov 22, 2026
Merge origin/main (e5a9b4f: block#4211, block#2953, block#2920, block#4222 url 2.5.9, block#4213 short docs).

Resolved the two documentation conflicts from block#4213 by keeping origin/main's
removal of docs/plugin-architecture.md and shortened docs/buzz-help.md.

Co-authored-by: Neon <f68e5587c8df616f518c6e19ea842a595208c2f610357a8438457d26c2eb3c60@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
morgmart added a commit that referenced this pull request Nov 22, 2026
…ge-unread

* origin/main: (22 commits)
  docs: cut implementation narration down to short references (#4213)
  chore(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 (#4222)
  feat(plugins): let plugins copy text through Buzz's clipboard (#2920)
  feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends (#2953)
  perf(messages): cut per-update timeline work while agents are active (#4211)
  feat(agents): file any conversation in the owner's workspaces (#4173)
  Read membership notices with each channel head (#4179)
  fix(goose): forward Databricks AI Gateway turns (#4127)
  feat(agents): let a bundled plugin choose the gateway's harnesses (#4108)
  Stabilize the sidebar presence geometry click (#4059)
  docs(channels): list the 3-day Active tile (#4118)
  feat(conversation): let plugins hold a composer message and publish it later (#2971)
  Never run the full JS suite on pre-push (#4176)
  Hold channel rows until a window's first page lands (#4154)
  Verify desktop agent reads off the renderer (#4137)
  Remove Engineering Discipline from the agent base prompt (#4175)
  feat(composer): let completion providers add rows beside the caret owner (#3836)
  feat(agents): let an agent type name its skill folders (#4002)
  perf(agents): index activity triggers so idle rows skip turn replay (#4087)
  Let agents request plugin installs from a local folder (#4158)
  ...

Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>

# Conflicts:
#	docs/unread.md
matt2e added a commit that referenced this pull request Nov 23, 2026
## Problem

The **JavaScript checks** job is failing on `main`. Its type check (`tsc
--noEmit`, part of `pnpm check`) reports one error:

```
src/features/notices/ShellNotices.test.tsx(25,7): error TS2322
  Property 'hostOwned' is missing in type '{ configuration: …; activation: {}; busy: boolean; error: null; refreshError: null; }'
  but required in type 'Pick<PluginManager, "subscribe" | "snapshot">' (the type `snapshot()` returns).
```

## Cause

Two PRs crossed:

- #2953 (1044a41) added `ShellNotices.test.tsx`, which builds a fake
plugin manager snapshot.
- #3701 (c8e7b73) then made `hostOwned`, the manifests of the
host-owned features, a required part of the manager's snapshot in
`src/plugins/manager.ts`.

Neither saw the other, so each passed its own checks and `main` broke
when the second merged.

## Fix

The fake snapshot now carries `hostOwned: []`, in the position the
manager puts it (after `configuration`). The test models one external
plugin and no host-owned feature, so the empty list is what a real
manager with no built-ins reports. Other test fakes of the snapshot do
the same (`PluginUpdates.test.tsx`, `solo-navigation-testing.ts`).

This is the only type error on `main`: a whole-project `tsc --noEmit` on
unmodified `main` reports just this one, so no other fake lacks the
field.

Draft PR #4232 carries the same line in the same place as an incidental
change, so the two merge cleanly whichever lands first.

## Ran

On this branch (`main` at 38fe301 plus this commit):

- `pnpm exec tsc --noEmit` before the change: failed with the one error
above.
- `pnpm check` (Biome, `tsc --noEmit`, design typecheck, design checks):
passed.
- `vitest run src/features/notices/ShellNotices.test.tsx`: 1 file, 1
test, passed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants