GeezerVison is showing github.com — feat(desktop): add Windows taskbar session badge by TonisOrmisson · Pull Request #43962 · anomalyco/opencode
Conversation
Issue for this PR
Closes #43937
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Adds a Windows-only numeric taskbar overlay badge for distinct sessions that are unread or need attention. It reuses the existing app notification/session state, includes pending permission and question requests, clears the relevant session when it is viewed, and preserves counts for other sessions. The Electron integration uses BrowserWindow.setOverlayIcon; non-Windows platforms and the app layout are unchanged.
This does not add broader system notifications or the TUI progress behavior discussed in #24807. #37120 remains notification-permission context only.
How did you verify your code works?
packages/app: focused taskbar state tests, 6 passing; bun typecheck passing.
packages/desktop: focused overlay count tests, 2 passing; bun typecheck passing.
bun run --cwd packages/desktop build passing.
- Push hook
bun turbo typecheck: 30 tasks successful.
- Full desktop test run: 53 passing; one unrelated baseline failure because this Linux runtime lacks
node:sqlite.
- Windows taskbar rendering itself needs Windows validation.
Screenshots / recordings
These are illustrative before/after taskbar states for review; this environment cannot capture a real Windows taskbar.


Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
AI code review — automated review for reference; please use your judgment.
-
packages/app/src/context/taskbar-attention.ts:3-7 — cancelled and dismissed grow without bound: removePending adds every replied request ID forever and nothing ever evicts them ( sync() only prunes pending/synced). Why it matters: this lives in a long-running desktop process, so every permission/question ever seen leaks a Map/Set entry for the app's lifetime. Suggestion: when a session disappears from both pending and the sync snapshot, drop its cancelled/dismissed entries (or cap and rotate them).
-
packages/app/src/context/taskbar-attention.ts:32-40 vs packages/app/src/context/notification.tsx:470-489 — two token encodings coexist: the event listener adds per-request tokens (permission:<id>) while taskbarAttentionSessions feeds sync() comma-joined ones (permission:<id1>,<id2>). sync()'s liveness check (active.has(token)) compares these directly, so with 2+ live requests on one session it deletes still-pending tokens added by events; the badge stays right today only because synced independently keeps the session counted. Why it matters: any future logic relying on pending (races, removePending) silently misbehaves. Suggestion: normalize both sides through requestIDs() (or track pending per request ID instead of composite strings).
-
packages/app/src/context/notification.tsx:207-214 — clearFocusedSessionTaskbarAttention fires markViewed on every window focus for the active session, flipping persisted viewed state even when the user never saw the content (e.g., refocusing onto a different surface/tab). Why it matters: users lose unread indicators without actually reading anything, and the write hits the persisted store each time. Suggestion: only clear the taskbar badge on focus, and gate the persisted markViewed on the session view actually being visible.
-
packages/app/src/context/notification.tsx:132-138 (and each onTaskbarAttentionChanged() call site) — every notification append / permission event triggers an immediate cross-process invoke("set-taskbar-attention") plus setOverlayIcon rasterization, with no coalescing; an error-event burst serializes into many IPC round-trips. Why it matters: wasted main-process work and potential badge flicker. Suggestion: debounce/microbatch the sync (e.g., 100ms trailing edge).
-
Test coverage — packages/app/src/context/taskbar-attention.test.ts covers the pure state machine well, but none of the integration paths: permission.asked→replied flow, focus-triggered clearing, multi-scope dedup in syncTaskbarAttention, or the session.unseenCount===0 early-return removal in packages/app/src/pages/session.tsx:308-313. Why it matters: findings 2-3 live exactly in that untested layer. Suggestion: add component-level tests with a fake platform (setTaskbarAttention spy + controllable getWindowFocused).
Minor (not counted): packages/desktop/src/main/windows.ts:184-186 — if (!label) return is unreachable for normalized > 0; harmless dead branch.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
Hona
Awaiting requested review from Hona
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|