feat: add configurable typingTtlSeconds to config schema#20622
feat: add configurable typingTtlSeconds to config schema#20622chungjchris wants to merge 4 commits into
Conversation
The typing indicator has a hardcoded 2-minute TTL (typingTtlMs = 2 * 60_000).
For extended thinking models (e.g. Opus 4.6 with effort:max), tool-heavy
workflows, or complex multi-step replies, processing regularly exceeds
2 minutes — causing the typing indicator to disappear while the model
is still working.
The typingTtlMs parameter is already accepted by createTypingController()
with a clean disable guard (if typingTtlMs <= 0, the TTL timer is skipped
entirely). And typingIntervalSeconds is already in the config schema. But
there is no config path for the TTL — it always uses the hardcoded default.
This PR adds typingTtlSeconds to both the agent-level and session-level
config schemas (matching the existing typingIntervalSeconds pattern) and
passes it through to the typing controller in get-reply.ts.
Behavior:
- Not set (default): 2-minute TTL (backward compatible, no change)
- 0: TTL disabled — typing stays active until run completes
- >0: Custom TTL in seconds
Config example:
agents:
defaults:
typingTtlSeconds: 0 # disable TTL
Uses .nonnegative() (not .positive()) in the Zod schema because 0 is a
valid value meaning "disabled".
Closes #13673
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0514a1bd12
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const configuredTtlSeconds = | ||
| agentCfg?.typingTtlSeconds ?? sessionCfg?.typingTtlSeconds; | ||
| const typingTtlMs = | ||
| typeof configuredTtlSeconds === "number" ? configuredTtlSeconds * 1000 : undefined; |
There was a problem hiding this comment.
Clamp configured typing TTL before converting to ms
typingTtlSeconds is currently accepted as any nonnegative integer, then multiplied by 1000 and used for the typing timeout; values above 2_147_483 seconds overflow Node's timer range (2_147_483_647 ms) and get coerced to an almost immediate timeout, so very large TTL configs (often used to approximate “no expiry”) will make typing stop right away instead of lasting longer. Add a max bound or clamp before passing typingTtlMs.
Useful? React with 👍 / 👎.
Values above 2_147_483 seconds would overflow Node.js setTimeout max (2_147_483_647 ms), causing the timer to fire immediately instead of after the configured duration.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3662d235ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| agentCfg?.typingIntervalSeconds ?? sessionCfg?.typingIntervalSeconds; | ||
| const typingIntervalSeconds = | ||
| typeof configuredTypingSeconds === "number" ? configuredTypingSeconds : 6; | ||
| const configuredTtlSeconds = agentCfg?.typingTtlSeconds ?? sessionCfg?.typingTtlSeconds; |
There was a problem hiding this comment.
Let session typing TTL override agent defaults
configuredTtlSeconds currently checks agents.defaults before session, so when both are configured the session value is ignored and cannot override the default TTL for a specific session context. This is inconsistent with the existing typing override behavior (session.typingMode ?? agentCfg?.typingMode in get-reply-run.ts) and with the documented per-session override model, so users setting session.typingTtlSeconds alongside an agent default will see the wrong TTL applied.
Useful? React with 👍 / 👎.
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
Adds
typingTtlSecondsto both agent-level and session-level config schemas, and passes it through tocreateTypingController()inget-reply.ts.Problem
The typing indicator has a hardcoded 2-minute TTL (
typingTtlMs = 2 * 60_000). For extended thinking models (e.g. Claude Opus 4.6 witheffort:max), tool-heavy workflows, or complex multi-step replies, processing regularly exceeds 2 minutes — causing the typing indicator to disappear while the model is still actively working. This confuses users into thinking the bot has stalled.typingIntervalSecondsis already configurable in the schema, but there is no config path for the TTL.Change
5 files, 11 insertions:
src/config/types.agent-defaults.tstypingTtlSeconds?: numbersrc/config/types.base.tstypingTtlSeconds?: numbersrc/config/zod-schema.agent-defaults.tstypingTtlSeconds: z.number().int().nonnegative().optional()src/config/zod-schema.session.tstypingTtlSeconds: z.number().int().nonnegative().optional()src/auto-reply/reply/get-reply.tscreateTypingController()Behavior
typingTtlSeconds0> 0The
0case works becausecreateTypingController()already has the guard:Config Example
Design Decisions
.nonnegative()not.positive()— because0is a valid value meaning "disabled"typingIntervalSecondsconventiontypingTtlMswhen explicitly configured, preserving the existing default for unset valuesagentCfg?.typingTtlSeconds ?? sessionCfg?.typingTtlSecondsfollows the same pattern astypingIntervalSecondsCloses #13673
Greptile Summary
Adds configurable
typingTtlSecondsto agent and session config schemas, allowing users to control how long the typing indicator stays active. The implementation follows the existingtypingIntervalSecondspattern and correctly:.nonnegative()(allowing0to disable TTL)createTypingController()0value to disable TTL entirely (typing stays active until processing completes)The change solves a real problem for extended thinking models and tool-heavy workflows where processing exceeds the hardcoded 2-minute TTL.
Confidence Score: 5/5
typingIntervalSeconds), and makes only additive changes. The type checking, schema validation, and conditional spreading ensure backward compatibility. The existingcreateTypingController()logic already handles all edge cases including0and negative values.Last reviewed commit: 0514a1b
(5/5) You can turn off certain types of comments like style here!