Skip to content

fix: set canonical User-Agent header format#542

Merged
gjtorikian merged 1 commit intomainfrom
fix/user-agent-format
May 1, 2026
Merged

fix: set canonical User-Agent header format#542
gjtorikian merged 1 commit intomainfrom
fix/user-agent-format

Conversation

@gjtorikian
Copy link
Copy Markdown
Contributor

Summary

The outgoing User-Agent header is now always workos-go/v{Version} — the canonical WorkOS Go SDK format used through the 6.x line. The 7.0.0 release inadvertently appended appInfo to the header in a way that no longer conformed.

Behavior change

WithAppInfo() still parses for backwards compatibility, but the value no longer affects the User-Agent header. Callers relying on appInfo appearing in User-Agent will need to set a separate header via the request-options extra-headers mechanism.

Test plan

  • go test ./... passes
  • Confirm User-Agent: workos-go/v{Version} on a real outgoing request

🤖 Generated with Claude Code

The User-Agent header is now always `workos-go/v{Version}`,
matching the canonical WorkOS Go SDK format used through the
6.x line.

The `WithAppInfo` option is still accepted for backwards
compatibility, but the value no longer affects the outgoing
`User-Agent` header. The 7.0.0 release inadvertently appended
appInfo to the User-Agent in a way that no longer conformed to
WorkOS' canonical SDK User-Agent format.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gjtorikian gjtorikian marked this pull request as ready for review May 1, 2026 19:40
@gjtorikian gjtorikian requested review from a team as code owners May 1, 2026 19:40
@gjtorikian gjtorikian requested review from atainter and removed request for a team May 1, 2026 19:40
@gjtorikian gjtorikian merged commit 01d535f into main May 1, 2026
6 checks passed
@gjtorikian gjtorikian deleted the fix/user-agent-format branch May 1, 2026 19:40
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 1, 2026

Greptile Summary

This PR fixes the User-Agent header to always emit workos-go/{Version}, removing the 7.0.0 regression that appended appInfo in a non-canonical format. The one-line change in client.go is correct; WithAppInfo is retained for backwards-compatibility but now has no observable effect, and its doc comment still incorrectly describes the old behavior.

Confidence Score: 4/5

Safe to merge — the core fix is a single-line change with a matching test; only a stale doc comment remains.

No logic errors; the only finding is a P2 stale comment on WithAppInfo. Score is 4 (P2s only).

options.go — WithAppInfo doc comment and the appInfo struct/field are now dead/misleading.

Important Files Changed

Filename Overview
client.go Removes appInfo concatenation from User-Agent header; now always emits workos-go/{Version}. Change is correct and minimal.
options.go WithAppInfo and appInfo struct are now dead code (stored but never read); doc comment incorrectly claims the value is appended to User-Agent.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant Client
    participant API as WorkOS API

    Caller->>Client: request(...)
    Note over Client: Before this PR
    Client->>Client: ua = "workos-go/" + Version
    alt appInfo.Name != ""
        Client->>Client: ua += appInfo.Name + "/" + appInfo.Version
        opt appInfo.URL != ""
            Client->>Client: ua += " (" + appInfo.URL + ")"
        end
    end
    Client->>API: User-Agent: workos-go/v7.0.0 MyApp/1.0

    Note over Client: After this PR
    Client->>API: User-Agent: workos-go/v7.0.0
Loading

Comments Outside Diff (1)

  1. options.go, line 50-57 (link)

    P2 Stale doc comment on WithAppInfo

    The function comment still says "is appended to the User-Agent header," but after this PR the stored appInfo value is never read — it has no effect at runtime. A caller reading the doc will believe their app name appears in User-Agent, which is no longer true. The comment (and ideally the appInfo field on the Client struct) should be updated to reflect the new behavior described in the PR description.

Reviews (1): Last reviewed commit: "fix: set canonical User-Agent header for..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant