Skip to content

fix: standardize provider user agents with the AstrBot version - #10082

Merged
Soulter merged 1 commit into
masterfrom
codex/provider-user-agent
Sep 14, 2026
Merged

Soulter merged 1 commit into
masterfrom
codex/provider-user-agent

Conversation

@Soulter

@Soulter Soulter commented Sep 14, 2026

Copy link
Copy Markdown
Member

Provider requests currently use SDK-specific or hardcoded user agents. Default built-in chat, speech, embedding, and reranking requests to astrbot/<version>, derived from astrbot.__version__. Preserve configured HTTP User-Agent overrides regardless of header casing, and remove hardcoded Claude Code headers from new coding-plan provider templates. Existing saved custom headers are preserved.

Cover both SDK clients and direct HTTP sessions, including SDK-specific handling for Gemini, DashScope, and Edge TTS. Gemini's generated duplicate header is removed after client initialization; Edge TTS uses its shared SDK synthesis-header default because it does not expose a per-client header option.

Validation: ruff format ., ruff check ., and 230 passing targeted Python tests. New tests capture local HTTP and WebSocket requests to verify exact default and custom user agents. External provider authentication and service acceptance were not exercised.

Summary by Sourcery

Standardize provider User-Agent headers around the current AstrBot version while retaining explicit user configuration.

Bug Fixes:

  • Standardize built-in provider request User-Agent headers to astrbot/<version> while preserving configured custom overrides regardless of header casing.
  • Remove hardcoded Claude Code User-Agent values from new coding-plan provider defaults.

Enhancements:

  • Apply consistent User-Agent handling across provider SDK clients, direct HTTP sessions, and Edge TTS WebSocket requests without mutating saved provider configuration.

Tests:

  • Add local HTTP and WebSocket coverage for default, custom, and duplicate User-Agent behavior across provider integrations.

@sourcery-ai sourcery-ai Bot 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.

Sorry @Soulter, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 4 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
astrbot-docs 6975439 Commit Preview URL

Branch Preview URL
Sep 14 2026, 12:22 PM

@Soulter
Soulter merged commit d524b87 into master Sep 14, 2026
24 checks passed
@Soulter
Soulter deleted the codex/provider-user-agent branch September 14, 2026 13:24
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