Bug Fix: Claude Code ECONNRESET (#205)
Root Cause
When ProxyPal's Configure button was used with only Copilot as a provider, the Claude Code settings.json was written with gpt-5.3-codex (or another full gpt-5.X-codex model) assigned to all five model env vars including ANTHROPIC_SMALL_FAST_MODEL / ANTHROPIC_DEFAULT_HAIKU_MODEL.
These codex models are heavyweight Copilot models routed internally through copilot-api on localhost:4141. If copilot-api is not running, the sidecar closes the TCP connection mid-request and Claude Code receives ECONNRESET on every lightweight background call (auto-compact, context summaries, tool use, etc.).
Fixes Applied
1. Haiku/SMALL_FAST tier: removed bare "gpt-5" fallback pattern
- Old code:
find_model(&["claude-3-5-haiku", ..., "gpt-5"])— matched any GPT-5 model including full codex variants - New code: only matches explicit mini/nano variants:
gpt-5.4-mini,gpt-5.4-nano,gpt-5-mini,gpt-5-codex-mini - Falls back to
claude-3-5-haiku-20241022if none found (safe default)
2. ANTHROPIC_SMALL_FAST_MODEL was silently missing from generated config
- Was absent from the
env_configJSON object entirely - Was absent from the merge block when updating existing
settings.json - Claude Code fell back to its default or kept a stale value → caused ECONNRESET on background calls
Workaround (for existing affected users)
Re-run Configure on the Claude Code agent in ProxyPal. This will rewrite ~/.claude/settings.json with correct model assignments. Alternatively, manually edit ~/.claude/settings.json and set:
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-3-5-haiku-20241022",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-3-5-haiku-20241022"(or any lightweight model your provider supports)