feat(notify): an ask takes 2 to 8 options and a longer question #48

Open
gabrielvidal wants to merge 0 commits from ask-more-options into main
pull from: ask-more-options
Owner

Summary

A notify ask (and POST /api/ask) now takes 2 to 8 options and a question of up to 4 000 characters; it was 2–3 options, the number of buttons an Android notification draws. The native Android app's ask screen already shows more (ai-agent-android #1, android-push plugin PR #33), but nothing could send one. The record keeps the whole ask; each surface shows what it can and never a part of the options.

Companion: ai-agent-plugins PR ha-ask-more-options (the Home Assistant integration lists the options and offers one Answer… past three). Independent of #43 / #33; no merge order with them.

Key changes

  • backend/notifications/service.py — ASK_MAX_OPTIONS 8, ASK_MAX_OPTION_CHARS 80, ASK_MAX_QUESTION_CHARS 4 000; _ask_fields answers 400 naming the limit broken. ask_push_text: a long question gets its first line as the web push title and the clipped question + options as the body. Past 3 options the web push carries optionCount instead of options.
  • backend/users/webpush.py — the payload goes out as UTF-8 (not \u escapes) so an accented question stays under the 4 KB record.
  • frontend/public/push-sw.js — an ask with more options than the device draws (Notification.maxActions) shows one Answer… button that opens the app.
  • frontend/src/business/notifications/components/askBits.tsx (new) — what the thread card, home's Waiting for feedback and the bell share: wrapped option buttons, all outlined past three, headline + text for a multi-paragraph question, a folded long question with Show all on home.
  • cli/notify.py — the same limits checked before anything is sent or queued in a worker's outbox; cli/test_notify_ask.py fails if the CLI and the hub drift.
  • Docs: CLAUDE.md, docs/plugins.md, the notify skill.

Key decisions

  • Eight, not unlimited: what a card still shows at a glance on a phone; past that it is a form's job (ask-form).
  • Never a partial set of buttons: a 3-option ask on Chrome (2 action buttons) used to show the first two alone; it now shows Answer… too.
  • Channel plugins get the ask whole and degrade themselves.
  • Not changed: a plugin's own notify.ask bridge (plugins/hubsignals.py) stays at 2–3 options — a consent push, a separate contract.

Changelog

  • Changed: a question from an agent can now offer up to 8 options and a longer text; the app shows them all, and a browser notification with more options than it can draw offers one "Answer…" button that opens the app

Test notes

  • This work was interrupted by the EVOX2 reboot of 2026-11-28 and finished on 2026-11-29: rebased on main, then verified.
  • Backend (bwrap, throwaway /data, one process per module): test_webpush.py 26 pass, plus test_notify_channels, test_notif_state, test_notif_paging, test_archive_notifs, test_askform, test_closing_notify, test_notify_audio, test_notify_log_account, test_plugin_tasks, test_taskevents all pass. The other backend modules were not run.
  • cli/test_notify_ask.py: 4 pass.
  • Frontend: tsc --noEmit clean; vitest on src/business/notifications, src/lib/pushSw.test.ts, src/i18n and src/business/conversations/components: all pass except FreshContext.test.tsx (CacheExpiredNotice), which already fails on main. The full frontend suite was not run.
  • Screenshot: mock build, phone viewport, the six-option ask on home.
  • Not tested: a real browser push with optionCount, and a real phone. Nothing is deployed; deploy from the Homelab after merge.

🤖 Generated with Claude Code

Screenshots

home-mobile.png

## Summary A `notify ask` (and `POST /api/ask`) now takes **2 to 8 options** and a question of up to **4 000 characters**; it was 2–3 options, the number of buttons an Android notification draws. The native Android app's ask screen already shows more (ai-agent-android #1, android-push plugin PR #33), but nothing could send one. The record keeps the whole ask; each surface shows what it can and never a part of the options. Companion: ai-agent-plugins PR `ha-ask-more-options` (the Home Assistant integration lists the options and offers one *Answer…* past three). Independent of #43 / #33; no merge order with them. ## Key changes - `backend/notifications/service.py` — `ASK_MAX_OPTIONS` 8, `ASK_MAX_OPTION_CHARS` 80, `ASK_MAX_QUESTION_CHARS` 4 000; `_ask_fields` answers 400 naming the limit broken. `ask_push_text`: a long question gets its first line as the web push title and the clipped question + options as the body. Past 3 options the web push carries `optionCount` instead of `options`. - `backend/users/webpush.py` — the payload goes out as UTF-8 (not `\u` escapes) so an accented question stays under the 4 KB record. - `frontend/public/push-sw.js` — an ask with more options than the device draws (`Notification.maxActions`) shows one *Answer…* button that opens the app. - `frontend/src/business/notifications/components/askBits.tsx` (new) — what the thread card, home's *Waiting for feedback* and the bell share: wrapped option buttons, all outlined past three, headline + text for a multi-paragraph question, a folded long question with *Show all* on home. - `cli/notify.py` — the same limits checked before anything is sent or queued in a worker's outbox; `cli/test_notify_ask.py` fails if the CLI and the hub drift. - Docs: CLAUDE.md, `docs/plugins.md`, the notify skill. ## Key decisions - **Eight, not unlimited**: what a card still shows at a glance on a phone; past that it is a form's job (ask-form). - **Never a partial set of buttons**: a 3-option ask on Chrome (2 action buttons) used to show the first two alone; it now shows *Answer…* too. - **Channel plugins get the ask whole** and degrade themselves. - **Not changed**: a plugin's own `notify.ask` bridge (`plugins/hubsignals.py`) stays at 2–3 options — a consent push, a separate contract. ## Changelog - Changed: a question from an agent can now offer up to 8 options and a longer text; the app shows them all, and a browser notification with more options than it can draw offers one "Answer…" button that opens the app ## Test notes - This work was interrupted by the EVOX2 reboot of 2026-11-28 and finished on 2026-11-29: rebased on `main`, then verified. - Backend (bwrap, throwaway `/data`, one process per module): `test_webpush.py` 26 pass, plus `test_notify_channels`, `test_notif_state`, `test_notif_paging`, `test_archive_notifs`, `test_askform`, `test_closing_notify`, `test_notify_audio`, `test_notify_log_account`, `test_plugin_tasks`, `test_taskevents` all pass. The other backend modules were not run. - `cli/test_notify_ask.py`: 4 pass. - Frontend: `tsc --noEmit` clean; vitest on `src/business/notifications`, `src/lib/pushSw.test.ts`, `src/i18n` and `src/business/conversations/components`: all pass except `FreshContext.test.tsx` (CacheExpiredNotice), which already fails on `main`. The full frontend suite was not run. - Screenshot: mock build, phone viewport, the six-option ask on home. - Not tested: a real browser push with `optionCount`, and a real phone. Nothing is deployed; deploy from the Homelab after merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Screenshots ![home-mobile.png](https://git.gabvdl.xyz/attachments/bb287128-b6da-4adb-afea-45bd88936619)
gabrielvidal self-assigned this 2026-11-29 14:57:29 +01:00
gabrielvidal added 1 commit 2026-11-29 14:57:29 +01:00
The limit was 2-3, the Android notification's button count. The record keeps
everything; each surface shows what it can and never a part of the options:
the app's cards wrap every option as a button and fold a long question, a web
push past three options carries optionCount and the service worker offers one
Answer… that opens the app, channel plugins get the ask whole.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch is already included in the target branch. There is nothing to merge.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin ask-more-options:ask-more-options
git checkout ask-more-options
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gabrielvidal/ai-agent#48