Skip to content

fix: analyzer OpenAI runtime guard, fetch timeout/retry, model env var#3

Open
arc-web wants to merge 15 commits into
mainfrom
claude/fix/analyzer-openai-guard-and-model-env
Open

fix: analyzer OpenAI runtime guard, fetch timeout/retry, model env var#3
arc-web wants to merge 15 commits into
mainfrom
claude/fix/analyzer-openai-guard-and-model-env

Conversation

@arc-web
Copy link
Copy Markdown
Owner

@arc-web arc-web commented Apr 16, 2026

Summary

A3 - OpenAI runtime guard + fetch resilience

  • callOpenAI now throws a clear, actionable error if OPENAI_API_KEY is missing or doesn't start with sk-, instead of sending a malformed request and getting a 401
  • Replaced bare fetch with fetchWithRetry helper: 30s timeout via AbortController, up to 2 retries with 500ms/1000ms backoff on network errors (not on HTTP errors - those surface immediately)

A4 - Model ID env var

  • callAnthropic now reads process.env.EXITSTORM_ANALYSIS_MODEL ?? 'claude-haiku-4-5-20250315' instead of hardcoding the model
  • EXITSTORM_ANALYSIS_MODEL documented in .env.example and the new env var table in README.md

Test plan

  • TypeScript check passes (pnpm typecheck)
  • Setting EXITSTORM_ANALYSIS_MODEL=claude-opus-4-5 is picked up at runtime
  • Calling analyzeProject with no keys throws the new descriptive error

Agent: claude-sonnet-4-6
Session: action-a-exitstorm-rebuild
Plan: ~/.claude/plans/inherited-exploring-lovelace.md

Michael Ensor and others added 15 commits April 16, 2026 23:59
A3: Add a runtime guard in callOpenAI that throws a clear error when
OPENAI_API_KEY is missing or malformed instead of silently failing with
a 401. Replace bare fetch with fetchWithRetry (30s timeout, 2 retries
with backoff) to handle transient network errors.

A4: Replace hardcoded 'claude-haiku-4-5-20250315' at line 15 with
process.env.EXITSTORM_ANALYSIS_MODEL ?? 'claude-haiku-4-5-20250315'.
Document the new var in .env.example and README.md environment table.

Agent: claude-sonnet-4-6
Session: action-a-exitstorm-rebuild
Plan: ~/.claude/plans/inherited-exploring-lovelace.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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