anomalyco / anomalyco/opencode
Feature request: play a sound when the agent asks a question (question.asked)
@Hona is already working on this.
Since Sep 16, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
The desktop app's Sound effects settings cover three events: Agent (turn finished, session.idle), Permissions (permission.asked), and Errors. There is no sound for the fourth "attention required" event: when the agent uses the question tool and waits for the user's answer (question.asked). The user gets (at best) a desktop notification and an in-app toast, but no audio — so the question is easily missed when working in another window.
Use case
The ask-user flow is a core interaction: the agent blocks until the user answers. In practice I routinely switch to another window while the agent works (long tasks, builds). When the agent then asks a question:
- the turn-finished sound does not play (the session is not idle — it is waiting),
- there is no sound at all,
so the agent can sit blocked for many minutes while I have no idea it needs me. This is precisely the situation the existing sounds were designed for ("play a sound when the agent finishes or requires attention"), and questions are the one attention-required event with no audio.
Investigation already done (desktop app v1.18.30, asar examined)
While building a local patch for myself, I mapped how sound playback is wired:
- The sound Agent is played in a handler listening on the global SDK event stream, but only for
event.type === "session.idle". This same global listener never receivesquestion.asked(verified at runtime with a Chrome DevTools Protocol listener:session.idlearrives,question.askeddoes not). question.askedis handled on a different path: the parallel sync-store reducer (case "question.asked"withdata.question[...]/setData(...)), which is what actually renders the question UI.- The
useSDKNotificationToastshandler (the one with thequestion.askedbranch that plays the desktop notification + toast) is not mounted at startup — its module top-level never runs until some later point (verified:windowlisteners registered there are absent), so anything wired only into that handler can miss questions too. - Playing
new Audio(...)from the renderer works reliably once the user has interacted with the window (no autoplay-policy issue).
I ended up patching the asar to call an audio play directly inside the question.asked case of the parallel reducer (data), which works: I now hear a sound every time the agent asks me something.
Suggested implementation
Add a fourth sound channel to the settings, mirroring the existing three:
sounds: {
agentEnabled: true,
agent: "staplebops-01",
permissionsEnabled: true,
permissions: "staplebops-02",
errorsEnabled: true,
errors: "nope-03",
questionsEnabled: true, // new
questions: "alert-01" // new
}
- New "Questions" row in Settings → Sound effects (same
SOUND_OPTIONSlist), with a matchingsettings.general.sounds.questionstranslation key. - Play it wherever the app processes
question.askedon the real-time path (the parallel reducer branch, or any handler that is guaranteed to receivequestion.asked— note again that the global SDK listener used forsession.idledoes not receive this event in my testing). - Keep a per-session anti-spam cooldown similar to the existing notification cooldown (
alertedAtBySession), so a question plays one sound, not a chorus.
Why I cannot work around this myself (cleanly)
The settings store is not reachable from the plugin API, and the only reliable injection point for this event is deep in the renderer bundle — so the clean fix has to be native. My own workaround required patching app.asar (re-applied after every app update), which is not something I want to maintain long-term, and other users cannot do it at all.
Environment
- App: opencode desktop v1.18.30
- OS: Linux Mint 22.3
- File examined:
/opt/OpenCode/resources/app.asar - Relevant code locations (textual anchors; offsets shift between versions):
- Sound settings UI +
SOUND_OPTIONSlist (renderer bundle, searchSOUND_OPTIONS) - Default settings block:
sounds: { agentEnabled: true, agent: "staplebops-01", ... } - Global SDK listener playing the Agent sound for
session.idle(searchhandleSessionIdle) useSDKNotificationToastshandler:permission.askedplays a sound,question.askedonly callsplatform2.notify- Real-time reducer:
case "question.asked"in the parallel store (data.question[question.sessionID])
- Sound settings UI +
Acceptance criteria
- A "Questions" sound setting exists (enabled + sound id), consistent with Agent/Permissions/Errors.
- A sound plays when the agent asks a question, whether the session is focused or in the background.
- A question plays the sound once (cooldown respected), and answering/dismissing it stops any further alerting for that question.
- The existing three sound behaviors are unchanged.
Thanks for considering this.
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.