fix(typing): guard fireStart against post-close invocation#26325
Merged
ngutman merged 4 commits intoopenclaw:mainfrom Feb 25, 2026
Merged
fix(typing): guard fireStart against post-close invocation#26325ngutman merged 4 commits intoopenclaw:mainfrom
ngutman merged 4 commits intoopenclaw:mainfrom
Conversation
Author
The existing `closed` flag in `createTypingCallbacks` guards
`onReplyStart` but not `fireStart` itself. If a keepalive tick is
already in-flight when `fireStop` sets `closed = true` and calls
`keepaliveLoop.stop()`, the running `onTick → fireStart` callback
still completes and sends a stale `sendChatAction('typing')` after
the reply message has been delivered.
On Telegram (which has no cancel-typing API), this causes the typing
indicator to linger ~5 seconds after the bot's message appears.
Add a `closed` early-return in `fireStart` as defense-in-depth so
that even an in-flight tick is suppressed once cleanup has started.
2c724e8 to
f2cf7d6
Compare
Contributor
akropp
pushed a commit
to akropp/openclaw
that referenced
this pull request
Feb 25, 2026
Jackson3195
pushed a commit
to Jackson3195/openclaw-with-a-personal-touch
that referenced
this pull request
Feb 25, 2026
brianleach
pushed a commit
to brianleach/openclaw
that referenced
this pull request
Feb 26, 2026
2 tasks
This was referenced Feb 26, 2026
Closed
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Feb 27, 2026
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
vincentkoc
pushed a commit
to Sid-Qin/openclaw
that referenced
this pull request
Feb 28, 2026
vincentkoc
pushed a commit
to rylena/rylen-openclaw
that referenced
this pull request
Feb 28, 2026
6 tasks
steipete
pushed a commit
to Sid-Qin/openclaw
that referenced
this pull request
Mar 2, 2026
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
thebenjaminlee
pushed a commit
to escape-velocity-ventures/openclaw
that referenced
this pull request
Mar 7, 2026
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.
Problem
createTypingCallbacksguardsonReplyStartwith theclosedflag, butfireStartitself has no such guard. If a keepalive tick is already in-flight whenfireStopruns, the asynconTick → fireStartcallback still completes and callsparams.start()(i.e.sendChatAction('typing')) after the reply message has already been delivered.On Telegram — which has no cancel-typing API — this causes the typing indicator to linger ~5 seconds after the bot's message appears.
Timeline of the race
Fix
Add
if (closed) returnat the top offireStartas defense-in-depth:This ensures that even an in-flight keepalive tick is suppressed once cleanup has started.
Scope
One-line change in
src/channels/typing.ts. No new dependencies, no config changes.Greptile Summary
Adds defense-in-depth guard to
fireStartto prevent race condition where in-flight keepalive ticks send typing indicators after cleanup. This complements theclosedflag guard added toonReplyStartin a0fa283, closing the gap for async callbacks that are already executing whenfireStopruns.Confidence Score: 5/5
onReplyStart), has clear scope, and introduces no new dependencies or side effects. Existing tests cover the typing lifecycle behavior.Last reviewed commit: bf6240f
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!