Skip to content

feat(typing): add configurable typingTtlSeconds option#6778

Closed
rahultappetla wants to merge 2 commits into
openclaw:mainfrom
rahultappetla:feature/configurable-typing-ttl
Closed

feat(typing): add configurable typingTtlSeconds option#6778
rahultappetla wants to merge 2 commits into
openclaw:mainfrom
rahultappetla:feature/configurable-typing-ttl

Conversation

@rahultappetla

@rahultappetla rahultappetla commented Feb 2, 2026

Copy link
Copy Markdown

Problem

The typing indicator TTL is currently hardcoded to 2 minutes (120 seconds). For long-running LLM operations—such as complex tool chains, slow model responses, or rate limit fallbacks—the typing indicator stops prematurely,
making the bot appear unresponsive even though it's still actively processing.

Real-world scenario: When using model fallback chains (e.g., primary → backup → CLI), a single request can take 5-10+ minutes. Users see the typing indicator stop after 2 minutes and assume the bot has crashed.

Solution

Add typingTtlSeconds as a configurable option in both agent defaults and session config, following the exact pattern established by typingIntervalSeconds.

Key points:

  • Default remains 120 seconds — no breaking changes for existing installations
  • Configurable at agent level via agents.defaults.typingTtlSeconds
  • Overridable per session via session.typingTtlSeconds
  • Priority chain: Agent config → Session config → Default (120s)

Related Issues

This PR helps address:

Closes #7192
Helps mitigate #5637

Changes

File Change
zod-schema.agent-defaults.ts Add Zod schema validation
zod-schema.session.ts Add Zod schema validation
types.agent-defaults.ts Add TypeScript type with JSDoc
types.base.ts Add TypeScript type with JSDoc
get-reply.ts Wire config value to typing controller
typing.test.ts Add test coverage for TTL behavior
docs/concepts/typing-indicators.md Document the new option

Usage

{                                                                                                                                                                                                                                
  agents: {                                                                                                                                                                                                                      
    defaults: {                                                                                                                                                                                                                  
      typingTtlSeconds: 300,  // 5 minutes for long-running operations                                                                                                                                                           
    },                                                                                                                                                                                                                           
  },                                                                                                                                                                                                                             
}                                                                                                                                                                                                                                
                                                                                                                                                                                                                                 
Or per-session override:                                                                                                                                                                                                         
                                                                                                                                                                                                                                 
{                                                                                                                                                                                                                                
  session: {                                                                                                                                                                                                                     
    typingTtlSeconds: 600,  // 10 minutes                                                                                                                                                                                        
  },                                                                                                                                                                                                                             
}                                                                                                                                                                                                                                
                                                                                                                                                                                                                                 
Test Plan                                                                                                                                                                                                                        
                                                                                                                                                                                                                                 
- Added unit tests for TTL expiration behavior                                                                                                                                                                                   
- Added unit tests for custom TTL values                                                                                                                                                                                         
- Existing typing tests continue to pass *(verified locally: 19 tests passed)*                                                                                                                                      
- Manual verification with slow model responses (requires live deployment)                                                                                                                                                       
                                                                                                                                                                                                                                 
Note for CI: Please verify all existing typing controller tests pass and consider a manual smoke test with a slow-responding model to confirm the TTL behavior works as expected in production.                                  
                                                                                                                                                                                                                                 
Backward Compatibility                                                                                                                                                                                                           
                                                                                                                                                                                                                                 
 No breaking changes  field is optional with sensible default matching current behavior.                                                                                                                                      

Greptile Overview

Greptile Summary

Adds a new typingTtlSeconds configuration option alongside typingIntervalSeconds, wiring it into getReplyFromConfig to pass typingTtlMs into the typing controller. Updates agent/session config types and Zod schemas to accept the new field, expands typing controller tests to cover TTL expiration, and documents the option in the typing-indicators concept doc.

