Skip to content

feat(desktop): the tray shows while idle, and akou tells you when an agent records or capture dies - #24

Merged
GeiserX merged 7 commits into
mainfrom
feat/desktop-p0
Sep 25, 2026
Merged

GeiserX merged 7 commits into
mainfrom
feat/desktop-p0

Conversation

@GeiserX

@GeiserX GeiserX commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

With the window closed, akou could go quiet at the worst moments. An agent could start a recording, a tray or hotkey start could be refused, or the call side could stop capturing, and nothing on screen said so. The idle menu bar item had no image and an empty title, so on macOS it was likely invisible. And the webview had no Edit menu, so copy and paste in the notepad and the ask box may not have worked.

The fix

  • Notifications. One pure function, notifyFor in src/main/window/notify.ts, builds every title and body from fixed strings picked by the event's kind. No call content can reach it. The shell notifies for a start from anything but the window, a refused start, a share an agent started, and dead or permission-suspect capture while the window is not focused. Each notice fires at most once a minute per call, channel and state.
  • Refused tray or hotkey starts. The notification says why. For missing models it names the window's "Download speech models" card and opens the window on it.
  • Tray icon. scripts/tray-icons.ts draws one idle icon per OS (template PNG on macOS, ICO on Windows, PNG for the AppIndicator). createTray always gets one, and the build copies it next to the main process.
  • Application menu (macOS). Edit roles, Settings… ⌘,, Hide, Quit (the quit role, so it runs the same before-quit path as the tray) and Open the docs. Windows and Linux set no menu, since their webviews handle the clipboard keys themselves.
  • Messages to a loading page. Settings… and akou open CALL sent while the window was still loading got lost. The shell now holds them until the page asks for its status, after it has wired its buttons.
  • Docs. docs/ux/DESKTOP.md marks the lines built or partial. The two trap candidates these lines closed, "An invisible tray" and "Lock-screen leaks", move into docs/TRAPS.md. scripts/release-checklist.md gains the checks only a real desktop can make.

Every new test was written first and failed on the old code. Each rule was then broken one line at a time to watch its test go red.

Per bead

akou-cc6.1, DK-T1: the tray item is visible when idle. Done in code. Acceptance: a shell test asserts createTray gets an image, and a positive control with no image fails it. Evidence: [DK-T1] An invisible tray: the tray always gets the platform's icon, idle included checks a readable image of the right format on each OS. No image, a missing file and the wrong format each fail it. A second test regenerates the icons and compares them with the files on disk. Red when createTray got no image, and red when a bar height changed in the generator. The smoke check finds the icon in the bundle.

akou-cc6.14, DK-M1: copy and paste work in the notepad and ask box. Partial. Acceptance: the menu passed to the fake has the Edit roles, and ⌘C/⌘V work on the packaged app. Evidence: [DK-M1] the application menu carries the Edit roles… and off macOS the webview handles the clipboard keys itself: no application menu is set. Red with no menu, red with Copy dropped. A menu without Copy and no menu at all are the positive controls. It also requires the page to boot before settings arrives, and that failed on the old code. What waits: "Check for updates…" comes with DK-U1, and "Show logs folder" once the app writes a log file. The keyboard check is on the release checklist.

akou-cc6.5, DK-T5: a failed tray or hotkey start says why. Done. Acceptance: with models missing, the fake tray's Record gives one notification naming the download card, and the window opens on it. Evidence: [DK-T5] a tray start refused for missing models says why once, naming the download card, and opens the window on it runs a real app with the models missing, then the fake tray, then the hotkey. The card name is read from modelsCardText, so the body and the button can't drift apart. Red with no notification, red with the window not opened. A refusal for a missing permission names the macOS privacy panes instead of a card, because the window's permission banner only shows during a call.

akou-cc6.22, DK-N1, DK-N2, DK-N4: agent-started calls and dead capture are announced, with no call content. Done.

  • DK-N1. Acceptance: a table test over notifyFor, and POST /calls by an agent with the window closed notifies once, while the same start from the focused window does not. Evidence: the notifyFor > [DK-N1] table test and [DK-N1] an agent's POST /calls with the window closed notifies once; the same start from the focused window does not. Red with the shell not subscribed to the app's starts. Red in both tests when the "a start from the window shows nothing" rule is removed.
  • DK-N2. Acceptance: a fake helper's dead with the window closed notifies once, and a second within a minute does not. Evidence: [DK-N2] dead capture with the window closed notifies once, and again only after a minute uses the fake helper's --call-dead-at 1 plus a fake clock. It checks one notice at +59 s and a second at +61 s. Changing the one-minute bound to 58 s turns it red, and so does removing the once-a-minute check or the health watch. Two more tests: [DK-N2] a new capture state on the same channel within the minute still notifies (dead, then permission-suspect) and [DK-N2] a window shown without the focus leaves the capture notices on. Both failed on the old code.
  • DK-N4. Acceptance: every row an agent can trigger, rendered for a call whose title, names and text are markers, contains none of them, and a positive control that injects the title fails. Evidence: [DK-N4] Lock-screen leaks: no notification carries the call's title, workspace, names, notes or words covers the started, refused, shared and capture-dead notices. Its markers are the title, workspace, a speaker name, a note, a vocabulary term, the call id and transcript words. Red when the call id went into a body. The in-test positive control that injects the title gets caught.

