Skip to content

fix: keep typing indicator alive during long inference - #25886

Closed
stakeswky wants to merge 1 commit into
openclaw:mainfrom
stakeswky:fix/25882
Closed

stakeswky wants to merge 1 commit into
openclaw:mainfrom
stakeswky:fix/25882

Conversation

@stakeswky

@stakeswky stakeswky commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #25882

Problem

Typing indicators can expire during long LLM inference. Some channels (for example Matrix) rely on a server-side typing TTL, so a single typing event at reply start disappears before the model finishes.

Root Cause

createTypingCallbacks only sent typing on reply start and did not refresh it while inference was still running. Once the platform TTL elapsed, the indicator dropped even though processing continued.

Fix

  • Add a keepalive loop in createTypingCallbacks (default 3s) that re-sends typing until cleanup
  • Unify onIdle / onCleanup cleanup to stop the keepalive timer and optionally send stop
  • Deduplicate stop calls across idle + cleanup and avoid overlapping keepalive start() calls
  • Keep the change in the shared channel typing helper so channel integrations inherit the fix without per-plugin changes

Testing

  • pnpm exec vitest run --config vitest.unit.config.ts src/channels/channel-helpers.test.ts --maxWorkers=1 ✅
  • Added fake-timer coverage for keepalive refresh and cleanup timer clearing
  • pnpm test:fast -- src/channels/channel-helpers.test.ts was also attempted, but this script runs the full unit suite in this repo and hit unrelated existing failures (e.g. src/telegram/bot.media.downloads-media-file-path-no-file-download.test.ts, src/plugins/discovery.test.ts)

Greptile Summary

Adds a keepalive mechanism to typing indicators so they remain visible during long LLM inference operations. Previously, typing indicators expired when platform TTLs elapsed, especially on channels like Matrix. The fix introduces a 3-second refresh loop that re-sends typing events until cleanup, along with deduplication logic to prevent multiple stop calls.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is clean, well-tested, and solves a real UX issue. The keepalive logic correctly prevents overlapping calls with the keepaliveStartInFlight flag, properly clears timers on cleanup, and deduplicates stop calls with the stopSent flag. Test coverage is comprehensive, including fake timer tests for the keepalive mechanism and deduplication edge cases.
  • No files require special attention

Last reviewed commit: 03db125

@steipete

Copy link
Copy Markdown
Contributor

Implemented and landed on main as e0201c277.

What I changed (reimplemented after code review):

  • Added keepalive refresh support to createTypingCallbacks (src/channels/typing.ts) so typing can be re-sent during long inference windows.
  • Added regression tests in src/channels/channel-helpers.test.ts for keepalive refresh behavior and idle/cleanup stop deduplication.
  • Wired onIdle/onCleanup through core and extension dispatcher callsites using createTypingCallbacks (Telegram, Signal, Slack, Discord, Matrix, Mattermost, MS Teams) so keepalive timers are always cleared.

Validation:

  • pnpm lint
  • pnpm build
  • pnpm test

Thanks for the report and PR, @stakeswky.

@steipete steipete closed this Feb 25, 2026
margulans pushed a commit to margulans/Neiron-AI-assistant 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
kevinWangSheng pushed a commit to kevinWangSheng/openclaw that referenced this pull request Feb 26, 2026
kevinWangSheng pushed a commit to kevinWangSheng/openclaw that referenced this pull request Feb 26, 2026
@arjunaskykok arjunaskykok mentioned this pull request Feb 26, 2026
2 tasks done
oskarfreye pushed a commit to oskarfreye/openclaw that referenced this pull request Feb 27, 2026
desertstackdev pushed a commit to desertstackdev/openclaw that referenced this pull request Feb 28, 2026
thebenjaminlee pushed a commit to escape-velocity-ventures/openclaw that referenced this pull request Mar 7, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Typing indicator expires during long LLM inference – no keepalive in createTypingCallbacks

2 participants