mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-16 05:20:22 +08:00
* fix(supervisor-process): use slice patterns when rewriting passwd/group lines rewrite_passwd_at and rewrite_group_at indexed into a Vec of fields with fields[N] after checking fields.len(). Use slice patterns so a malformed line falls through to the no-op branch instead of risking a panic if the guard is ever changed. Add regression tests for malformed sandbox entries. Signed-off-by: Andrew White <andrewh@cdw.com> * fix(bootstrap): avoid byte-index slice after @ in SSH destination extract_host_from_ssh_destination sliced dest[at_pos + 1..] after finding '@'. '@' is ASCII so this is currently safe, but it is a latent panic surface if the split logic changes. Use get() instead and add a multi-byte hostname test. Signed-off-by: Andrew White <andrewh@cdw.com> * fix(bootstrap): avoid byte-index slice in .dockerignore glob matcher glob_match sliced path[idx + 1..] after matching '/'. '/' is ASCII so this is currently safe, but it is a latent UTF-8 panic surface. Use get() instead. Signed-off-by: Andrew White <andrewh@cdw.com> * fix(router): avoid literal byte offset when stripping /v1 prefix build_backend_url sliced &path[3..] after verifying the /v1 prefix. Use strip_prefix() so the code stays correct if the prefix length ever changes. Signed-off-by: Andrew White <andrewh@cdw.com> * fix(supervisor-network): avoid byte-index slice in inference path matching The Bedrock-style /*/ path matcher sliced rest[slash_at + 1..] after finding '/'. '/' is ASCII so this is currently safe, but it is a latent UTF-8 panic surface. Use get() instead. Signed-off-by: Andrew White <andrewh@cdw.com> --------- Signed-off-by: Andrew White <andrewh@cdw.com>
openshell-router
openshell-router is the inference routing and upstream execution engine used
by the sandbox proxy and gateway inference validation paths.
Responsibilities
- Select an upstream route from a candidate set (based on protocol compatibility).
- Forward raw HTTP requests to the selected upstream backend.
- Normalize upstream failures into router-level errors (
unauthorized,unavailable, protocol/internal errors). - Keep routing decision logic in one place so strategies can evolve (fallbacks, scoring, health-based routing).
Non-responsibilities
- Authentication and sandbox identity.
- Authorization and policy enforcement.
- Persistence of routes/entities.
- Loading sandbox or policy objects.
These are owned by openshell-server and openshell-sandbox.
Integration Contract
Current split:
openshell-server:- authenticates user-facing inference configuration changes
- resolves managed route candidates from provider records
- validates backend endpoints
openshell-sandbox:- intercepts
https://inference.local - detects the source inference protocol
- passes sanitized requests and resolved route candidates to the router
- intercepts
openshell-router:- picks a route from candidates (
proxy_with_candidates) - forwards the HTTP request upstream and returns the raw response
- picks a route from candidates (
Public APIs
Router::proxy_with_candidates(source_protocol, method, path, headers, body, &[ResolvedRoute])- Filters candidates by protocol compatibility, then forwards the request to the first match.
- Preferred path for entity-driven server routing.
Notes
- Route selection matches candidates by
protocolfield (e.g.openai_chat_completions). - Route selection is intentionally simple and will evolve.