Repository navigation
fix(upstream): let the runtime own Accept and Content-Length placement - #143
Merged
Merged
Conversation
A captured 2.1.1 request carries neither an Accept header nor a trailing Content-Length: fetch fills Accept with */* and computes Content-Length as part of the common-header block. The gateway set both itself, so the v2 lane sent an Accept value the client never produces and put Content-Length last, where no fetch request has it. Header order and presence are part of what a fingerprint sees, so the v2 lane now sets no Accept and the Bun head emits Content-Length among the common headers instead of trailing the request. The v1 lane keeps its own Accept, which is what that client sends.
TiaraBasori
added a commit
to TiaraBasori/opencode2api-1
that referenced
this pull request
Oct 25, 2026
…breaker) Pick up origin/main (19 commits since v1.4.3): - 2.1.1 client shape: version bump, /inference/openai|anthropic family routes, max_completion_tokens 32000, strict:false tools, client key order, no HTML escaping, runtime-owned Accept/Content-Length (jasonxu114514#141-jasonxu114514#143) - anonymous-lane abuse handling: IP-block detection, per-exit block TTL, circuit breaker (models.anonymous_backoff), max_anonymous_exits cap, deterministic 4xx stops the walk instead of replaying every exit - placeholder key dropping, probe failure classification (jasonxu114514#111), WebUI Cache-Control (jasonxu114514#112), reasoning disable preserved end to end (jasonxu114514#150), Italian README/WebUI Conflict resolutions: - internal/config/config.go, README.md, README.zh-CN.md: kept both sides — the alias fields (aliases/strip_free_suffix) and the new anonymous_backoff block sit side by side in ModelsConfig and the README tables. Local adaptation for this deployment's #pool exit (not upstream): - a #pool transport dials a fresh upstream address on every attempt, so an IP-scoped abuse block cannot be parked on the transport: blocked() and markBlocked() ignore pool transports and the anonymous walk keeps rotating instead of freezing every exit behind one flagged address.
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.
What
A captured 2.1.1 request has no
Acceptheader and no trailingContent-Length. Both come fromfetch, which fillsAcceptwith*/*andcomputes
Content-Lengthas part of its common-header block.The gateway set both itself, so the v2 lane sent:
Header presence and order are part of what a fingerprint sees, so both are now
left to the transport:
setV2Headersno longer setsAccept.Content-Lengthamong the common headers, wherefetchcomputes it, instead of trailing the request.
The v1 lane keeps its own
Accept— that client does send one.Why this is a separate PR
It changes only what the wire looks like, not what the body contains, so it can
be reviewed and reverted on its own.
How it was verified
Accept,Content-Lengthin the common block.Content-Lengthsits with the othercommon headers and
Accept: */*is emitted by the runtime.calls,
/v1/messagesand/v1/responses.go build ./...,go vet ./...,gofmtclean.