Only the owner can check

These need a real desktop, and they're on scripts/release-checklist.md:

  • The idle tray icon in a dark and a light macOS menu bar, with screenshots saved under docs/gates/ (DK-T1).
  • ⌘C/⌘V in the notepad and the ask box, ⌘Z and ⇧⌘Z, ⌘, opening Settings with the window closed, ⌘W and ⌘Q on the packaged app (DK-M1). That a message sent to a page still loading gets lost comes from reading the ElectroBun source, not 2.0.1 itself, and the ⌘, check covers it.
  • akou start -t "Check title" with the window closed shows one "Recording started" notification, and the title appears nowhere in it (DK-N1, DK-N4).
  • The tray icon on Ubuntu 24.04 with the GNOME AppIndicator extension, once a Linux app build exists (DK-T1).
  • The Windows .ico in a real tray. There's no Windows app build yet, so there's no checklist line for it.

Local run: bun run check passed except one test in tests/share.test.ts, which this diff doesn't touch. The capture helper didn't start within 10 s on a loaded laptop. I re-ran that file once and got 11/11.

Summary by CodeRabbit

  • New Features
    • Added platform-appropriate tray icons, including while the app is idle.
    • Added a macOS application menu with editing shortcuts and options to open Settings or documentation.
    • Added notifications for selected start outcomes and capture issues, with repeated capture alerts limited to once per minute.
    • Tray and keyboard-shortcut starts now provide origin-aware feedback; missing-model refusals open the app window.
  • Improvements
    • Share notifications direct you to stop sharing from the window or, when available, the tray.

…tray icon while idle

With the window closed, an agent could start a recording, a start from the
tray or hotkey could be refused, or the call side could go silent, and
nothing on screen said so. The idle menu bar item had no image and no
title, so it was likely invisible, and the webview had no Edit menu for
copy and paste.

- DK-N1, DK-N2, DK-N4: `notifyFor` (src/main/window/notify.ts) decides
  every notification from fixed strings, never call content. The app
  announces each start and share with its author; the shell notifies for
  starts from anything but the window, refused starts, agent shares and
  dead or permission-suspect capture while the window is not in front,
  once a minute at most per event and call.
- DK-T5: a refused tray or hotkey start notifies with the reason; missing
  models name the window's "Download speech models" card and open the
  window on it.
- DK-T1: one idle tray icon per OS (template PNG, ICO, PNG) drawn by
  scripts/tray-icons.ts, always passed to createTray and copied beside
  the main process.
- DK-M1: on macOS, an application menu with the Edit roles, Settings…,
  Hide, Quit (the quit role, same before-quit path) and a docs link.
…as built, with their hardware checks

DESKTOP.md marks DK-T1, DK-T5, DK-M1, DK-N1, DK-N2 and DK-N4 as built and
says what waits: "Check for updates…" for DK-U1, "Show logs folder" for a
log file, the tray's Stop sharing for DK-T4. The two trap candidates they
closed, "An invisible tray" and "Lock-screen leaks", move into TRAPS.md
under their tests. The release checklist gains the checks only a real
desktop can make: the idle icon in a dark and a light menu bar, copy and
paste in the notepad and the ask box, the CLI-start notification, and the
AppIndicator icon on Ubuntu.
…focus, and open Settings from a closed window

The shell marked the window focused on show, so a window an agent opened
behind the meeting app silenced every capture notice until it closed.
Only the window's focus and blur events set it now.

Settings… and a named call sent to a page still loading were lost. The
shell holds them until the page pulls its status, then sends them.

A permission-suspect right after a dead on the same channel is a new
notice: the dedup key carries the state. The permission refusal names the
two macOS panes as two, a failed capture says to press Record, and an
unknown refusal code is named. The Help item reads "Open the docs", as
DESKTOP.md says.
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: fee7b48a-e198-4af4-acea-d6437a810b41

📥 Commits

Reviewing files that changed from the base of the PR and between fbbdced and edd65a2.

