fix(opencode): debounce UserPromptSubmit to prevent spam sounds - #566
Open
GuillaumeAmat wants to merge 1 commit into
Open
fix(opencode): debounce UserPromptSubmit to prevent spam sounds#566GuillaumeAmat wants to merge 1 commit into
GuillaumeAmat wants to merge 1 commit into
Conversation
OpenCode fires multiple session.status:busy events per interaction. Each was forwarded as UserPromptSubmit, hitting the spam threshold (3/10s) and triggering user.spam sounds repeatedly. Add isBusy flag: only fire UserPromptSubmit on first busy transition, skip subsequent busy events until session goes idle or errors. Fixes PeonPing#336 PeonPing#458 (remaining gap after those fixes)
|
@GuillaumeAmat is attempting to deploy a commit to the Gary Sheng's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Independently hit this and confirmed the diagnosis — multiple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context
I've just migrated from Claude Code to OpenCode, and while I loved the PeonPing experience in Claude Code, it's been a "nightmare" with OpenCode: all the (sub)agents throw sounds at me at the same time 😅
I've tried to enable the
suppress_subagent_completeandsuppress_delegate_sessionssettings, but it didn't help.GLM 5.2 came with the fix I'm proposing in this PR. Happy to rework/refine it if you find any issue. Cheers!
Problem
OpenCode fires multiple
session.status: busyevents per interaction. The adapter forwarded each one asUserPromptSubmit, hitting peon.sh's spam threshold (3 events / 10s) and triggeringuser.spamsounds repeatedly — even withsuppress_subagent_completeandsuppress_delegate_sessionsenabled (those only affect subagent/delegate sessions, not the main session).Related closed issues that fixed adjacent problems but left this gap:
Fix
Add an
isBusyflag in the adapter that tracks whether the session is already in busy state.UserPromptSubmitnow only fires on the first transition tobusy— subsequentbusyevents during the same interaction are silently skipped. The flag resets onsession.idle,session.error, or any non-busy status.Verification
Changes
adapters/opencode/peon-ping.ts: +10/-2let isBusy = falsealongside existing session stateisBusy = falseinsession.idleandsession.errorhandlersfirePeon("UserPromptSubmit")behind!isBusyinsession.statushandlerisBusy = falseon non-busy/non-running status