Phase 1 slice 6: Route inference configuration through the OpenShell adapter
- Dominant language
- TypeScript
- Stars
- 22.5k
- Forks
- 3.1k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 715
Description
> [!WARNING]
> This issue has a refined plan but no product-scope acceptance record. It should only be implemented by `@rsliter` after a maintainer records `Decision: Accept`.
Parent Epic: #9802
## Outcome
Route OpenShell inference configuration reads and updates through NemoClaw’s typed, asynchronous OpenShell interface without changing supported behavior.
## Scope authority and ownership
- **Confirmed scope authority:** Not confirmed. This issue still requires an explicit `Decision: Accept` with reason, placement, accountable maintainer, and validation plan.
- **Assigned implementation owner:** `@rsliter`.
- **Typed interface and CLI implementation:** `src/lib/adapters/openshell/`.
- **Current route-read owner:** `src/lib/inference/live.ts`, `src/lib/inference/config.ts`, and `src/lib/inference/gateway/command-args.ts`.
- **Current route-update owners:** `src/lib/actions/inference-set.ts`, `src/lib/onboard/inference-providers/remote.ts`, and `src/lib/actions/sandbox/connect.ts`.
## Dependencies and related work
- Slice 1, #9803, merged through #10574.
- Slice 5, #9806, completed through #10149, #10895, #11009, #11008, #11224, #11234, #11246, and #11488.
- #10724 closed without merging. #11008 replaced it and explicitly deferred inference route transport to this issue.
- #9813 owns the plugin runner and final executable-consumer sweep.
- #9828 owns the later generated gRPC implementation.
- Before a read-only partial delivery merges, the partial-delivery policy in #9802 requires an accepted, assigned follow-on issue for route mutations.
## First capability slice: Typed inference route observation
### Outcome
Add one typed route-read contract and CLI implementation. Migrate every in-scope `src/` consumer so command construction, gateway fallback, ANSI removal, output parsing, timeout handling, and error mapping remain private to the CLI implementation.
The consumers include inference commands, onboarding route checks, provider recovery, connect, launch readiness including NemoCUA, status, doctor, list, and configuration export.
### Acceptance evidence
- Configured and unconfigured routes return typed results.
- Named gateway reads remain scoped to that gateway.
- A named non-default gateway never falls back to an unscoped read.
- Partial, malformed, authentication, timeout, and transport results remain distinct.
- No migrated consumer inspects argv, exit status, stdout, or stderr.
### Shortest tests
- Add a co-located CLI adapter test for exact argv, parsing, timeout, and error mapping.
- Convert existing consumer tests to use a typed route fake.
- Keep the existing inference-get, onboarding-route, provider-recovery, connect, launch-readiness, status, doctor, list, and configuration-export behavior tests.
- Run focused CLI tests and `npm run test:changed`.
### Deferred scope
- Route mutations and rollback, in an accepted and assigned follow-on issue.
- Plugin runner migration, under #9813.
- Generated gRPC implementation, under #9828.
- Provider credential lifecycle, gateway lifecycle, inference health probes, validation requests, and new routing semantics.
## Acceptance criteria
### 1. Consumers read typed routes
- **Observable behavior:** A configured or unconfigured live route becomes a typed result. Consumers never parse CLI output.
- **Current owner:** `src/lib/inference/live.ts` and its production consumers.
- **Positive test:** Configured CLI output returns the expected provider and model through the typed fake.
- **Negative test:** Partial or malformed output returns a schema error. A named non-default gateway never triggers an unscoped fallback.
- **Evidence timing:** Deterministic tests before merge; repeat the production-consumer inventory after merge before deleting obsolete helpers.
- **Dependencies and related PRs:** #9803/#10574 and #9806.
- **Exclusions:** Plugin runner and gRPC transport.
- **Stop and ask:** A consumer needs raw output as user-visible behavior or requires a new executable-level exception.
### 2. Valid updates preserve verification
- **Observable behavior:** A valid provider and model update preserves named-gateway targeting, current verification, `--no-verify`, timeout, rollback, and state-publication decisions.
- **Current owner:** `src/lib/actions/inference-set.ts`, `src/lib/onboard/inference-providers/remote.ts`, `src/lib/actions/sandbox/connect.ts`, and their recovery helpers.
- **Positive test:** The CLI implementation receives the expected gateway, provider, model, timeout, and verification intent; the action publishes state after verified success.
- **Negative test:** Reuse the tests that do not write sandbox state after `inference set` fails and restore the prior route after convergence fails.
- **Evidence timing:** Deterministic tests before merge; existing `inference-routing`, `openclaw-inference-switch`, and `hermes-inference-switch` live E2E during the mutation delivery.
- **Dependencies and related PRs:** #9806 and #11008.
- **Exclusions:** New providers, models, API families, or verification semantics.
- **Stop and ask:** Preserving current verification requires a product behavior change.
### 3. Failures remain distinct
- **Observable behavior:** Missing provider, invalid route, authentication, transport, timeout, and verification or schema failures return distinct typed results.
- **Current owner:** `src/lib/inference/live.ts`, `src/lib/actions/inference-set-error.ts`, onboarding failure classification, and the future CLI adapter.
- **Positive test:** A table maps each trusted CLI result shape to one typed error.
- **Negative test:** Unknown output remains generic and redacted. It cannot masquerade as a known failure.
- **Evidence timing:** Deterministic tests before merge; existing TC-INF-06 and TC-INF-07 during live E2E.
- **Dependencies and related PRs:** #9806’s provider error contract.
- **Exclusions:** New provider diagnostics or classifications unsupported by current evidence.
- **Stop and ask:** CLI evidence cannot support a distinction without parsing ambiguous text or guessing.
### 4. Failed or ambiguous mutations remain safe
- **Observable behavior:** A timed-out or connection-lost update does not become success and is not retried automatically. Recovery rereads the same named gateway before any later mutation.
- **Current owner:** Inference set, onboarding retry policy, connect recovery, and the future mutation adapter.
- **Positive test:** Verified success performs one mutation and publishes state once.
- **Negative test:** Null status, timeout, or connection loss performs one mutation call, publishes no state, and requires an exact-gateway reread.
- **Evidence timing:** Deterministic tests before merge. Do not manufacture a live ambiguous mutation.
- **Dependencies and related PRs:** The accepted mutation follow-on and #11008.
- **Exclusions:** Automatic cross-transport fallback and speculative rollback.
- **Stop and ask:** Any retry or rollback policy cannot prove whether the remote mutation took effect.
## Sensitive workflow and security boundaries
- A successful read returns configured or unconfigured. Command, transport, and malformed-output failures return typed errors and stop.
- A successful update publishes state only after current verification. A definite failure follows current rollback rules.
- A timeout or lost transport assumes a possible remote write. It does not trigger an automatic retry.
- A failed rollback reports possible split state and stops.
- Provider credentials remain in OpenShell gateway custody under #9806. Route requests contain no provider credential values.
- Existing OpenShell authentication material remains scoped to the `openshell` child-process environment and its process lifetime.
- The CLI implementation must reject competing gateway endpoint overrides, validate provider and model input, bound and redact output, preserve route locks and publication order, and keep raw process results private.
## Known failure classification
- **Candidate-owned:** None. No candidate PR exists for this issue.
- **Inherited:** Current production consumers construct route argv or parse raw CLI output.
- **Environmental:** Historical #11008 local-review and Advisor failures caused by missing tooling, HTTP 429/403 responses, and timeouts.
- **Dependency-blocked:** The former #9803 and #9806 blockers are resolved. Product-scope acceptance and an assigned mutation follow-on remain decision blockers.
## Delivery order and stop conditions
1. Record an accepted product-scope decision.
2. Create and assign the route-mutation follow-on required by #9802.
3. Deliver typed route observation and migrate all in-scope `src/` readers.
4. Deliver typed route mutation and rollback through the follow-on.
5. Leave plugin migration to #9813 and gRPC migration to #9828.
Stop and ask before implementation if scope remains unaccepted, the mutation follow-on is absent, a behavior change is required, an ambiguous mutation would be retried, or a production consumer needs a new executable-level exception.
Contributor guide
Assessment
This issue has not been assessed yet.