Inline notification replies (macOS + iOS) with schema-driven reply shapes and a notification debug mode
Adds iMessage-style inline replies to cmux notifications, driven by an explicit reply-shape schema so future notification kinds degrade safely to open-only.
macOS. TerminalNotification gains replyShape (none|text), derived from the agent hook category (turn-complete and idle-reminder are text-replyable) or set explicitly via reply_shape on the notification.create* socket verbs and cmux notify --reply. Text-shape banners use a new category whose UNTextInputNotificationAction routes the typed text through surface.send_text plus Return into the agent's terminal, then marks the notification read; empty or failed replies fall back to the existing open path. Exit-plan banners gain a fourth "Revise…" text action that resolves the parked hook with exitPlan(.manual, feedback:). AskUserQuestion banners with one single-select question and at most 4 options get a per-request dynamic category with one button per option (labels from the agent payload) plus an "Other…" free-text action; multi-select, multi-question, or larger option sets keep the current open-only banner. Dynamic categories are always unioned with the static set, pruned against live waiters at mint time, and removed when the request resolves.
iOS. The Mac forwards replyShape in phone pushes; the web relay picks APNs category cmux.terminal.reply for text-shape pushes (unknown shapes coerce to the plain category). The iOS app registers a reply category with a text action; a submitted reply is parked (latest-wins, 120 s TTL) until the store, target Mac, and RPC channel are ready, then sent via explicit-target terminal.input plus Return without changing navigation or selection.
Debug mode. DEBUG-only debug.notification.mode / debug.notification.emit socket verbs and a matching Debug-menu section emit every notification kind (8 pane-banner kinds, 7 Feed decision variants including every fallback case) through the real store and feed.push pipelines, so all presentations and reply paths are testable on demand. Feed debug items use real waiters and time out after 300 s.
Verification: CmuxNotifications 73 tests, CMUXAgentLaunch 241, CmuxControlSocket 277, web 31 tests plus typecheck, macOS compile, tagged build nreply, and live socket round-trips of all three Feed decision replies against debug-emitted items. Live banner-click verification on macOS and phone-side reply are pending dogfood. Follow-up (Feed decision pushes to iPhone plus a notification content extension for multi-select) is specced separately.
🤖 Generated with Claude Code
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.
Summary by cubic
Adds inline text replies to terminal notifications on macOS and iOS with a schema-driven replyShape, plus a debug mode and diagnostics to test and inspect notification behavior. Improves reliability with merged dynamic categories on (re)install, live retargeting, bounded iOS reply retries (including channel-down cases), and clearer exit‑plan handling.
-
New Features
- macOS:
TerminalNotification.replyShape(none|text) from agent category or via socketreply_shapeand CLIcmux notify --reply. Text-reply banners use a new category/action; replies live‑retarget to the resolved surface owner and fail closed if missing; exit‑plan adds a “Revise…” text action; eligible single‑select AskUserQuestion (≤4 options) gets inline buttons plus “Other…”. - iOS: Mac forwards
replyShape; web switches APNs category betweenCMUX_APNS_REPLY_CATEGORYandCMUX_APNS_CATEGORY. The app registers both with localized “Reply/Send/placeholder”, parks replies (latest wins, 120s TTL), retries failed sends and channel‑down cases after 5s, re‑parks on failure, and ensures a newer reply mid‑send still wins. Adds a DEBUG-only Settings button to schedule a local reply notification. - Web/CLI: Push payload includes
replyShape; route policy parses it; tests cover category selection.notification.create*acceptreply_shape;cmux notify --replyenables text replies. - Debug/Diagnostics:
debug.notification.mode,debug.notification.emit, anddebug.notification.statusexercise all kinds and report system settings. Debug Macs route push via shared staging by default withCMUX_PUSH_API_BASE_URLoverride; per‑attempt push logs include host, HTTP status, byte count, and classification.
- macOS:
-
Bug Fixes
- Feed questions: All
CMUXFeedQuestion.*category get→set round trips serialize on one MainActor chain and use a boundednotificationCategories()read; launch/(re)install now merges existing categories so active question buttons aren’t stripped. - Exit‑plan: An empty “Revise…” reply opens the app at the card instead of approving.
- macOS/iOS: Inline replies retarget safely, re‑park on failure, and retry when the RPC channel is unavailable; unknown
replyShapedegrades to open‑only. - Question parsing:
WorkstreamQuestionPrompt.parseaccepts nested and legacy shapes. - Control socket:
ControlNotificationContextentrypoints defaultreplyShapeWiretonilfor legacy callers/tests. - Push logging: Fixed a nonisolated access in per‑attempt delivery logging and improved non‑HTTP handling.
- Feed questions: All
Summary by CodeRabbit
- New Features
- Added inline text replies to terminal notifications on macOS and iOS.
- Added CLI support for sending reply-enabled notifications with
--reply. - Added interactive Feed notification responses, including option selection, “Other…” replies, and exit-plan feedback.
- Added localized reply controls and prompts in English and Japanese.
- Added notification diagnostics for testing and troubleshooting in debug builds.
- Bug Fixes
- Improved compatibility with nested and legacy question formats.
- Invalid notification reply settings now safely fall back to standard notifications.
[!NOTE]
High Risk
Touches notification delivery, terminal input routing, cloud push payloads, and relay authorization boundaries across macOS and iOS; incorrect retargeting or category merge could mis-deliver agent input or strip live notification actions.
Overview
Adds inline text replies to terminal notifications end-to-end, driven by a replyShape schema (none / text) so unsupported kinds stay open-only.
macOS stores replyShape on notifications (from agent categories like turn-complete / idle-reminder, or explicit reply_shape on control socket / cmux notify --reply). Text-reply banners use a new notification category; typed text goes to the terminal via surface.send_text plus Return, with live surface retargeting and open-on-empty/failed reply. Feed exit-plan adds a “Revise…” text action; eligible single-select questions (≤4 options) get per-request dynamic categories with option buttons and “Other…”, serialized mint/cancel so categories aren’t clobbered on reinstall.
iOS registers reply APNs categories, parks submitted replies until Mac/workspace/surface/RPC are ready, sends via explicit terminal.input without changing UI selection, and retries transient failures. Phone push carries replyShape; Debug Macs default push relay to staging via pushAPIBaseURL.
DEBUG adds socket/menu notification emitters and debug.notification.* verbs to exercise all notification kinds through real pipelines.
Reviewed by Cursor Bugbot for commit ea468f9391d2be92ab2f9d675ffd6936bff109f0. Bugbot is set up for automated code reviews on this repo. Configure here.