Skip to content

Skip directives, tables, and raw JSON in notification previews - #5825

Open
hemaaanth wants to merge 1 commit into
get-bb:mainfrom
hemaaanth:fix/notification-preview-markup
Open

hemaaanth wants to merge 1 commit into
get-bb:mainfrom
hemaaanth:fix/notification-preview-markup

Conversation

@hemaaanth

@hemaaanth hemaaanth commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

The notification preview takes the first paragraph of the final agent message and strips inline Markdown. It already skipped headings and code fences, but it treated plugin directive lines, Markdown table rows, and JSON blocks as prose. When a message started with one of these, phones, web, and desktop showed the raw markup, for example ::page{id="2d98aecf-…" version="e4d24dd2-…"…. The pages skill puts ::page{…} first, so this hit most page-publishing turns. See #5824.

What changed

plugins/push-notifications/notification-text.ts now splits the message into paragraphs and returns the first one that is prose:

  • Leaf directive lines (::name[label]{attrs}) and table rows (lines starting with |) end a paragraph and are dropped, like headings and fences.
  • A paragraph that parses as a JSON object or array is skipped.
  • If nothing readable remains, the sender's existing fallback body applies ("Finished and waiting for you").

This doesn't add a text form for directives. The issue explains why that plugin API is left out. There are no wire, protocol, CLI, or documentation changes.

How you verified

  • New server.test.ts case "skips directives, tables, and raw JSON in the preview" covers a leading directive, a table, JSON, and a directive-only message. Without the fix it fails with the raw markup as each body. With the fix it passes.
  • The repro script in Notification previews show raw ::page directives, Markdown tables, and JSON #5824 now prints the expected output for all three cases.
  • Replayed 14 days of final agent messages from one real install (2,440 turns) through the old and new function. 33 previews changed: 30 page directives, 2 tables, and 1 JSON block. 29 now show the agent's sentence and 4 show the fallback body. No other preview changed, and none starts with markup anymore.
  • pnpm exec turbo run typecheck --filter=bb-plugin-push-notifications passes.
  • Plugin tests: 51/51 pass on Node 22.23.2. On Node 26.10.0, 10 client.test.ts cases fail on main too, because localStorage is undefined in the DOM environment. That file doesn't touch this change.

Fixes #5824

🤖 Generated with Claude Code

AGENT GENERATED

Notification previews took the first paragraph of the final agent
message as prose. A leading ::page{...} directive, Markdown table, or
JSON block was sent to phones, web, and desktop as raw markup. The
preview now skips those blocks like headings and code fences, and falls
back to the default body when nothing readable remains.

Fixes get-bb#5824

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Notification previews show raw ::page directives, Markdown tables, and JSON

1 participant