Skip to content

Send a custom User-Agent header - #44

Closed
vt244 wants to merge 1 commit into
tonyzorin:mainfrom
vt244:fix/user-agent-header
Closed

vt244 wants to merge 1 commit into
tonyzorin:mainfrom
vt244:fix/user-agent-header

Conversation

@vt244

@vt244 vt244 commented Nov 2, 2026 •

Copy link
Copy Markdown

Some WAFs drop connections from python-requests/* without a response, so every API call failed with RemoteDisconnected.

Sets User-Agent: youtrack-mcp/1.0 on the client session. The value is a fixed string, not the package version.

Testing

  • Unit tests: 726 passed, 2 failed, 37 skipped. test_update_issue_success and test_get_tool_definitions_legacy_format fail on a clean main too.
  • Tool calls were run through the MCP layer with mocked HTTP, checking the outgoing requests.
  • Not tested against a live YouTrack server on this branch.

Summary by CodeRabbit

  • Updates
    • Requests sent to YouTrack now include youtrack-mcp/1.0 as the client identification value in their User-Agent header. This updates the information accompanying requests to the service. No changes to app features or workflows are described in this release; existing request behavior otherwise remains unchanged according to the available change summary.

Some WAFs drop connections from python-requests/* without a response, so
every API call failed with RemoteDisconnected. Set our own User-Agent on
the client session.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c8b71fef-cef5-45bc-9e73-ea8209318d95
Commits

Reviewing files that changed from the base of the PR and between 7ef9b4d and 70366cc.

Files selected for processing: 1
  • youtrack_mcp/api/client.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The YouTrack client now sets the session’s User-Agent header to youtrack-mcp/1.0.

Changes: Client request header

Layer / File(s) Summary
Set the session User-Agent
youtrack_mcp/api/client.py
The session’s User-Agent header is set to youtrack-mcp/1.0.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Merge Risk: Minimal · up to 70366

The requested User-Agent change has no identified merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Send a custom User-Agent header" matches the only code change in the changeset, which sets the session User-Agent to youtrack-mcp/1.0 in YouTrackClient. It names the main change from the de…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Send a custom User-Agent header" matches the only code change in the changeset, which sets the session User-Agent to youtrack-mcp/1.0 in YouTrackClient. It names the main change from the developer's view. It is short, specific, and free of file lists or vague terms. The objectives confirm the purpose: some WAFs drop connections from python-requests/* headers, which causes RemoteDisconnected failures.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

tonyzorin added a commit that referenced this pull request Nov 2, 2026
Some WAFs drop connections from python-requests/* without a response.
Set User-Agent to youtrack-mcp/{package version} on the client session.
Implements the fix from #44 (thanks @vt244).
@tonyzorin

Copy link
Copy Markdown
Owner

Thanks @vt244 for the fix and the clear write-up.

Land on main in 2405b15 with the same approach (custom User-Agent on the requests session) plus a unit test. We use youtrack-mcp/{package version} from youtrack_mcp.version (currently 2.0.0) instead of a hardcoded 1.0, so the header tracks releases automatically.

Closing as implemented here; credit for the WAF / RemoteDisconnected diagnosis is yours.

@tonyzorin

Copy link
Copy Markdown
Owner

Implemented on main in 2405b15.

@tonyzorin tonyzorin closed this Nov 2, 2026
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.

2 participants