Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Silence watchdog
A running turn that stops producing output is reported as a typed silent-run state instead of a spinner that keeps claiming the bot is working. The watchdog never interrupts the turn. The user decides whether to wait or stop it.
Where it runs
The watchdog lives in ProviderRuntimeIngestion, after provider events are normalized into ProviderRuntimeEvents. Every provider passes through that point. Codex, Claude, Grok, Kimi For Coding, and OpenCode Go arrive through the Mastra AgentController, and standard OpenCode arrives through the legacy adapter bridge. None of the providers needs its own watchdog code.
The timer itself is startSilenceWatchdog in apps/server/src/orchestration/SilenceWatchdog.ts. It is a fiber forked into the ingestion scope, driven by a signal queue and Clock, so tests control it with TestClock. The silent interval is the named constant SILENCE_WATCHDOG_SILENT_MS (90 seconds).
Lifecycle
turn.startedstarts one watchdog for the thread and turn. A newer turn on the same thread stops the previous watchdog first.- Every other runtime event for the turn counts as output and restarts the countdown.
turn.completedandturn.aborteddo not; they end the turn instead. request.openedanduser-input.requestedpause the countdown while the bot waits on the user. The matchingrequest.resolvedanduser-input.resolvedresume it with a fresh countdown, so time spent waiting on the user never counts as silence.- After 90 seconds without output, the watchdog appends a
turn.silentactivity with aThreadSilentRunActivityPayload(provider,lastActivityAt) and opens asilence-watchdog-failureinbox item for the bot. - When output resumes, it appends
turn.silent.clearedand resolves the inbox item. The countdown starts again, so a later quiet stretch opens a new silent window. turn.completed,turn.aborted, and an interrupted turn stop the watchdog and resolve the inbox item.session.exitedstops every watchdog for the thread. Stopping never appendsturn.silent.cleared, because the turn ending already clears the state on clients.
Silent and cleared reports run on a drainable worker inside ingestion, so the ingestion drain covers them and tests can wait on it instead of sleeping.
Inbox deduplication
The incident key is silence:<threadId>:<turnId>, so a turn has at most one inbox item. BotInboxService.ensureOpen reopens the existing item for this kind even after an automatic resolve, as long as nobody acknowledged it. Repeated silent windows in one turn therefore bump occurrenceCount on the same item instead of adding rows. A chat with no bot records the silent-run state but opens no inbox item.
Clients
packages/client-runtime/src/silentRun.ts exports threadSilentRun(activities, turnId). It returns the provider, its display name, and the last output time when the latest silent-run activity for the running turn is turn.silent, and null otherwise. Web passes the result to BotActivityStatus, which replaces the working shimmer with "No response from " and a timer counted from the last output. Mobile shows the same state in the working row of the thread feed. Both clients keep silent-run activities out of the work log.