Repository navigation
fix(serve): honor --cors for the decision server - #256
Draft
shubhamsinnh wants to merge 2 commits into
Draft
shubhamsinnh wants to merge 2 commits into
shubhamsinnh wants to merge 2 commits into
Conversation
The --cors flag reached the LLM server but was dropped when serve routed a decision model to its local decision endpoint. Pass the flag through to the decision server, answer OPTIONS with 204, and add the same Access-Control headers the SDK LLM server uses to every response, including 400/404/413/431 and 500. Without --cors the behavior is unchanged. Validated with the GLiNER 2.5 Decide model: preflight returns 204 with the headers, POST returns the same decision JSON with the headers, and error responses carry them too. Browser-level CORS validation was not performed.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
RFC 9110 section 8.6 forbids Content-Length on 204 responses, including an explicit zero. Keep the normal JSON response framing for other statuses. Verified eight raw TCP exchanges with a real decision model and all five existing serve tests. Browser behavior remains unverified.
This branch has not been deployed
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.
wally serve --corswas ignored for decision models, so browser preflight requests returned 404 without CORS headers.The decision server now receives the flag, answers OPTIONS before routing, and adds CORS headers to both successful and error responses. Behavior without
--corsstays the same.Validation with a real decision model covered default-off behavior, preflight 204, POST 200, and headers on 400/404/413/431 responses. Browser validation and the runtime 500 path were not exercised.
CI and formatting pass. The local full suite had 565 passes and two Windows symlink-privilege failures. Strict Clippy reports four pre-existing lints in untouched files.
Summary by cubic
Fixes
--corsbeing ignored by the local decision server, so browser-based decision requests now behave like the LLM server. Previously the flag applied only to the LLM server; a decision model routed to the local decision endpoint skipped it and OPTIONS preflight returned 404.--corsthrough to the decision server and answers OPTIONS with 204 before method/path routing, omitting Content-Length on 204 responses per RFC 9110.Access-Control-Allow-Origin,Access-Control-Allow-Methods, andAccess-Control-Allow-Headersvalues the LLM server uses to every response, errors included.--corsis unchanged.Written for commit 63bd340. Summary will update on new commits.