fix: isolate upstream X-Request-ID per request - #2027
Open
winterfell2021 wants to merge 1 commit into
Open
Conversation
Contributor
winterfell2021
force-pushed
the
fix/unique-upstream-request-id
branch
from
July 17, 2026 14:33
9d2e725 to
d35db06
Compare
Owner
|
这个需要一个配置项
|
ssxwcz
added a commit
to ssxwcz/axonhub
that referenced
this pull request
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
X-Request-Idon outbound calls with AxonHub's unique per-requestar-*IDProblem
AxonHub trace IDs can intentionally span multiple agent calls, while an HTTP request ID must identify one request. The generic inbound-header merge currently forwards
X-Request-Idunchanged. If a client reuses that value to group an agent trace, independent outbound calls receive the same request ID.Downstream gateways that use
X-Request-Idfor usage idempotency or deduplication can then collapse unrelated requests into one record, mixing models, statuses, token usage, and charges.AxonHub already generates a unique
ar-*request ID for every inbound HTTP request inWithLoggingTracing; it was not previously applied to the outbound provider request.Fix
Add an outbound raw-request middleware that sets
X-Request-Idfrom AxonHub's request context after inbound headers are merged. Different inbound requests therefore get different downstream IDs even when the client reuses its own value. Retries for one request keep the same ID, and explicit channel header overrides can still replace it.Verification
go test ./...cd llm && go test ./...