Skip to content

🤖 fix: prepend mux attribution to provider user-agent#2673

Merged
ThomasK33 merged 1 commit intomainfrom
proxy-debug-60pk
Feb 27, 2026
Merged

🤖 fix: prepend mux attribution to provider user-agent#2673
ThomasK33 merged 1 commit intomainfrom
proxy-debug-60pk

Conversation

@ThomasK33
Copy link
Member

Summary

Prepend Mux attribution to outbound provider User-Agent values while preserving SDK-provided metadata.

Background

Anthropic requests currently preserve provider SDK User-Agent values. We want Mux attribution to be present first without losing the downstream SDK/runtime detail used for diagnostics.

Implementation

  • Updated buildAIProviderRequestHeaders in src/node/services/providerModelFactory.ts to:
    • set User-Agent to mux/<version> when absent,
    • prepend mux/<version> when a non-empty User-Agent already exists,
    • avoid duplicating the Mux prefix if already present.
  • Added a defensive assertion after trim to enforce non-empty invariants when entering the prepend path.
  • Updated src/node/services/providerModelFactory.test.ts:
    • changed existing-header expectation to prepend semantics,
    • added coverage for no-duplication when prefix already exists.

Validation

  • bun test src/node/services/providerModelFactory.test.ts
  • make static-check

Risks

Low risk and scoped to request header composition. Main regression surface is user-agent formatting across providers; covered with focused unit tests.


Generated with mux • Model: openai:gpt-5.3-codex • Thinking: xhigh • Cost: $1.72

Ensure provider fetch requests prepend mux/<version> to any existing User-Agent so SDK metadata is preserved while mux attribution stays first.

---

_Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$1.72`_

<!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=1.72 -->
@ThomasK33
Copy link
Member Author

@codex review

@ThomasK33
Copy link
Member Author

@codex review

Please take another look.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33 ThomasK33 added this pull request to the merge queue Feb 27, 2026
Merged via the queue into main with commit 8f5dc3f Feb 27, 2026
23 checks passed
@ThomasK33 ThomasK33 deleted the proxy-debug-60pk branch February 27, 2026 06:34
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.

1 participant