Skip to content

🐛 Bugfix: Resolve the 502 Bad Gateway issue when calling multimodal tool#2811

Merged
Dallas98 merged 2 commits intodevelopfrom
xyq/bugfix
Apr 21, 2026
Merged

🐛 Bugfix: Resolve the 502 Bad Gateway issue when calling multimodal tool#2811
Dallas98 merged 2 commits intodevelopfrom
xyq/bugfix

Conversation

@xuyaqist
Copy link
Copy Markdown
Contributor

@xuyaqist xuyaqist commented Apr 17, 2026

  1. Bugfix: Resolve the 502 Bad Gateway issue when calling multimodal tool
  2. Bugfix: Add tooltip to tab labels in ToolManagement and SkillManagement
image

Copilot AI review requested due to automatic review settings April 17, 2026 07:46
@xuyaqist xuyaqist changed the title Bugfix: Resolve the 502 Bad Gateway issue when calling multimodal tool 🐛 Bugfix: Resolve the 502 Bad Gateway issue when calling multimodal tool Apr 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix intermittent 502 Bad Gateway errors when invoking the multimodal tool by adjusting how shared httpx clients are constructed.

Changes:

  • Disable httpx environment-derived configuration by setting trust_env=False on shared sync clients.
  • Disable httpx environment-derived configuration by setting trust_env=False on shared async clients.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 169 to +173
limits=Limits(
max_connections=100,
max_keepalive_connections=20
)
),
trust_env=False
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

base_url is used to key the client cache and the module docstring shows relative requests (e.g., client.get("/api/endpoint")), but the created httpx.Client isn't configured with base_url=.... That makes relative URL requests fail and also allows the cached client to be used for other hosts, undermining the per-base_url pooling intent. Consider passing base_url=base_url when constructing the client (and/or updating the docstring if only absolute URLs are supported).

Copilot uses AI. Check for mistakes.
max_keepalive_connections=20
)
),
trust_env=False
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

Setting trust_env=False globally changes behavior for all SDK HTTP calls by ignoring standard env configuration (e.g., HTTP(S)_PROXY / NO_PROXY and CA bundle env vars). If this is intended only to work around a specific 502/proxy issue, consider making it configurable (e.g., a trust_env parameter on get_*_client, or a library env flag) so proxy-based deployments don’t silently break.

Copilot uses AI. Check for mistakes.
max_keepalive_connections=20
)
),
trust_env=False
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

There are existing unit tests for HttpClientManager, but none assert the newly introduced trust_env=False behavior. Add a test that verifies httpx.Client(...) is constructed with trust_env=False (e.g., by patching httpx.Client and asserting call args) so future refactors don’t regress this fix.

Copilot uses AI. Check for mistakes.
Comment on lines 209 to +213
limits=Limits(
max_connections=100,
max_keepalive_connections=20
)
),
trust_env=False
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

Same issue as the sync client: the httpx.AsyncClient is keyed by base_url but isn't constructed with base_url=..., so relative URL requests (as suggested by this module’s docstring) won’t work and the cached client can be used across hosts. Consider passing base_url=base_url here as well for consistency and correctness.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Dallas98 Dallas98 merged commit a09cdb4 into develop Apr 21, 2026
16 checks passed
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.

3 participants