Skip to content

fix(ai): route the Jev Decisions API through the gateway - #4300

Merged
dan-petty merged 3 commits into
mainfrom
fix/4289-gateway-route-for-jev-decisions
Nov 10, 2026
Merged

dan-petty merged 3 commits into
mainfrom
fix/4289-gateway-route-for-jev-decisions

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The gateway had no route for the System One protocol that SystemOneModel posts (HTTP 404), and its chat entry for typesafe/jev-1.14 is refused by OpenRouter (HTTP 400). A LiteLLM pass-through now sends POST /v1/systemone to the System One endpoint of OpenRouter, with the gateway key checked and the OpenRouter key of the gateway. The chat entry is removed. The client code is unchanged: its body already matches. A test fails when the client path and the pass-through differ. Prompts to Jev leave the cluster; the privacy setting of the OpenRouter account applies.

Closes #4289

Change: openspec/changes/archive/2026-11-10-4289-the-gateway-has-no-route-for/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/ai AI review pipeline, personas, prompts, LLM client, or RAG labels Nov 10, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results

  • Fail-to-pass (devops ci fail-to-pass --base origin/main): the new tests test_the_gateway_forwards_the_path_of_the_client_to_openrouter_with_its_own_key and test_the_gateway_lists_no_chat_route_for_the_decision_model fail on the base and pass on the branch.
  • Full devops ci in the worktree (run under the CI lock): 22,022 tests passed. All other gates passed (ruff, mypy, bandit, docs, k8s, openspec, and the rest). 5 tests failed and 4 errored, all in tests/commands/test_scan.py (host tools gitleaks, trivy and semgrep reached without a fake in this container). They do not touch this change. One more failure, tests/ai/test_k8s_gpu_matrix.py::test_rendered_gateway_config_matches_ollama_profiles (a count of 17 groups), was mine and is fixed in the second commit.
  • Offline proof of the pass-through: LiteLLM 1.103.0 ran with this pass_through_endpoints entry, with a local test server as the target and fake keys. A call with the gateway key reached /api/v1/systemone with the body unchanged and the OpenRouter key in Authorization. A call with no key or a wrong key was not forwarded. A GET answered 405.

Live check after the merge

Run it when Argo CD has rolled the gateway ConfigMap and the gateway pod has restarted (the ConfigMap is read at start). It sends one Jev request with one tiny Noul question (about 0.00002 USD). It needs the gateway key in the keyring and ai.gateway_url set; with a port-forward, set ai.gateway_url to the forwarded address with /v1.

uv run python - <<'PY'
from pydantic_ai.models.decision import DecisionRequest, NoulQuestion
from devops_cli.ai.jev import _run_decide, create_jev_model
from devops_cli.config.settings import load_settings

settings = load_settings()
settings.ai.provider = "gateway"
reply = _run_decide(
    create_jev_model(settings=settings),
    DecisionRequest(state="The page is blank after Pay.", questions={"is_bug": NoulQuestion(instructions="Is this a software defect?")}),
)
print(reply.model_name, reply.answers["is_bug"], reply.usage)
PY

Expected: a model name that starts with typesafe/jev-1.14, a NoulAnswer with a noul value near 0.9, and token counts above 0. Before this change the call failed with HTTP 404.

The same check with curl (use the gateway key in $KEY):

curl -sS -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d '{"model":"typesafe/jev-1.14","state":"The page is blank after Pay.","questions":{"is_bug":{"type":"noul","instructions":"Is this a software defect?"}}}' http://<node>:<node-port>/v1/systemone

Not verified

  • A real answer of OpenRouter to POST /api/v1/systemone. I did not read or use the OpenRouter key. An unauthenticated POST to both OpenRouter paths gave HTTP 401, so the paths exist.
  • Whether /api/v1/systemone accepts provider.data_collection. The pass-through cannot add it, so the privacy setting of the OpenRouter account applies.
  • The cost of Jev calls is not in the gateway spend ledger: filed as feat(ai): record the cost of Jev calls that pass through the gateway #4296.

The gateway had no route for the System One protocol that SystemOneModel posts, and its chat entry for typesafe/jev-1.14 was refused by OpenRouter with HTTP 400. A LiteLLM pass-through now forwards POST /v1/systemone to the System One endpoint of OpenRouter, with the OpenRouter key of the gateway. The chat entry is removed.
@dan-petty
dan-petty force-pushed the fix/4289-gateway-route-for-jev-decisions branch from 3313abb to b133feb Compare November 10, 2026 00:14
@dan-petty
dan-petty marked this pull request as ready for review November 10, 2026 00:29
@dan-petty
dan-petty merged commit 4e5adb9 into main Nov 10, 2026
26 checks passed
@dan-petty
dan-petty deleted the fix/4289-gateway-route-for-jev-decisions branch November 10, 2026 00:30
dan-petty pushed a commit that referenced this pull request Nov 10, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.103.2](v0.103.1...v0.103.2)
(2026-11-10)


### Bug Fixes

* **ai:** route the Jev Decisions API through the gateway
([#4300](#4300))
([4e5adb9](4e5adb9))
* **k8s:** move the mattermost database off the control plane
([#4304](#4304))
([7029757](7029757))


### Performance Improvements

* **review:** run Gitleaks once per review instead of per file
([#4295](#4295))
([2acb9f9](2acb9f9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ai AI review pipeline, personas, prompts, LLM client, or RAG type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ai): the gateway has no route for the Jev Decisions API

1 participant