Repository navigation
fix(notifications): tapping a phone push opens the agent that sent it - #31773
Conversation
The host's mobile notification event had no pane, so desktop, headless serve and native-chat pushes reached the phone without the paneKey it already routes on. Carry it from each producer through the push dispatcher, and tell the user when the named agent has since closed.
A terminal on a paired server reaches the window under a mirror tab id the server never names, so the phone could not find it. Push the server's own pane key, and keep a missing pane pending until a fresh tab list names it instead of dropping it against a stale list.
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
41e4365e-1340-44b1-8842-621a145a7129
📒 Files selected for processing: 12
mobile/src/session/use-notification-pane-navigation.test.tsxmobile/src/session/use-notification-pane-navigation.tssrc/main/notifications/notification-delivery-service.test.tssrc/main/notifications/notification-delivery-service.tssrc/main/runtime/push/push-dispatcher.tssrc/main/runtime/push/push-gateway-client.tssrc/main/runtime/runtime-mobile-notification-controller.tssrc/main/runtime/structured-agent-session-mobile-attention.test.tssrc/main/runtime/structured-agent-session-mobile-attention.tssrc/main/runtime/terminal-agent-phone-push.test.tssrc/main/runtime/terminal-agent-phone-push.tssrc/shared/terminal-surface-id.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
…nt tab A mirror tab named for a server surface decodes to `tab::leaf`, which made the pane key throw inside dispatch and dropped the desktop banner too. Send the parent tab, which is what the phone matches.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Stop forwarding a pane key that mobile cannot parse. · terminal-agent-phone-push.ts:173-207
src/main/runtime/terminal-agent-phone-push.ts:173-207
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winStop forwarding a pane key that mobile cannot parse.
buildEventforwards thepaneKeyargument unchanged into the dispatch request and the returned event. The terminal producer builds that key withmakeRuntimePaneKey, which returns${leaf.tabId}:${leaf.paneRuntimeId}whenleaf.leafIdis not a UUID. The legacy-ingress path accepts that key. Mobile then calls the sharedparsePaneKey, which returnsnullfor a non-UUID leaf, so the tap cannot resolve the terminal from the key.Keep the existing
paneKeyforbuildAgentNotificationIdandreadLabels. Limit the change to the emittedpaneKeyfield, and emit it only whenparsePaneKeyaccepts it. This addresses only non-UUID leaves. Parseable per-surface mirror keys are a separate issue.
ℹ️ 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:
05e773a2-f459-48ae-b9b4-ffc90298662b
📒 Files selected for processing: 2
src/main/notifications/notification-delivery-service.test.tssrc/shared/terminal-surface-id.ts
🚧 Files skipped from review as they are similar to previous changes: 1
- src/main/notifications/notification-delivery-service.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Fixes #29141
What changes for users
Before: tapping an "agent finished" or "needs input" push on iOS or Android opened the right workspace but landed on its default tab. In a workspace with several agents you then had to find the one that sent it.
Now: the tap opens the agent that sent the push. This works for pushes from a desktop window, from headless
orca serveand windowless agents, and from native chats. If that agent has since closed, the workspace opens as before.Root cause
The phone, the push gateway and the session page all route on a push's
paneKeyalready. The host never put one in.MobileNotificationDispatchEventhad no pane field, so all three producers dropped it, andpush-dispatcher.tshad nothing to forward. The original push rollout (#19951) sent it; the revert (#20040) removed it, and the re-land (#20068) brought back only the gateway and phone halves.The fix
PushSendNotificationcarrypaneKey, and the dispatcher copies it into the gateway send.notification-delivery-service.ts): sends the pane from the same request the desktop uses for its own banner click. A terminal on a paired server shows up in the window under aweb-terminal-…mirror tab id, which the server never names. The push carries the server's own key instead (newtoHostSessionPaneKey, built on the existingtoHostSessionTabId), because the phone asks the server for tabs.terminal-agent-phone-push.ts): sends the pane it already has.structured-agent-session-mobile-attention.ts): sendsstructuredAgentSessionPaneKey(structuredAgentSessionTabId(sessionId), sessionId). The host has no window tab id, and the phone'snotificationPaneTabalready matches this key.use-notification-pane-navigation.ts): a pane missing from the loaded tab list is held until a fresh list names it, instead of being dropped. A workspace screen kept from before a reconnect can show a list that predates the agent.Mixed versions: the gateway contract has accepted
paneKeysince #20066. Older phones ignore it, and older hosts never send it, so those phones keep opening the workspace.Left out: the optional "Agent no longer available" toast. The page can't tell whether a tab list is fresh or a stale one kept from before a reconnect. Showing the toast safely would need new snapshot plumbing, and without it the toast would fire wrongly after a reconnect.
Verification
buildPushDelivery, once on main's host files and once on this branch, and delivered each withxcrun simctl push. The simulator would not take a synthetic tap on a system banner, so a temporary, uncommitted listener called the app's own tap handler with the delivered notification. Routing and the pane switch after that are the real code.Visual Proof
Before (main's payload, no
paneKey): the tap opens the workspace on Agent one.(screenshot removed: contained real product data)
After (this branch's payload): the tap opens Agent two, the agent that finished.
(screenshot removed: contained real product data)