neurolink icon indicating copy to clipboard operation
neurolink copied to clipboard

PC-012: Timeout Values Inconsistent Across Providers

Open murdore opened this issue 1 month ago • 0 comments

Bug Summary

Different providers use different timeout values with no centralized configuration.

Root Cause

Files: src/lib/core/constants.ts, src/lib/core/baseProvider.ts

  • constants.ts: DEFAULT_TIMEOUT = 60000
  • baseProvider.ts: defaultTimeout = 30000
  • Individual providers may have their own values

Affected Providers

All providers

Current Behavior

  • Inconsistent timeouts across providers
  • Hard-coded values scattered in code
  • No way to configure globally
  • No environment variable support
  • Same timeout for all operation types

Expected Behavior

Centralized timeout configuration:

  • Default timeouts for all operation types
  • Provider-specific overrides
  • Environment variable support
  • Different timeouts for: requests, streaming, health checks, tools

Implementation

```typescript export const DEFAULT_TIMEOUTS = { REQUEST: 60000, STREAMING: 120000, HEALTH_CHECK: 10000, TOOL_EXECUTION: 30000, } as const;

export const PROVIDER_TIMEOUTS: Record<string, Partial<typeof DEFAULT_TIMEOUTS>> = { ollama: { REQUEST: 120000 }, // Local models slower bedrock: { REQUEST: 90000 }, };

export function getTimeout( operation: keyof typeof DEFAULT_TIMEOUTS, provider?: string ): number { // Check env var, provider override, then default } ```

BaseProvider uses timeout getters: ```typescript protected get requestTimeout(): number { return getTimeout('REQUEST', this.providerName); } ```

Environment variable override: ```bash export NEUROLINK_REQUEST_TIMEOUT=90000 ```

Acceptance Criteria

  • Centralized timeout constants
  • Provider overrides supported
  • Environment variable override
  • All providers use centralized timeouts
  • Tests pass
  • Documentation updated

Priority

Medium - Consistency improvement

Effort

2 hours

murdore avatar Dec 01 '25 02:12 murdore