Inconsistent transient retry handling and unnecessary Content-Length header in AgentHost networking
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: main (current development branch)
- OS Version: Windows 11 x64
Steps to Reproduce:
1. Configure `AgentHostRequestService` so that an idempotent request (for example, `GET`) fails with `ECONNRESET`, `EPIPE`, or `ETIMEDOUT`. The request fails immediately instead of being retried, even though other networking components already treat these errors as transient.
2. Use `OtlpHttpForwarder` with the Fetch implementation. The Fetch code path explicitly sets the `Content-Length` request header even though Fetch implementations compute this header automatically and treat it as a forbidden request header. The `http.request()` path continues to require an explicit `Content-Length`.
Expected Result
- `AgentHostRequestService` should retry `ECONNRESET`, `EPIPE`, and `ETIMEDOUT` for idempotent requests, matching the rest of the networking stack.
- The Fetch implementation should rely on the runtime to compute `Content-Length`, while the `http.request()` implementation continues setting it explicitly.
Actual Result
- `ECONNRESET`, `EPIPE`, and `ETIMEDOUT` are treated as terminal failures instead of transient retryable errors.
- The Fetch implementation manually sets `Content-Length` even though compliant Fetch runtimes ignore or replace it automatically.
Additional Information
I have prepared fixes for both issues and added regression tests covering the transient retry behavior.
Contributor guide
Assessment
This issue has not been assessed yet.