Repository navigation
Answer requests other than POST in the gateway; v0.57.1 - #248
Merged
Merged
Conversation
Every upstream API the gateway forwards to takes POST, and the gateway always sent the upstream request as POST. Any other method that reached the catch-all route was sent on as an empty POST, recorded as a failed request and, with failover, tried on the next upstreams. Hermes Agent sends five such GETs when it starts (/api/v1/models, /api/tags, /v1/props, /props, /version) to tell whether a server is LM Studio, Ollama, llama.cpp or vLLM; an upstream that answered 200 made it take the gateway for one of them. Such requests now get a 404 in the client's error format, after the key check, and are neither forwarded nor recorded (new message code gw.method.not_forwarded). Requests without a key still get 401. /v1/models, /v1beta/models, /api/hello, /healthz and WebSocket upgrades are unchanged. The Files API 404 shares the same helper. Bumps the workspace to 0.57.1 with release-notes/0.57.1.md. The control-plane protocol (31) and the request store schema (23) are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Patch release: the gateway answers requests other than POST itself instead of forwarding them.
Problem
Every upstream API the gateway forwards to takes POST, and
hop::sendalways sends the upstream request as POST. Any other method that reached the catch-all route was therefore:Hermes Agent, which ThinkWatch Lite can now connect, sends five such GETs when it starts (
/api/v1/models,/api/tags,/v1/props,/props,/version;detect_local_server_typeinagent/model_metadata.py). It uses them to tell whether a server is LM Studio, Ollama, llama.cpp or vLLM. Each of them showed up in Traffic as a failed request. An upstream that answered one of them with 200 made Hermes take the gateway for that kind of server.Change
passthrough, after the key check and the WebSocket branch, a method other than POST gets a 404 in the client's error format (Anthropic whenanthropic-versionis present, otherwise Chat Completions).gw.method.not_forwarded./v1/models,/v1beta/models,/api/hello,/healthzand WebSocket upgrades have their own routes or branch and are unchanged.no_filesnow uses the samenot_foundhelper.crates/tw-gateway/tests/probes.rscovers the Hermes probe paths, other methods, the 401 without a key, the Anthropic error shape, and that POST is still forwarded and recorded. Before the change, the probes got the fake upstream's 200.Release
release-notes/0.57.1.md.Checks
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningscargo test --workspace: 2044 passedmsg-codes.txtregenerated🤖 Generated with Claude Code