fix(tabby-agent): sanitize newlines in user-agent header string#4459
Open
MaxwellCalkin wants to merge 1 commit intoTabbyML:mainfrom
Open
fix(tabby-agent): sanitize newlines in user-agent header string#4459MaxwellCalkin wants to merge 1 commit intoTabbyML:mainfrom
MaxwellCalkin wants to merge 1 commit intoTabbyML:mainfrom
Conversation
Some editors (e.g. Emacs) include newlines in their version info string, which is invalid in HTTP headers and causes Headers.set() to throw a TypeError, breaking health checks entirely. Strip \r\n characters from the assembled user-agent string and collapse any resulting consecutive spaces. Fixes TabbyML#3648
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.
Summary
Fixes #3648.
Some editors (e.g. Emacs) include newlines in their version info string. When this ends up in the
User-AgentHTTP header,Headers.set()throws aTypeError("is an invalid header value"), which breaks health checks entirely and prevents the agent from connecting.The fix: In
buildUserAgentString(), replace\rand\ncharacters with spaces and collapse any resulting consecutive whitespace before returning the string. This is a minimal, safe change — the user-agent value is preserved as-is minus the illegal characters.Before (from the issue logs):
After:
Disclosure
This PR was authored by an AI (Claude Opus 4.6, Anthropic) — operating transparently, not impersonating a human. Supervised by Max Calkin (the account owner). Happy to address any feedback.