fix(discord): stop typing indicator on silent/NO_REPLY runs#27039
Open
keshav55 wants to merge 2 commits intoopenclaw:mainfrom
Open
fix(discord): stop typing indicator on silent/NO_REPLY runs#27039keshav55 wants to merge 2 commits intoopenclaw:mainfrom
keshav55 wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Contributor
Greptile SummaryFixed Discord typing indicator persisting on silent/NO_REPLY runs by ensuring both cleanup flags are set. The typing controller requires both
Confidence Score: 5/5
Last reviewed commit: 628fb16 |
628fb16 to
d2b85b4
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
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.
Summary
Fixes #27011 — Discord typing indicator persists indefinitely when the model run produces a silent or NO_REPLY response.
Root Cause
The typing controller in
src/auto-reply/reply/typing.tsrequires bothmarkRunComplete()andmarkDispatchIdle()to be called before it triggerscleanup()(which clears typing timers and stops the indicator). This is enforced at lines 126-134 inmaybeStopOnIdle():In
agent-runner.ts, the agent runner correctly callstyping.markRunComplete()in its finally block (line 733). However,createReplyDispatcherWithTypingonly exposesmarkDispatchIdle— notmarkRunComplete— in its return type. The Discord handler (message-handler.process.ts) only callsmarkDispatchIdle()in its finally block (line 724).When a run produces content (tool results, block replies, or a final reply), this works fine:
agent-runner.tscallstyping.markRunComplete()via the typing controller referenceonIdlecallback callstypingController.markDispatchIdle()cleanup()firesBut on silent/NO_REPLY runs where no replies are enqueued, the dispatcher's
onIdlefires viamarkComplete()microtask (line 189-198 inreply-dispatcher.ts). The Discord handler's finally block then callsmarkDispatchIdle()again — butmarkRunComplete()was only called internally by the agent runner on its own typing controller reference. If the timing of themarkComplete()microtask resolution races with the Discord finally block, or if the typing controller reference hasn't been set yet, therunCompleteflag may never be propagated through the dispatcher's wrapper, leaving the typing indicator stuck.Fix
Expose
markRunCompletealongsidemarkDispatchIdleincreateReplyDispatcherWithTyping's return type and implementation. Update the Discord handler to callmarkRunComplete()in its finally block beforemarkDispatchIdle(), ensuring both flags are always set regardless of whether the agent runner's internal cleanup reached the typing controller.Changes
src/auto-reply/reply/reply-dispatcher.tsmarkRunCompletetoReplyDispatcherWithTypingResulttypemarkRunCompleteimplementation that delegates totypingController?.markRunComplete()src/discord/monitor/message-handler.process.tsmarkRunCompletefromcreateReplyDispatcherWithTypingmarkRunComplete()in the finally block beforemarkDispatchIdle()Test plan