fix(http): remove allowH2 from undici Agent — causes fetch failed on Node.js 22+#245
Merged
steipete merged 2 commits intoopenclaw:mainfrom Feb 13, 2026
Merged
fix(http): remove allowH2 from undici Agent — causes fetch failed on Node.js 22+#245steipete merged 2 commits intoopenclaw:mainfrom
steipete merged 2 commits intoopenclaw:mainfrom
Conversation
fix/remove-allowH2-undici-node22-compat
Contributor
|
@DColl is attempting to deploy a commit to the Amantus Machina Team on Vercel. A member of the Team first needs to authorize it. |
Additional Comments (1)
This PR removes Also appears as the removed option in Prompt To Fix With AIThis is a comment left during a code review.
Path: e2e/clawdhub.e2e.test.ts
Line: 20:25
Comment:
**E2E tests still enable H2**
This PR removes `allowH2: true` from the CLI’s global dispatcher because it breaks `fetch` on Node.js 22+, but `e2e/clawdhub.e2e.test.ts` still sets a global undici `Agent` with `allowH2: true`. On Node.js 22+ this will reproduce the same `fetch failed` behavior during e2e runs, making the test suite fail in the environment the PR targets.
Also appears as the removed option in `packages/clawdhub/src/http.ts`.
How can I resolve this? If you propose a fix, please make it concise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove allowH2 option from global dispatcher
Problem
allowH2: truein the undici Agent dispatcher causesfetch failedon Node.js 22+ (tested on v25.6.1), making
clawhub logincompletelybroken for all Node.js users.
curl handles the same request fine (HTTP/2 negotiation works correctly
via curl), so the issue is specific to undici's HTTP/2 implementation
on recent Node versions.
Fix
Remove
allowH2: truefrom the Agent config. undici will fall back toHTTP/1.1 which works correctly.
Testing
clawhub login --token <token>now authenticates successfullyRelated
Fixes #41
Related: openclaw/openclaw#5366, openclaw/openclaw#6933
Note on the published dist/
The currently published
dist/http.json npm also has a separatecorruption (missing
controller/bodydeclarations and a brokenconsole.logwith random whitespace) that doesn't match these sources.That suggests a build pipeline issue — the npm package may have been
built from a different state than the current source.
Greptile Overview
Greptile Summary
This change updates the CLI HTTP client’s undici global dispatcher (
packages/clawdhub/src/http.ts) to stop forcing HTTP/2 (allowH2: true), relying on undici’s default (HTTP/1.1) to avoidfetch failedregressions reported on newer Node.js versions.The change is scoped to dispatcher configuration and does not alter request/response handling logic in
apiRequest*helpers; it only affects the underlying transport negotiation used byfetchin Node runtimes.Confidence Score: 3/5
allowH2: trueon a global dispatcher, which will likely cause the samefetch failedfailures in CI/Node 22+ environments and should be updated in tandem.Last reviewed commit: f82134c
(2/5) Greptile learns from your feedback when you react with thumbs up/down!