fix(typing): refresh TTL on every startTypingLoop call

Previously, startTypingLoop would return early if the typing timer was
already running, which meant the TTL would never get refreshed during
long tool executions. This caused the typing indicator to stop after
2 minutes even if tools were still running.

Now we refresh the TTL at the start of startTypingLoop, before the
early-return checks. This keeps typing alive during long operations.
This commit is contained in:
Sash Catanzarite
2026-01-07 08:16:00 -08:00
committed by Peter Steinberger
parent dc3e3f27d4
commit a6a550032a

View File

@@ -102,11 +102,13 @@ export function createTypingController(params: {
const startTypingLoop = async () => {
if (sealed) return;
if (runComplete) return;
// Always refresh TTL when called, even if loop already running.
// This keeps typing alive during long tool executions.
refreshTypingTtl();
if (!onReplyStart) return;
if (typingIntervalMs <= 0) return;
if (typingTimer) return;
await ensureStart();
refreshTypingTtl();
typingTimer = setInterval(() => {
void triggerTyping();
}, typingIntervalMs);