Skip to content

Python: fix: handle case-insensitive User-Agent headers - #8555

Closed
spark (spark-328) wants to merge 1 commit into
microsoft:mainfrom
spark-328:codex/fix-8520-lowercase-user-agent
Closed

spark (spark-328) wants to merge 1 commit into
microsoft:mainfrom
spark-328:codex/fix-8520-lowercase-user-agent

Conversation

@spark-328

Copy link
Copy Markdown

Fixes #8520.

What changed

  • Detect an existing User-Agent header case-insensitively and prepend the framework value to that entry instead of adding a second canonical header.
  • Preserve the caller's header spelling and the existing mutation behavior.

Validation

  • uv run pytest packages/core/tests/core/test_telemetry.py -q (38 passed, 1 skipped)
  • uv run ruff check ...

Copilot AI balanced review requested due to automatic review settings September 20, 2026 10:12
@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Sep 20, 2026
@github-actions github-actions Bot changed the title fix: handle case-insensitive User-Agent headers Python: fix: handle case-insensitive User-Agent headers Sep 20, 2026
@spark-328

Copy link
Copy Markdown
Author

Closing: this duplicates the earlier linked PR #8521. I missed that cross-reference during issue triage and will not continue with duplicate work.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation directly addresses the duplicate-header issue with focused regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes case-insensitive User-Agent handling while preserving header spelling and in-place mutation.

Changes:

  • Finds existing User-Agent keys case-insensitively.
  • Adds regression coverage for lowercase headers.
File Description
python/​packages/​core/​agent_framework/​_telemetry.py Updates User-Agent lookup and mutation logic.
python/​packages/​core/​tests/​core/​test_telemetry.py Tests lowercase User-Agent handling.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

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

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: duplicate User-Agent headers when caller passes lowercase user-agent

2 participants