Skip to content

fix: poll Go usage with undici to bypass VS Code's global fetch patch - #133

Merged
OnesoftQwQ merged 1 commit into
masterfrom
fix/go-usage-undici-fetch
Sep 16, 2026
Merged

OnesoftQwQ merged 1 commit into
masterfrom
fix/go-usage-undici-fetch

Conversation

@OnesoftQwQ

Copy link
Copy Markdown
Owner

Problem

Go usage polling failed 100% of the time in Remote-SSH sessions when the local machine had http.proxy set (#98): VS Code patches the extension host's global fetch to route through http.proxy, and on the remote host 127.0.0.1:7890 doesn't exist → instant ECONNREFUSED → "fetch failed", status bar stuck at Go --. Chat requests were unaffected because provider.ts uses undici.fetch. The log line also hid the real cause.

Fix (src/goUsage.ts)

  • Use VS Code's bundled undici for usage requests — same approach as provider.ts's _createFetchWithTimeout (with the same fallback to global fetch when undici is unavailable). Immune to the proxy patch; consistent with model requests.
  • Log err.cause on goUsage.fetch.failed so ECONNREFUSED & co. are visible.

Verification

  • npm test green, tsc compiles.
  • The affected setup (Remote-SSH + local proxy) is exactly what this change addresses; the previous http.noProxy workaround keeps working as an alternative.

Fixes #98

VS Code patches globalThis.fetch to route through the local http.proxy
setting, so in Remote-SSH sessions with a local proxy the usage polling
failed 100% of the time ("fetch failed") while model requests kept
working - provider.ts already uses undici.fetch and is not affected.
Switch goUsage.ts to the same approach and log err.cause so the real
network error (e.g. ECONNREFUSED) is visible in the logs (#98).

Fixes #98
@OnesoftQwQ
OnesoftQwQ merged commit a0c9410 into master Sep 16, 2026
1 check passed
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.

Go usage polling fails 100% in Remote-SSH when local http.proxy is set (global fetch is proxied, undici.fetch is not)

1 participant