anomalyco / anomalyco/opencode

Feature request: play a sound when the agent asks a question (question.asked)

Open
#49,371 2 comments 0 reactions 1 assignee View on GitHub

@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:

  1. 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 receives question.asked (verified at runtime with a Chrome DevTools Protocol listener: session.idle arrives, question.asked does not).
  2. question.asked is handled on a different path: the parallel sync-store reducer (case "question.asked" with data.question[...] / setData(...)), which is what actually renders the question UI.
  3. The useSDKNotificationToasts handler (the one with the question.asked branch that plays the desktop notification + toast) is not mounted at startup — its module top-level never runs until some later point (verified: window listeners registered there are absent), so anything wired only into that handler can miss questions too.
  4. 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_OPTIONS list), with a matching settings.general.sounds.questions translation key.
  • Play it wherever the app processes question.asked on the real-time path (the parallel reducer branch, or any handler that is guaranteed to receive question.asked — note again that the global SDK listener used for session.idle does 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_OPTIONS list (renderer bundle, search SOUND_OPTIONS)
    • Default settings block: sounds: { agentEnabled: true, agent: "staplebops-01", ... }
    • Global SDK listener playing the Agent sound for session.idle (search handleSessionIdle)
    • useSDKNotificationToasts handler: permission.asked plays a sound, question.asked only calls platform2.notify
    • Real-time reducer: case "question.asked" in the parallel store (data.question[question.sessionID])

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.