anomalyco / anomalyco/opencode
[Windows Desktop] Session error notification + sound replays on every launch (event backlog has no replay guard)
@Hona is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
Every time I open OpenCode Desktop on Windows, a system notification pops up with an error sound:
会话错误
发生错误
(Session error / An error occurred)
This happens even when the current session is perfectly healthy, and it happens on every single launch.
Root cause (successor to #15302 and #28894)
This is the same bug reported in #15302 ("Desktop notification sound plays repeatedly upon opening") and #28894 ("[Windows Desktop] Open code notifying lots of session error when opened"). Both were auto-closed after 60 days of inactivity with the note "If the issue is still relevant please open a new one" — it is still relevant, so here it is.
The desktop client replays the event backlog on connect, and historical session.error events run through the same handler as live events — there is no replay guard — so every previously-errored session re-fires an OS notification + sound on each launch.
Evidence from my machine (~/.local/share/opencode/log/opencode.log)
Historical errors accumulate in the journal from ordinary usage:
AbortErrorfrom streams interrupted at app close- Provider API errors (
AI_APICallErrorfrom an openai-compatible provider, "No payment method" from a misconfigured model, etc.)
Correlation sample from today:
timestamp=2026-08-21T14:50:11.278Z level=ERROR ... error=Aborted
timestamp=2026-08-21T14:50:11.281Z ... message=init count=... <- new instance boots 3 ms later -> toast fires
Environment
- OS: Windows 11 (zh-CN locale)
- OpenCode Desktop: 1.18.20
- Setup: multiple providers (openai-compatible + openrouter), several plugins, local MCP servers
Current workaround
Settings → General → Sounds → Errors → Off. This stops the toast/sound but the underlying backlog replay is unfixed, and it also silences genuinely useful live error alerts.
Suggested fix
Same as proposed in #15302: tag backlog/replayed events and gate playSoundById(...) / OS notification calls on !isReplay in handleSessionError (and the idle/permission handlers). Replayed events should still appear in the notification list, just without re-alerting.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.