OpenCode runs plugin hooks inside the prompt dispatch path, before the user message is persisted. The chat.message hook here does await updatePresence(false), which bottoms out in @xhayper/discord-rpc's Client.request() — that registers a nonce and only resolves when Discord replies. No timeout anywhere in the chain, so if the reply never comes the hook never returns, and OpenCode silently drops the prompt: the API already returned 204, nothing is logged, the session just never gets its message.
This bites under concurrent dispatch (agents fanning out subagents). On my machine, 12 concurrent prompt_async per trial:
- this plugin + one other loaded: 40/120 lost
- this plugin alone: 6/36
- other plugin alone: 0/36
- no external plugins (
--pure): 0/60
I traced it by instrumenting OpenCode's plugin dispatcher: the parked hook was always this one, hook-start with no hook-done. My guess is Discord rate-limits presence updates (~5 per 20s) and drops responses under a burst — I didn't packet-trace it — but either way the await never settles.
Suggested fix: don't let a presence update block the hook. Fire and forget (void updatePresence(false) with a .catch), or Promise.race it against a ~2s timer. Same for updatePresence(true) / rpc.clear() in the event hook.
opencode-discord-presence 0.2.10, OpenCode 1.18.5, Windows 11 x64, Discord desktop running. There's a core-side issue for OpenCode as well (no plugin hook should be able to do this): anomalyco/opencode#39031.
OpenCode runs plugin hooks inside the prompt dispatch path, before the user message is persisted. The
chat.messagehook here doesawait updatePresence(false), which bottoms out in@xhayper/discord-rpc'sClient.request()— that registers a nonce and only resolves when Discord replies. No timeout anywhere in the chain, so if the reply never comes the hook never returns, and OpenCode silently drops the prompt: the API already returned 204, nothing is logged, the session just never gets its message.This bites under concurrent dispatch (agents fanning out subagents). On my machine, 12 concurrent
prompt_asyncper trial:--pure): 0/60I traced it by instrumenting OpenCode's plugin dispatcher: the parked hook was always this one,
hook-startwith nohook-done. My guess is Discord rate-limits presence updates (~5 per 20s) and drops responses under a burst — I didn't packet-trace it — but either way the await never settles.Suggested fix: don't let a presence update block the hook. Fire and forget (
void updatePresence(false)with a.catch), orPromise.raceit against a ~2s timer. Same forupdatePresence(true)/rpc.clear()in theeventhook.opencode-discord-presence 0.2.10, OpenCode 1.18.5, Windows 11 x64, Discord desktop running. There's a core-side issue for OpenCode as well (no plugin hook should be able to do this): anomalyco/opencode#39031.