You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(proxy): return 404 for unknown paths on OpenAI ingress - #3197
fix(proxy): return 404 for unknown paths on OpenAI ingress
Original problem
Fixes#3186. Sending a JSON POST to an unknown path on the OpenAI ingress port (such as /api/plugins/... sent to :9337 instead of console :3131) enters automatic model routing, picks a random plugin model, and fails with a confusing 503 (plugin endpoint for model '...' failed) instead of 404. Model-less unknown GET requests hit the first_available_target fallback (503 when no native targets exist, or forwarding an unknown path to a native backend).
Callers hitting the wrong port or a typoed path get misleading 503 backend failures and trigger unnecessary routing work instead of a clear 404 not_found.
Diagnostics
On main, both POST /api/plugins/mesh-dev/tools/env_probe (with body {}) and GET /does-not-exist on OpenAI ingress fail the new regression tests with HTTP/1.1 503 Service Unavailable instead of 404.
Fix
Add workload_routing::is_openai_ingress_backend_path(method, path) covering the known OpenAI ingress backend routes (workload-classified inference routes, System One routes, /v1/messages/count_tokens, /v1/tokenize, and GET/HEAD/health//healthz//readyz).
Add send_route_not_found_observed in response/send.rs returning 404 with "code": "not_found" (matching InferenceError::route_not_found).
Enforce the route check after control-plane routing (maybe_handle_control_request / handle_mesh_control_request) in both ingress/buffered_exchange.rs and transport.rs (bootstrap proxy).
Add regression tests in ingress_tests/unknown_path.rs.
Validation
I ran the regression tests against main (confirmed 503 failure) and verified cargo fmt, cargo clippy, CI contracts, and mesh-llm-host-runtime tests (Linux, Windows) pass with the fix.
No UI changes.
Summary by CodeRabbit
Bug Fixes
Requests to unrecognized OpenAI ingress paths now receive a consistent 404 not_found response instead of being forwarded to backend services or plugin inference endpoints.
Recognized API, health, and readiness routes continue to be handled as before, including requests with query parameters.
Unknown paths handled through the bootstrap mesh handler also return a 404 response.
Review was skipped as selected files did not have any reviewable changes.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 039de524-22f0-4aca-9bab-4c41080894d8
Commits
Reviewing files that changed from the base of the PR and between 4fbf593 and 94b2222.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The OpenAI ingress now checks whether requests match supported backend paths. Non-matching requests receive an observed 404 and are not forwarded. Tests cover admitted routes, rejected routes, and plugin non-forwarding.
Changes: OpenAI ingress route handling
Layer / File(s)
Summary
Backend-path predicate and 404 response mesh/crates/mesh-llm-host-runtime/src/network/openai/workload_routing.rs, mesh/crates/mesh-llm-host-runtime/src/network/openai/response.rs, mesh/crates/mesh-llm-host-runtime/src/network/openai/response/send.rs, mesh/crates/mesh-llm-host-runtime/src/network/openai/transport.rs, mesh/crates/mesh-llm-host-runtime/src/network/openai/response/external_endpoint.rs
is_openai_ingress_backend_path matches workload-class and System One routes, token utility routes, and selected health routes. The response helper sends an observed 404 with code not_found and no retry delay. The external-endpoint route test checks that accepted paths also match ingress admission or model discovery.
Ingress rejection and validation mesh/crates/mesh-llm-host-runtime/src/network/openai/transport.rs, mesh/crates/mesh-llm-host-runtime/src/network/openai/ingress/buffered_exchange.rs, mesh/crates/mesh-llm-host-runtime/src/network/openai/ingress.rs, mesh/crates/mesh-llm-host-runtime/src/network/openai/ingress_tests/unknown_path.rs
Both ingress handlers return an observed 404 for non-matching routes and release request objects. Tests check route admission, 404 responses, bootstrap mesh handling, and that an unknown POST does not connect to the configured plugin endpoint.
sequenceDiagram
participant Client
participant Ingress as OpenAI ingress handler
participant PathCheck as is_openai_ingress_backend_path
participant NotFound as send_route_not_found_observed
Client->>Ingress: Send request
Ingress->>PathCheck: Check method and path
PathCheck-->>Ingress: Return non-matching result
Ingress->>NotFound: Send observed 404
Ingress-->>Client: Return not_found response
Loading
Merge Risk: Minimal · previous review 4fbf5
Unknown paths on the OpenAI ingress now return 404 with code not_found instead of being routed to a model and failing with a misleading 503. No concrete merge-blocking risk was found. Model discovery and the supported inference routes still pass through the existing handlers before the new check.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "fix(proxy): return 404 for unknown paths on OpenAI ingress" states the main change. The raw summary and objectives show the PR returns observed 404 responses with code not_found for unknown…
Linked Issues check
Issue #3186 requires an unknown path on the OpenAI ingress port to return 404 without model selection or forwarding to a backend. The example case is a JSON POST with body {} to /api/plugins/.../tools…
Out of Scope Changes check
All changes connect to issue #3186. The new predicate defines which paths the ingress forwards. The 404 sender, its re-export in response.rs and transport.rs, the gates in buffered_exchange.rs and tra…
Full details: Title check
Explanation
The title "fix(proxy): return 404 for unknown paths on OpenAI ingress" states the main change. The raw summary and objectives show the PR returns observed 404 responses with code not_found for unknown paths on the OpenAI ingress, instead of routing them to a model and returning 503. The title is specific, concise, and free of file lists or vague terms. Its scope matches the changeset.
Full details: Linked Issues check
Explanation
Issue #3186 requires an unknown path on the OpenAI ingress port to return 404 without model selection or forwarding to a backend. The example case is a JSON POST with body {} to /api/plugins/.../tools/... that currently reaches automatic routing and returns 503. The PR adds workload_routing::is_openai_ingress_backend_path, which gates unknown paths. In ingress/buffered_exchange.rs, the gate runs after control-plane handling and before callable_models() and automatic routing. On failure, the handler sends send_route_not_found_observed (404, code not_found) and returns. In transport.rs, handle_mesh_control_request applies the same gate after control-plane handling. I read this hunk directly at the reviewed head. It sends the 404, terminalizes the lifecycle, releases request objects, and returns None. The unknown_path regression tests cover the POST /api/... case and unknown GET paths, per the summary. I did not re-run the tests. The buffered_exchange.rs hunk is taken from the summary and was not read directly. Coverage of issue #3186 is established.
Full details: Out of Scope Changes check
Explanation
All changes connect to issue #3186. The new predicate defines which paths the ingress forwards. The 404 sender, its re-export in response.rs and transport.rs, the gates in buffered_exchange.rs and transport.rs, the unknown_path tests, and the external_endpoint.rs documentation and path-admission test all implement or document the 404 behavior. The external_endpoint.rs change keeps the external-forwarding path list aligned with ingress admission. No unrelated functional change appears in the summary or the transport.rs hunk. Residual compatibility risk remains: any ingress-forwarded path absent from the predicate now returns 404 instead of forwarding. The predicate covers request_workload_class routes, System One routes, /v1/messages/count_tokens, /v1/tokenize, and GET/HEAD health routes. I did not enumerate every path the ingress forwards, so this is a compatibility concern to verify, not a demonstrated out-of-scope change.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
kleinbem
added a commit
to kleinbem/mesh-dev-plugin
that referenced
this pull request
Nov 22, 2026
Pin the three upstream Mesh-LLM PRs uncovered with `mesh-dev` in
`docs/CAPABILITY_AUDIT.md` and
`suites/01-core-inference-and-inspector.toml`:
- `upstream: Mesh-LLM/mesh-llm#3194` (pre-header client disconnect
cancellation)
- `upstream: Mesh-LLM/mesh-llm#3196` (plain-HTTP plugin health probe
without system CA certs / loopback proxy bypass)
- `upstream: Mesh-LLM/mesh-llm#3197` (OpenAI ingress 404 for unknown
paths, paired with `tracking: Mesh-LLM/mesh-llm#3186`)
The reason will be displayed to describe this comment to others. Learn more.
[P3] This allowlist now lives next to is_forwardable_external_endpoint_path in external_endpoint.rs, which has a slightly different route set. A new ingress route that only lands in one of them will 404 here, or be refused at the backend, with no test tying the two together. Optional: add a short comment on both pointing at each other, or build the external list from this one.
The reason will be displayed to describe this comment to others. Learn more.
Rebased and added cross-ref comments on both allowlists, and tied them together in the external endpoint test so any forwardable route has to be admitted at ingress too. Also added a 404 test for the bootstrap proxy path.
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
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.
Title
fix(proxy): return 404 for unknown paths on OpenAI ingress
Original problem
Fixes #3186. Sending a JSON
POSTto an unknown path on the OpenAI ingress port (such as/api/plugins/...sent to:9337instead of console:3131) enters automatic model routing, picks a random plugin model, and fails with a confusing503(plugin endpoint for model '...' failed) instead of404. Model-less unknownGETrequests hit thefirst_available_targetfallback (503when no native targets exist, or forwarding an unknown path to a native backend).Callers hitting the wrong port or a typoed path get misleading
503backend failures and trigger unnecessary routing work instead of a clear404 not_found.Diagnostics
On
main, bothPOST /api/plugins/mesh-dev/tools/env_probe(with body{}) andGET /does-not-existon OpenAI ingress fail the new regression tests withHTTP/1.1 503 Service Unavailableinstead of404.Fix
workload_routing::is_openai_ingress_backend_path(method, path)covering the known OpenAI ingress backend routes (workload-classified inference routes, System One routes,/v1/messages/count_tokens,/v1/tokenize, andGET/HEAD/health//healthz//readyz).send_route_not_found_observedinresponse/send.rsreturning404with"code": "not_found"(matchingInferenceError::route_not_found).maybe_handle_control_request/handle_mesh_control_request) in bothingress/buffered_exchange.rsandtransport.rs(bootstrap proxy).ingress_tests/unknown_path.rs.Validation
main(confirmed503failure) and verifiedcargo fmt,cargo clippy,CI contracts, andmesh-llm-host-runtimetests (Linux, Windows) pass with the fix.Summary by CodeRabbit
not_foundresponse instead of being forwarded to backend services or plugin inference endpoints.