fix: send a User-Agent on every outbound request - #19
Merged
Conversation
reqwest sends no User-Agent by default. GitHub rejects such requests outright: 403 Request forbidden by administrative rules. Please make sure your request has a User-Agent header That is every one of the 25 github operations failing before authentication is even considered — the error looks like a credential problem and is not one. Several WAF-fronted provider APIs behave the same way, so this is not cosmetic. Both client builders now go through one `build_client`, which sets `connector-hub/<version> (+repo url)`. Verified against the live API: the same call that returned 403 now returns 401 Bad credentials, which is the expired token doing its job.
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.
Found by calling
github.get_repothrough a live MCP session.reqwestsends noUser-Agentby default, and GitHub rejects requests without one:That is all 25 github operations failing before authentication is even considered. The failure mode is the expensive part: it surfaces as a generic network error, so it reads as a credential problem, and no amount of fixing the token makes it go away. Several WAF-fronted provider APIs reject UA-less traffic the same way.
Both
Client::builder()call sites (newandwith_timeout) were also duplicating timeout and redirect config. Collapsed into onebuild_client(timeout_secs)so a future transport setting cannot be added to one path and forgotten on the other.The UA is
connector-hub/<CARGO_PKG_VERSION> (+https://github.com/CodeWithJuber/connector-hub)— version comes from the crate, so it tracks releases without a second place to update.Verification
Same operation, same credentials, before and after:
401 is the correct answer here — that token is expired. The point is the request now reaches GitHub's auth layer at all.
🤖 Generated with Claude Code
https://claude.ai/code/session_018Xs4hZtZhd9Vi6EJnVnwDf