⛔ Files ignored due to path filters (3)
  • src/main/window/tray/akou-template.png is excluded by !**/*.png
  • src/main/window/tray/akou.ico is excluded by !**/*.ico
  • src/main/window/tray/akou.png is excluded by !**/*.png
📒 Files selected for processing (21)
  • docs/TRAPS.md
  • docs/ux/DESKTOP.md
  • electrobun.config.ts
  • scripts/release-checklist.md
  • scripts/smoke-app.ts
  • scripts/tray-icons.ts
  • src/main/api/routes/settings.ts
  • src/main/api/server.ts
  • src/main/index.ts
  • src/main/window/electrobun-sdk.d.ts
  • src/main/window/main.ts
  • src/main/window/native.ts
  • src/main/window/notify.ts
  • src/main/window/rpc.ts
  • src/main/window/shell.ts
  • src/ui/app.ts
  • src/ui/protocol.ts
  • src/ui/window.ts
  • tests/notify.test.ts
  • tests/shell-helpers.ts
  • tests/shell.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 248eee4c-2964-45fb-bf54-44be5570e153

📥 Commits

Reviewing files that changed from the base of the PR and between ed16871 and fbbdced.

⛔ Files ignored due to path filters (3)
  • src/main/window/tray/akou-template.png is excluded by !**/*.png
  • src/main/window/tray/akou.ico is excluded by !**/*.ico
  • src/main/window/tray/akou.png is excluded by !**/*.png
📒 Files selected for processing (21)
  • docs/TRAPS.md
  • docs/ux/DESKTOP.md
  • electrobun.config.ts
  • scripts/release-checklist.md
  • scripts/smoke-app.ts
  • scripts/tray-icons.ts
  • src/main/api/routes/settings.ts
  • src/main/api/server.ts
  • src/main/index.ts
  • src/main/window/electrobun-sdk.d.ts
  • src/main/window/main.ts
  • src/main/window/native.ts
  • src/main/window/notify.ts
  • src/main/window/rpc.ts
  • src/main/window/shell.ts
  • src/ui/app.ts
  • src/ui/protocol.ts
  • src/ui/window.ts
  • tests/notify.test.ts
  • tests/shell-helpers.ts
  • tests/shell.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough
📝 Walkthrough

Priority: ⬇️ Low

Change: Feature

Merge Risk: ⚪ Minimal · up to fbbdc

The reviewed changes are mergeable after normal checks; no confirmed issue remains that requires a fix before merge.

Security Architecture Review

Security architecture risk: 🔵 Low · up to fbbdc

Recording and sharing notices now reach the desktop outside the app window. Their wording avoids call content, and callers cannot label themselves as the window to suppress a notice. A window-recreation timing question remains, but no verified security vulnerability was found.

Retained concerns

  • Low · reliability · inferred: A page-ready callback from an old window could mark a replacement window ready and flush its queued open-call or Settings action before its handlers exist. The close path clears queued actions, but does not bind the callback to its originating window; this outcome depends on unverified RPC dispatch-after-close behavior.
Security review details

Security Blast Radius

  • inferred — The new disclosure surface is the operating system's notifications for this desktop session, not a new network endpoint. Notices reveal that recording or sharing occurred, while their displayed wording omits call content.

Security Findings and Attack Paths

  • observed — A caller-controlled client label cannot impersonate the window for notification suppression: the HTTP path prefixes it as an agent requester, whereas suppression requires the exact internal user value.

Trust Boundaries and Controls

  • observed — Local HTTP requests pass the existing loopback, host, browser-request, and bearer-token checks before route dispatch assigns requester provenance. The window bridge supplies its requester independently.

Resilience and Maintainability Implications

  • inferred — The normal page handshake and close-time queue reset limit lost or stale navigation, but callback ownership across window recreation remains dependent on desktop RPC runtime behavior. A lost open-call action could delay access to the relevant recording or sharing controls.

Hardening Proposals

  • proposed — Bind page-ready and close callbacks to the window instance that created them, and verify delayed status dispatch across close and recreation before relying on queued navigation for access to recording controls.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 18 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes two primary changes: the idle tray icon and notifications for agent starts or capture failures.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 18 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch feat/desktop-p0
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…achines without a tailnet

The scan started a share with the default bind, tailnet. Every CI runner
has no tailnet address, so POST /share answered 409 no_tailnet and the
test failed on macOS, Windows and Linux. It passed only on a laptop with
Tailscale up. The rig now binds the share to 127.0.0.1 on port 0, as
share.test.ts does.
@GeiserX

GeiserX commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@GeiserX
GeiserX merged commit cab813a into main Sep 25, 2026
19 checks passed
@GeiserX
GeiserX deleted the feat/desktop-p0 branch September 28, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant