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
docs(plan): replan ONNX runtime for Rust execution
Replace the Python sidecar direction with an in-process Rust ONNX provider/session architecture across the ONNX Runtime embedding serving plan, ADR, contracts, risks, milestones, and execution notes.
The re-plan keeps Pumas /v1 as the public facade, moves ONNX execution and dependency ownership into Rust, makes the first implementation slice a Rust provider skeleton with a fake backend, and records the Python ONNX sidecar as rejected and out of scope.
Removed the aborted uncommitted onnx-server skeleton before this documentation update; no sidecar implementation files are committed.
Verification:
- git diff --check
- rg -n "onnx-server|ONNX Sidecar Skeleton|ruff check onnx-server|python -m unittest|sidecar-local|ONNX sidecar lifecycle|managed sidecar|future ONNX managed sidecar|future ONNX sidecar|sidecar launch wiring" docs/plans/onnx-runtime-embedding-serving docs/adr/0001-onnx-runtime-provider-model.md
Agent: codex
Copy file name to clipboardExpand all lines: docs/adr/0001-onnx-runtime-provider-model.md
+16-13Lines changed: 16 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ embedding models through the existing OpenAI-compatible `/v1` gateway. Current
15
15
runtime profile, serving, gateway, launcher, and frontend paths are shaped
16
16
around Ollama and llama.cpp. Adding ONNX as another branch would preserve the
17
17
existing two-provider assumptions and make route identity, endpoint capability,
18
-
and sidecar lifecycle behavior harder to reason about.
18
+
and ONNX runtime/session lifecycle behavior harder to reason about.
19
19
20
20
This ADR records the Milestone 0 provider-model decision required by
21
21
`docs/plans/onnx-runtime-embedding-serving/`.
@@ -34,8 +34,8 @@ The provider model separates these contracts:
34
34
provider-side model id policy, launch-on-serve behavior, and unload behavior.
35
35
- Runtime profile: persisted managed or external runtime configuration for one
36
36
provider.
37
-
- Launch strategy: binary process, Python sidecar, or external-only lifecycle
38
-
plan selected by provider behavior.
37
+
- Launch/runtime strategy: binary process, in-process Rust runtime, or
38
+
external-only lifecycle plan selected by provider behavior.
39
39
- Model route: provider-scoped saved route keyed by `(provider, model_id)`.
40
40
- Served instance: backend-owned loaded model status with enough provider
41
41
identity to disambiguate the same model id served by multiple providers.
@@ -58,13 +58,13 @@ before ONNX serving is accepted.
58
58
| System | Current Owner | ONNX Treatment |
59
59
| ------ | ------------- | -------------- |
60
60
| App/plugin registry | Plugin JSON, Rust `AppId`, RPC version-manager composition, frontend app registry | Refactor or update as one app identity slice. ONNX extends this only after drift tests or a descriptor owner exists. |
| Version/process management |`pumas-app-manager`, `pumas-rpc` composition, `pumas-core` process helpers | Refactor launch/runtime strategy first. ONNX uses an in-process Rust ONNX Runtime session manager, not Ollama/llama.cpp binary constructors or a Python sidecar. |
62
62
| Runtime profiles |`pumas-core` runtime profile service and DTOs | Refactor to provider behavior and provider-scoped routes before ONNX routes. |
63
63
| Model library |`pumas-core` model library and frontend projection helpers | Extend executable format/compatibility helpers; keep generic ONNX embedding compatibility separate from custom ONNX app metadata. |
64
64
| Serving state |`pumas-core` serving contracts and `pumas-rpc` serving handler | Refactor to provider serving adapters and provider-aware served identity before ONNX load/unload. |
65
65
| OpenAI gateway |`pumas-rpc` gateway handlers and Axum routes | Refactor endpoint capability checks, shared HTTP client, body limits, and provider model-id rewriting before ONNX gateway routing. |
66
66
| Frontend runtime/profile UI | Frontend app panels, runtime profile sections, route rows, serve dialog | Refactor to provider descriptors and provider-scoped route helpers before ONNX panel and route assignment. |
67
-
| Torch sidecar |`torch-server/` and Torch-specific process/client integration |Use as sidecar API reference only. It is not the runtime-profile provider architecture. |
67
+
| Torch sidecar |`torch-server/` and Torch-specific process/client integration |Keep as unrelated Torch architecture. It is not the ONNX Runtime implementation target. |
68
68
69
69
## App And Runtime Descriptor Strategy
70
70
@@ -113,7 +113,7 @@ The first complete public-contract acceptance path is:
113
113
2. Save a provider-scoped route for an ONNX-compatible model.
114
114
3. Call `serve_model` without an explicit profile and resolve the saved ONNX
115
115
route.
116
-
4. Load through a fake or fixture ONNX sidecar adapter.
116
+
4. Load through a fake or fixture Rust ONNX provider adapter.
117
117
5. Record backend-owned `ServedModelStatus`.
118
118
6. Confirm `GET /v1/models` lists the public alias.
119
119
7. Confirm `POST /v1/embeddings` proxies through the Pumas gateway.
@@ -159,12 +159,15 @@ targets include:
159
159
- Keep model-only runtime routes: rejected because the same model id can be
160
160
served by multiple providers, and ONNX missing-route behavior must not fall
161
161
back to a llama.cpp or default profile.
162
-
- Expose the raw ONNX sidecar as the supported external app contract: rejected
163
-
because Pumas owns aliases, served state, future auth policy, and the existing
164
-
`/v1` facade.
162
+
- Add a Python ONNX sidecar: rejected because ONNX Runtime can be hosted through
163
+
Rust bindings, and adding a second Python sidecar would expand packaging,
164
+
process lifecycle, and cross-language contracts without a clear need.
165
+
- Expose a raw ONNX provider endpoint as the supported external app contract:
166
+
rejected because Pumas owns aliases, served state, future auth policy, and the
167
+
existing `/v1` facade.
165
168
- Copy the Torch sidecar integration path as-is: rejected because Torch is app
166
-
specific and does not provide the runtime-profile provider contract, bounded
167
-
ONNX inference queue, or ONNX shutdown semantics required here.
169
+
specific and does not provide the runtime-profile provider contract or Rust
170
+
ONNX session lifecycle required here.
168
171
169
172
## Invariants
170
173
@@ -176,8 +179,8 @@ targets include:
176
179
- Gateway endpoint capability checks happen before proxying.
177
180
- Generic ONNX embedding compatibility remains separate from custom ONNX app
178
181
metadata.
179
-
- ONNX dependencies remain sidecar-local unless another owner demonstrably
180
-
executes them.
182
+
- ONNX dependencies remain owned by the Rust crate/module that executes ONNX
0 commit comments