This fits the existing typing-indicator architecture by keeping TTL enforcement inside createTypingController (ms-based), while allowing the higher-level reply pipeline to source configuration from agent defaults and session overrides (seconds-based) and convert once at the boundary.

Confidence Score: 4/5

  • This PR looks safe to merge with minor documentation/test robustness fixes.
  • The change is additive, defaults remain unchanged, and the TTL is already implemented in the typing controller; this PR mainly exposes it via config and adds coverage. The main actionable issues are a docs example that appears to use the wrong config key and a TTL test that relies on exact timer ordering/call counts (potential flakiness).
  • docs/concepts/typing-indicators.md, src/auto-reply/reply/typing.test.ts

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Feb 2, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread src/auto-reply/reply/typing.test.ts
@greptile-apps

greptile-apps Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor
Additional Comments (1)

docs/concepts/typing-indicators.md
[P1] Docs config key doesn't match actual schema

The examples use a top-level agent key, but the config types/schema use agents.defaults (agent-level) and session (session-level). As written, users who copy/paste the example will configure a key that the loader likely ignores. Consider updating the snippet to agents: { defaults: { ... } } (or whatever the repo’s canonical config shape is) to avoid confusion.

Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/concepts/typing-indicators.md
Line: 40:47

Comment:
[P1] Docs config key doesn't match actual schema

The examples use a top-level `agent` key, but the config types/schema use `agents.defaults` (agent-level) and `session` (session-level). As written, users who copy/paste the example will configure a key that the loader likely ignores. Consider updating the snippet to `agents: { defaults: { ... } }` (or whatever the repo’s canonical config shape is) to avoid confusion.

How can I resolve this? If you propose a fix, please make it concise.

@rahultappetla
rahultappetla force-pushed the feature/configurable-typing-ttl branch 2 times, most recently from d5130c9 to 3600e92 Compare February 2, 2026 02:09
Add a new configuration option `typingTtlSeconds` to control the maximum
duration the typing indicator stays active before auto-stopping.

## Problem

The typing indicator TTL was hardcoded to 2 minutes. For long-running
LLM operations (complex tool chains, slow model responses, rate limit
fallbacks), the indicator would stop prematurely, making the bot appear
unresponsive even though it was still processing.

## Solution

Add `typingTtlSeconds` as a configurable option in both agent defaults
and session config, following the same pattern as `typingIntervalSeconds`.

- Default remains 120 seconds (2 minutes) for backward compatibility
- Configurable at agent level (`agents.defaults.typingTtlSeconds`)
- Overridable per session (`session.typingTtlSeconds`)
- Agent config takes priority over session config

## Changes

- `zod-schema.agent-defaults.ts`: Add schema validation
- `zod-schema.session.ts`: Add schema validation
- `types.agent-defaults.ts`: Add TypeScript type
- `types.base.ts`: Add TypeScript type
- `get-reply.ts`: Wire config to typing controller
- `typing.test.ts`: Add test coverage for TTL behavior
- `docs/concepts/typing-indicators.md`: Document the new option

## Usage

```json5
{
  agents: {
    defaults: {
      typingTtlSeconds: 300,  // 5 minutes
    },
  },
}
```
@rahultappetla
rahultappetla force-pushed the feature/configurable-typing-ttl branch from 3600e92 to 22836ee Compare February 2, 2026 02:33
@rahultappetla

Copy link
Copy Markdown
Author

Addressed Greptile Feedback

P1 - Docs config key mismatch: Fixed the examples in docs/concepts/typing-indicators.md to use the correct config structure (agents: { defaults: { ... } } instead of agent: { ... }). This was a pre-existing issue in the docs,
but since we're modifying that file anyway, it made sense to fix it for accuracy.

P2 - Fragile test assertions: Updated the TTL tests to use isActive() checks and verify that call counts stop increasing after TTL, rather than asserting exact call counts which could be sensitive to timer ordering.

@mudrii

This comment was marked as spam.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Mar 7, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #pr-thunderdome-dangerzone on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Typing/Thinking Indicator Support

2 participants