Skip to content

Conversation

@kaitranntt
Copy link
Owner

@kaitranntt kaitranntt commented Dec 20, 2025

Summary

Fixes the root cause of "fetch failed" errors and improves UX for remote proxy configuration:

  • Test Connection now uses current input values instead of stale persisted config
  • Input state persists across tab switches (Host, Port, Auth Token, Local Port)
  • Improved error messages for network failures (DNS_FAILED, NETWORK_UNREACHABLE)

Changes

ui/src/pages/settings.tsx

  • handleTestConnection() now accepts params with current display values
  • Lifted proxy input state to parent SettingsPage to persist across tab switches
  • Updated ProxyContentProps interface to pass state and setters

src/cliproxy/remote-proxy-client.ts

  • Added DNS_FAILED and NETWORK_UNREACHABLE error codes
  • Improved mapErrorToCode() to detect DNS and network errors
  • Better error messages for common failure scenarios

tests/unit/cliproxy/remote-proxy-client.test.ts

  • Added tests for new error codes

Root Cause

The original bug: user types in Host/Port fields, clicks "Test Connection" without blurring → the function used proxyConfig.remote (persisted values) instead of current input values (displayHost, displayPort).

Test Plan

  • TypeScript check passes
  • ESLint/Prettier passes
  • Unit tests pass (123 tests)
  • Manual test: Type in host, click Test Connection without blurring → should use typed value
  • Manual test: Switch to WebSearch tab and back → Proxy inputs should retain values

Related Issues

- Add DNS_FAILED and NETWORK_UNREACHABLE error codes
- Map "fetch failed" errors to NETWORK_UNREACHABLE for better UX
- Extract nested error cause for more accurate error detection
- Improve error messages with actionable hints

Fixes #142
…oss tabs

- handleTestConnection now accepts params with current display values
  instead of reading from stale persisted config
- Lifted proxy input state (host, port, authToken, localPort) to parent
  SettingsPage component to persist across tab switches
- Updated ProxyContentProps interface to pass state and setters

Fixes the root cause where typing in inputs but not blurring before
clicking "Test Connection" would use old persisted values.

Closes #142
Related: #163, #164, #165
@kaitranntt kaitranntt merged commit d7ab635 into dev Dec 21, 2025
1 check passed
@kaitranntt kaitranntt deleted the kai/fix/remote-proxy-fetch-error branch December 21, 2025 00:16
@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 7.0.0 🎉

The release is available on:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants