Include app version in GitHub PR poller User-Agent - #10046
Conversation
The pull-request poller sent a fixed `User-Agent` of `cmux-workspace-pr-poller` with no version, so requests from different cmux releases were indistinguishable server-side. That makes it hard to attribute request behavior — including conditional-request (`If-None-Match` / ETag) revalidation and rate-limit usage — to a specific release. Append the app version to the header, formatted as `cmux-workspace-pr-poller/<CFBundleShortVersionString>`. The version is read at load time from the host app bundle, so it always reflects the shipped release with no manual update; the product token is kept as the leading component so existing server-side matching on it still works, and a `/unknown` fallback preserves the `Product/Version` shape when the version is unavailable. Formatting is factored into a testable helper. Closes manaflow-ai#10044 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4959e1f9-f8e6-4e97-a487-f395a0123c79
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
|
To use Codex here, create a Codex account and connect to github. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe GitHub PR poller now sends a versioned ChangesGitHub User-Agent
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@Packages/macOS/CmuxGit/Tests/CmuxGitTests/GitHubPullRequestRequestTests.swift`:
- Around line 449-461: Update pollerRequestSendsProductTokenUserAgent to assert
the complete User-Agent value rather than only its prefix. Derive the expected
versioned value from CFBundleShortVersionString through
userAgentValue(appVersion:), or inject a deterministic known version, and
compare it with the captured header using equality.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 02a68005-018c-4da9-825b-44de39c96bd2
📒 Files selected for processing (2)
Packages/macOS/CmuxGit/Sources/CmuxGit/Probe/GitHubPullRequestRequestCoordinator.swiftPackages/macOS/CmuxGit/Tests/CmuxGitTests/GitHubPullRequestRequestTests.swift
The integration test previously only checked the `User-Agent` prefix, so it would pass even if the version suffix were wrong. Compute the expected value from the same bundle version via `userAgentValue(appVersion:)` and assert the full header equals it, while keeping the prefix check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4959e1f9-f8e6-4e97-a487-f395a0123c79
Summary
The GitHub pull-request poller sends a fixed
User-Agentofcmux-workspace-pr-pollerwith no version, so requests from different cmux releases are indistinguishable server-side. That makes it hard to attribute request behavior — including conditional-request (If-None-Match/ ETag) revalidation and rate-limit usage — to a specific release.This change appends the app version to the header, formatted as
cmux-workspace-pr-poller/<CFBundleShortVersionString>:CFBundleShortVersionString, so it always reflects the shipped release with no manual update required.cmux-workspace-pr-polleris preserved as the leading component, so any server-side matching on it keeps working./unknownfallback preserves theProduct/Versionshape when a version isn't available (e.g. underswift test, whereBundle.mainis the test runner).userAgentValue(appVersion:)so it can be unit-tested without depending on the bundle.Closes #10044
Testing
Added
swift-testingcases inGitHubPullRequestRequestTests.swift:userAgentValueAppendsAppVersion— version appended ascmux-workspace-pr-poller/1.2.3.userAgentValueTrimsSurroundingWhitespace— surrounding whitespace trimmed.userAgentValueFallsBackWhenVersionMissing—niland blank both fall back to/unknown.pollerRequestSendsProductTokenUserAgent— the outgoing request'sUser-Agentstarts withcmux-workspace-pr-poller/.Demo Video
N/A — no user-facing UI or behavior change (outbound request header metadata only).
Review Trigger
@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review
Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Includes the app version in the GitHub PR poller’s User-Agent to attribute request behavior by release. Previously we sent "cmux-workspace-pr-poller"; now we send "cmux-workspace-pr-poller/", falling back to "/unknown" when the version is unavailable.
CFBundleShortVersionStringviauserAgentValue(appVersion:); no manual bumps.userAgentHeaderValueinGitHubPullRequestRequestCoordinator; keeps the product token first; request semantics are unchanged./unknownfallback, and assert the fullUser-Agentequals the value fromuserAgentValue(appVersion:)(not just the prefix).Written for commit 1542e6d. Summary will update on new commits.
Summary by CodeRabbit