GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(desktop): say what Windows toasts ask and take them back once handled by Hona · Pull Request #65325 · anomalyco/opencode Conversation
|
| State | Before | After |
|---|---|---|
| Permission request | ![]() |
![]() |
| 1 s after the request is answered | ![]() |
![]() |
The real app, read from Windows' notification history for the app's identity; no screen picture. A dev build of dev just before this PR and one with it, minimised by a click on the app and Win+Down, then the request raised by the server:
| Case | Before | After |
|---|---|---|
| Permission request | Toast "Permission required / <session>" | Toast "Permission required / <session> / shell: git push origin main" |
| That request answered | The toast stays in the notification center | The toast is gone 1 s later |
| Two finished runs in one session (Agent notifications on) | Two "Response ready" toasts | One: the second replaced the first |
| The session opened from its tab | Both toasts stay | None left |
No linked issue. Ported from the native Rune desktop build (anomalyco/rune-desktop, features/notifications/src/lib.rs and actions.rs).
Makes the desktop's Windows toasts say more, and stop piling up in the notification center once they are handled.
| Before | After (Windows) |
|---|---|
| A permission toast says "Permission required" and the session title only. | A second line says what is asked: the permission's action and what it acts on (bash: git status), or the question form's title. It comes from the server's request, collapsed to one line, at most 160 characters. |
The toast's icon is https://opencode.ai/favicon-96x96-v3.png, fetched over the network for every toast, so offline toasts have no icon. |
The icon is the app's own, which Windows takes from the app's identity. |
| A request answered in the app, in another window or by another client stays in the notification center. Each "Response ready" for the same session adds another toast. | Each toast is tagged by its request (request:<id>) or session (session:<id>). A repeat replaces the earlier toast, an answered request takes its toast back, and viewing a session takes back its run toast. |
The app side passes a tag and a detail to platform.notify and calls the new optional platform.dismissNotification(tag). Only the desktop platform acts on them, and only when os === "windows": there main posts the tagged toast (WindowShowToast, WindowDismissToast), keyed by window and tag. Main, not the page, because only a main-process notification's close() takes a toast out of the notification center after it timed out there (electron/electron#32260). A click on the toast brings its window forward and sends ToastActivated back to run the page's callback. Which notifications fire, and when, is unchanged: Settings › Notifications and the cross-window claim still decide. No new setting.
macOS, Linux and the web keep today's toasts exactly: the desktop notifier ignores tag and detail there and keeps the page Notification, and the web platform has no dismissNotification. Untagged notifications on Windows are also unchanged.
bun test src/renderer/platform/notifications.test.ts in packages/desktop (6 pass): the existing click, close, error and focus cases; on Windows a tagged notification goes to main with its detail line collapsed and appended, its activation runs the callback, and a dismissal takes it back once; on macOS it stays a page notification.bun test src/shell/notifications in packages/app with its usual preloads (29 pass).bun typecheck in packages/app, bun run typecheck:tsc in packages/desktop, bun run lint:changed origin/dev clean.Toasts.show posts and its Toasts.dismiss taking it back (screenshots above).Added by the opencode bot (AI-generated).
Related: #51400
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sound approach, and macOS, Linux and web stay unchanged. I couldn't check real toasts here because that needs the Windows desktop app. Desktop notification tests (6), app notification tests (29) and type checks for both packages pass.
Public API: unchanged. Platform only gains an optional notify argument and an optional dismissNotification, both internal to the app and desktop packages.
The main concern, inline: on Windows a toast that times out off the screen fires close. That drops it from tagged, so later dismissals and same-tag replacements do nothing for toasts already sitting in the notification center. That is the case this change targets, so it's worth checking on a real machine before merging (you already list Action Center removal as unchecked).
Smaller gap: tagged lives in each window, so viewing a session in a different window from the one that posted its toast doesn't take the toast back.
Related: #51400
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The new commit keeps a timed-out toast's tag, but that doesn't make the earlier point work, so the thread stays open. Once Windows times a toast out, Chromium's renderer Notification is already closed, and its close() returns early (Blink's Notification::close() exits unless the toast is still showing). Holding on to the object therefore can't take the toast back from the notification center, or replace it with a newer one carrying the same tag. This likely needs main-process Electron notifications behind IPC. Details inline.
I still couldn't run real Windows toasts. Desktop notification tests (7), app notification tests (29) and type checks for both packages pass.
Public API: unchanged.
Also, request.resources ?? [] guards a field the schema makes a required array. The style guide asks not to re-check values the schema already guarantees, so it can go back to request.resources.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
# Conflicts: # packages/app/src/shell/notifications/notification.tsx # packages/desktop/src/renderer/platform/index.ts
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The new commit only merges dev. The PR's toast code in notifications.ts is unchanged, so the two open threads still stand: a timed-out Windows toast can't be closed from the renderer. I still couldn't run real Windows toasts. Desktop notification tests (7) and type checks for both packages pass.
Public API: unchanged.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ack from the notification center
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Both earlier points are addressed: Windows toasts are now Electron main-process notifications, whose close() removes a toast from the notification center even after it has left the screen. I couldn't run real Windows toasts here. Desktop notification tests (6) and the desktop type check pass.
Public API: unchanged. The new IPC calls and the ToastActivated event are internal to the desktop app.
Two remaining points: viewing a session in a different window from the one that posted its toast still doesn't take the toast back, because each window only tracks its own toasts. And the main-process toasts set no icon, so Windows uses the app's icon; the description's local-favicon row is now out of date.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The remaining thread is resolved: Windows toasts are main-process notifications, whose close() removes a toast from the notification center even after it has timed out. The point from my last summary is fixed too: main now looks toasts up by tag alone, so viewing a session or answering a request in another window, or after a reload, takes the toast back.
I couldn't run real Windows toasts here; your Windows 11 screenshots cover that. Desktop notification tests (6) and the desktop type check pass.
Public API: unchanged; the new IPC calls and the ToastActivated event are internal to the desktop app.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.