← Back to PRs

#10746: feat: add 'deferred' typing mode to suppress typing indicator for NO_REPLY

by r00k open 2026-02-06 23:03 View on GitHub →
stale
## Problem In Discord group chats, when a message arrives the bot immediately shows "is typing..." even when processing messages it will ultimately ignore (responding with `NO_REPLY`). This creates annoying UX — users see the bot typing and expect a response that never comes. ## Solution Add a new `"deferred"` typing mode that suppresses the typing indicator until the agent has confirmed it will actually reply. ### How it works 1. **Accumulates streamed text** — instead of firing typing on the first text delta, deferred mode buffers characters and checks if they could still become `NO_REPLY` 2. **Fires typing once text diverges** — as soon as the accumulated text can no longer be a prefix of the silent reply token, typing begins normally 3. **Tool execution = confirmation** — if the agent starts executing tools, that confirms real work is happening and typing fires immediately 4. **Falls back to message-mode** — after confirmation, subsequent deltas use the same behavior as `"message"` mode ### Configuration Set `typingMode: "deferred"` at the agent or session level: ```json { "agents": { "main": { "typingMode": "deferred" } } } ``` ### Backwards compatibility - Default behavior is **unchanged** — existing modes (`instant`, `message`, `thinking`, `never`) work exactly as before - The default for group chats remains `"message"` unless explicitly configured - Opt-in only via explicit configuration ## Changes - `src/config/types.base.ts` — Added `"deferred"` to `TypingMode` union - `src/config/zod-schema.agent-defaults.ts` / `zod-schema.session.ts` — Added `"deferred"` to validation schemas - `src/auto-reply/reply/typing-mode.ts` — Implemented deferred mode logic with prefix buffering in `createTypingSignaler` - `src/auto-reply/reply/typing-mode.deferred.test.ts` — 9 unit tests covering all deferred mode behaviors ## Test results All existing tests pass (20/20 agent-runner typing tests + 1 typing-controller-idle test), plus 9 new deferred-mode tests. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> - Adds a new `TypingMode` value (`deferred`) and wires it into agent/session config Zod schemas. - Implements deferred typing logic in `createTypingSignaler` by buffering early streamed text and only triggering typing once the output is confirmed not to be the silent reply token (`NO_REPLY`) or when tool execution starts. - Adds a new vitest suite covering deferred-mode behaviors around prefixes, divergence, tool start, and message start. <h3>Confidence Score: 3/5</h3> - This PR is close to mergeable, but deferred-mode behavior around message-start signaling appears inconsistent with the intended semantics. - Core changes are localized and tests exist, but `signalMessageStart` gating in deferred mode likely prevents typing-loop start at the intended moment (once non-silent is confirmed), making behavior deviate from the PR’s stated UX goals. - src/auto-reply/reply/typing-mode.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs