Piotr Mlocek 9b71fa4d86 fix(router): replace model ID in request body with route-configured model (!56)
> **🏗️ build-from-issue-agent**

Closes #81

## Summary
The proxy was forwarding the client's original `model` field in the request body unchanged to the backend, causing backends to reject requests for models they don't serve. Now `proxy_to_backend()` always sets the `"model"` field in the JSON body to the route's configured model before forwarding. This covers all 4 supported inference protocols (openai_chat_completions, openai_completions, openai_responses, anthropic_messages).

## Changes Made
- `crates/navigator-router/src/backend.rs`: Added JSON body model override — parses the body and always sets `"model"` to `route.model` (replaces if present, inserts if absent). Non-JSON bodies pass through unchanged.
- `crates/navigator-router/tests/backend_integration.rs`: Added 2 integration tests using wiremock's `body_partial_json` matcher

## Deviations from Plan
Minor improvement: the plan specified only replacing `"model"` when already present. Changed to always set it, since all inference protocols require the field and omitting it would cause backend rejection.

## Tests Added
- **Unit:** N/A
- **Integration:** `proxy_overrides_model_in_request_body` and `proxy_inserts_model_when_absent_from_body` in `crates/navigator-router/tests/backend_integration.rs`
- **E2E:** N/A

## Documentation Updated
- `architecture/sandbox.md`: Updated proxy forwarding description to include model ID rewriting
- `architecture/inference-routing.md`: Updated backend.rs description, sequence diagram, and backend proxying steps

## Verification
- [x] All tests passing
- [x] Pre-commit checks passing (clippy, fmt)
- [x] Architecture documentation updated
2026-02-25 12:50:48 -08:00

Navigator 🗺️

Navigator is the runtime environment for autonomous agents—the "Matrix" where they live, work, and verify.

While coding tools like Claude help agents write logic, Navigator provides the infrastructure to run it, offering a programmable factory where agents can spin up physics simulations to master tasks, generate synthetic data to fix edge cases, and safely iterate through thousands of failures in isolated sandboxes.

It transforms the data center from a static deployment target into a continuous verification engine, allowing agents to autonomously build and operate complex systems—from physical robotics to self-healing infrastructure—without needing a human to manage the infrastructure.

Quickstart

Prerequisites

  • Docker — Docker Desktop (or a Docker daemon) must be running.
  • Python 3.12+ and uv

Install

uv pip install navigator --upgrade --pre --index-url https://urm.nvidia.com/artifactory/api/pypi/nv-shared-pypi/simple

The navigator binary is installed into your Python environment. Use uv run navigator to invoke it, or activate your venv first (source .venv/bin/activate).

Create a sandbox

uv run navigator sandbox create -- claude  # or opencode or codex

The sandbox container includes a minimal networking toolset by default: ping, dig, nslookup, nc, traceroute, and netstat.

Developing

See CONTRIBUTING.md for building from source and contributing to Navigator.

Architecture

See architecture/ for detailed architecture docs and design decisions.

S
Description
GitHub Trending: NVIDIA/OpenShell
Readme Apache-2.0
260 MiB
Languages
Rust 87.5%
Go 4.6%
Shell 3.3%
Python 2.5%
TypeScript 0.9%
Other 1%