Skip to content

[Bug]: Remote window (Tauri) shows 'Permission: Not granted' — no OS notifications when connected to remote server #640

Description

@LittleNightmare

App Variant

Tauri (desktop app, codenomad-tauri.exe)

Operating System & Version

Windows 10 — Tauri desktop app connecting to a remote CodeNomad Server CLI (v0.18.0) over an SSH tunnel

Issue Summary

When using a remote server window (Remote Servers → connect → remote window), OS notifications never fire: the Notifications settings show "Permission: Not granted", the toast "Notification permission has not yet been granted." appears, and clicking "Request" has no effect. Local (non-remote) windows notify normally.

Steps to Reproduce

  1. Open the CodeNomad Tauri desktop app on Windows. Local-mode notifications work (local settings show permission granted).
  2. Add a remote server profile (Settings → Remote Servers, e.g. name "BUAA lhx", baseUrl https://localhost:19898, skip TLS verify) and open the remote window.
  3. In the remote window, open Settings → Notifications. The page shows "Permission: Not granted" and a toast "Notification permission has not yet been granted." appears.
  4. Click the "Request" button → nothing happens; Windows never shows a permission prompt (no permission acquisition is ever visible).
  5. Run a remote session that goes idle or needs input → no OS notification is shown in Windows.

Expected Behavior

Remote windows are windows of the same desktop app and should use the same Tauri notification path as the local window, so OS notifications (idle / needs-input / permission requests) fire while connected to a remote server. This matches the maintainer's statement in #323 that connecting to a remote CodeNomad server from the app should bring app benefits, including notifications.

Logs & Screenshots

Image

Additional Context

Observed facts (verified)

  • All notification preferences are enabled: osNotificationsEnabled, notifyOnNeedsInput, notifyOnIdle, osNotificationsAllowWhenVisible — all true.
  • Local main window: notifications work (Tauri notifier path).
  • Remote window (Tauri second window): settings page reports permission "Not granted"; the "Request" button has no visible effect; Windows never prompts.
  • Connection chain: Tauri UI → local server (port 9898) → remote-proxy session → SSH tunnel (localhost:19898) → remote CodeNomad Server v0.18.0 → opencode 1.18.11. The SSE event stream is proxied without filtering (packages/server/src/server/routes/events.ts broadcasts all events to every subscriber), so idle/permission events do reach the UI handlers — this is not an event-delivery problem.
  • Related closed issue [BUG] Notification permission denied on Windows 10 (v0.10.2) #138 fixed the same "permission denied" symptom for the Electron variant (via a detectHost() fallback); [Bug]: Not getting notifications in web browser #378 / fix: session.idle web notifications not firing in browsers #456 fixed browser notifications.

Analysis (inference — please verify)

  • In packages/ui/src/lib/os-notifications.ts, getOsNotificationCapability() falls through to the Web Notification API branch (permission default/denied) in the remote window, i.e. detectHost() (packages/ui/src/lib/runtime-env.ts) does not identify the remote Tauri window as a Tauri host — it checks window.__TAURI__ and a tauri substring in the user agent; the WebView2 second window appears to have neither.
  • WebView2 does not surface a Web Notification permission prompt, so "Request" is a no-op and the permission stays "Not granted".
  • sendOsNotification() then throws inside fireOsNotification() (packages/ui/src/stores/session-events.ts) and the error is silently swallowed (catch → warn log), so no notification is ever shown.
  • Suggested fix direction: ensure remote windows are detected as Tauri host (inject __TAURI__ / set window.__CODENOMAD_WINDOW_CONTEXT__ correctly in the Tauri open_remote_window implementation), or force the Tauri notifier path for remote windows.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions