Skip to content

refactor(tui): extract subagent timeout values as named constants#68

Closed
echobt wants to merge 4 commits intodocs/standardize-timeout-documentationfrom
refactor/tui-subagent-timeout-constants
Closed

refactor(tui): extract subagent timeout values as named constants#68
echobt wants to merge 4 commits intodocs/standardize-timeout-documentationfrom
refactor/tui-subagent-timeout-constants

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 4, 2026

Summary

This PR extracts hardcoded timeout values in the TUI subagent code as named constants with documentation.

Changes

In src/cortex-tui/src/runner/event_loop/subagent.rs:

  • Added SUBAGENT_CONNECTION_TIMEOUT constant (120 seconds) for subagent streaming connection timeout
  • Added SUBAGENT_EVENT_TIMEOUT constant (60 seconds) for per-event timeout during subagent responses
  • Added documentation explaining why these values are higher than main streaming timeouts
  • Replaced hardcoded Duration::from_secs() calls with the named constants

Rationale

Hardcoded timeout values scattered throughout the code make it difficult to:

  1. Understand the purpose and reasoning behind specific timeout values
  2. Find all timeout-related configuration in the codebase
  3. Maintain consistency when updating timeout values

Named constants with documentation improve code maintainability and make the codebase easier to audit for timeout configuration.

echobt added a commit that referenced this pull request Feb 4, 2026
…it, and documentation

This PR consolidates the following refactoring changes:
- #27: Centralize timeout constants
- #43: Replace magic numbers with documented named constants
- #67: Use LazyLock for static regex initialization
- #68: Extract subagent timeout values as named constants

Key changes:
- Created centralized timeout module with documented constants
- Replaced scattered magic numbers with well-documented constants
- Improved static initialization using LazyLock for regexes
- Added comprehensive documentation for timeout hierarchy
@echobt
Copy link
Contributor Author

echobt commented Feb 4, 2026

Consolidated into #77 - refactor: consolidated code quality improvements - constants, lazy init, and documentation

@echobt echobt closed this Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant