Skip to content

Route all Agent model access through AI Gateway - #353

Merged
Pengfei Ni (feiskyer) merged 5 commits into
mainfrom
refactor/require-ai-gateway
Oct 30, 2026
Merged

Pengfei Ni (feiskyer) merged 5 commits into
mainfrom
refactor/require-ai-gateway

Conversation

@gossion

@gossion gossion commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Route all platform-provided model access through Agent → AI Gateway → Model for OpenClaw, Hermes, and approved Custom Agents. Remove direct-provider configuration, runtime provider credentials, and in-agent model sign-in. Agent creation uses the Gateway catalog and Portal-managed Copilot sign-in.

Preserve the common Sandbox execution and governed Custom model-source selection on main. Custom policy evaluation resolves its terminal configuration before Gateway key issuance; workload rendering still requires the authorized Gateway binding and the existing image approval. Suspension retains the Gateway accounting identity and blocks its key.

Related issue

Extracted from #350 according to the agreed Gateway-only scope. Team reassignment is outside this PR.

Compatibility and operational impact

  • A configured AI Gateway and a compatible runtime Chart are required for every harness. There is no platform direct-provider fallback.
  • Custom images use OPENAI_BASE_URL and OPENAI_API_KEY; their approved image configuration remains required.
  • Remove Team provider defaults, Custom agentManagedModel/gatewayImages, and the in-agent model sign-in API/status surface.
  • This is a development-project simplification: migration and compatibility with stored direct-provider settings are outside the supported scope.
  • Update Operator, Portal, runtime Charts, CRDs, examples, and documentation together. Model configuration through the Gateway does not prevent arbitrary outbound connections from user code.

Validation

Passed offline checks on the rebased implementation (Go 1.27.3, Node 24, controller-gen v0.21.0):

  • make lint, followed by make docs-check go-lint after the final controller changes.
  • make ci-test python-test through make check: 113 CI helper tests, 743 script tests (one existing skip), and 86 Python tests with 78 subtests passed.
  • npm --prefix app/cetirun-portal/web run build.
  • make -C app/cetirun-operator generate manifests check-crds; regeneration introduced no extra drift.
  • go -C app/cetirun-operator test ./internal/controller -run 'Test(CommonCustom|Custom|AIGateway|Gateway|Entra|NativeEntra|ConnectionsMCP)' -count=1 -timeout=10m (133.357s).
  • Focused Helm, Sandbox workload/policy, and runtime binding tests; git diff --check.

Isolated API-server checks passed with local Kubernetes 1.37 envtest assets:

go -C app/cetirun-operator test -tags=envtest ./internal/controller \
  -run '^(TestCommonCustom.*APIServer|TestNativeEntraCommonRuntimeAPIServer|TestNativeSandboxStartAPIServer|TestReconciledSandboxIngressMTLSAPIServer)$' \
  -count=1 -timeout=15m

The controller command passed in 191.096s. TestEntraIdentityBindingAPIServer also passed in the Helm package. These tests use isolated API servers and synthetic runtime/provider observations.

The remaining full Go/frontend suite from make check is still running; no full-suite pass is claimed yet. No live deployment, model-provider integration, or OpenClaw image build was performed during this rebase.

Checklist

  • The change is focused and preserves unrelated work.
  • Tests cover the changed behavior, or I explained why no new test is needed.
  • Documentation and examples match any public behavior changes.
  • Generated artifacts were updated from source, or none are affected.
  • Dependency changes include lockfiles, source attribution, and license information, or none are affected.
  • I checked the diff and attachments for secrets, private endpoints or identifiers, customer data, agent conversations, and internal information.
  • I followed the applicable CLA instructions, or asked a maintainer about an unclear check.
  • I identified checks that need credentials or a live environment and did not run them without authorization.

@gossion
gossion force-pushed the refactor/require-ai-gateway branch from 4c4a0d6 to 9a84980 Compare October 30, 2026 01:35
@gossion
gossion marked this pull request as ready for review October 30, 2026 01:36

@feiskyer Pengfei Ni (feiskyer) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@feiskyer
Pengfei Ni (feiskyer) merged commit db13cfd into main Oct 30, 2026
33 checks passed
@feiskyer
Pengfei Ni (feiskyer) deleted the refactor/require-ai-gateway branch October 30, 2026 05:48
Zhupku added a commit that referenced this pull request Nov 2, 2026
…re it writes (#397)

* Align the install, Sandbox and smart-routing docs with make deploy, decision-model Team routers and optional Teams

Since #364, make deploy DEPLOY_CONFIG=<environment.yaml> installs the
platform. The site still told readers to run the platform helper with DOMAIN
and VALUES_FILE, which now exits with an error, and to install Sandbox
admission without enforcement themselves, which make deploy refuses.

- Install CetiRun: make publish with the VS Code Server license acceptance,
  what must exist before the first make deploy (with the Gateway's Secrets),
  the environment file, make deploy-plan and make deploy.
- Policy-bound Teams: the admission certificate and administrators before the
  first run, then the registration, the peer labels, and a second make deploy
  that enables Sandbox execution.
- Smart routing: models in the environment file, with the auto router and the
  decision model that make deploy requires; a Team router named auto-team,
  because auto is the Gateway's; decision models for Team routers (#348);
  default_model_fallback, and a log query on routing_cause.
- Gateway chart README, teams.md and models.md: a jev router falls back to its
  default model, and the guard shortens its classifier requests (#348). make
  publish needs the license flag.
- first-instance.md: a Team is optional (#353), and the form's model switches,
  default model and Agent Identity switch.
- helm.md, scripts.md, infrastructure.md, and the platform README and values
  comments: make deploy instead of the earlier helper's variables.
- The site test now expects make deploy on the installation page, and no
  VALUES_FILE invocation.

* Say that LiteLLM's spend log keeps prompts and responses by default

Since #363, spendLogs.storePrompts defaults to true, so each row of
LiteLLM_SpendLogs holds the call's prompt and response. The Helm reference
and the platform values comment still said that neither is stored. The
stdout request log still carries no content.

* Name a wrong managed Istio Deployment or mesh ConfigMap before make deploy writes

AKS managed Istio adds the revision to the name of the ingress gateway
Deployment, but the example environment file had the name without it. The
preflight then failed at kubectl rollout status, and the helper withholds
tool output, so the run only said "kubectl --context failed with exit 1".

The preflight now makes sure that the configured control plane and ingress
Deployments exist before it waits for them. If one does not exist, it names
the input, and the name with the revision when that Deployment exists. It
does not replace a configured name.

A mesh ConfigMap that does not exist is created by the helper. AKS managed
Istio reads only istio-shared-configmap-<revision>, so a different name left
the OAuth2 provider out of the mesh without an error. The preflight now stops
when the configured ConfigMap does not exist but that one does.

* Give the example's ingress Deployment its revision, and say how to read the AKS Istio names

The example named the control plane Deployment and the mesh ConfigMap with
the revision placeholder, but not the ingress gateway Deployment. Install
CetiRun and the platform README now say which managed Istio names carry the
revision, how to read them from the cluster, and when make deploy stops.

---------

Co-authored-by: Scott Zhu <mengzezhu@microsoft.com>
Zhupku pushed a commit that referenced this pull request Nov 2, 2026
The README still said that Custom images need an explicit model-access
mode, which was the agentManagedModel field that #353 removed. Say instead
that each approved image uses the AI Gateway binding.
Zhupku added a commit that referenced this pull request Nov 3, 2026
…umentation gaps (#409)

* Stop make deploy writing Custom runtime fields that the Operator refuses

#353 removed agentManagedModel and gatewayImages from the Operator's
strictly parsed CETIRUN_CUSTOM_RUNTIME. make deploy still required both,
and the example environment file still set them, so every make deploy
rendered a configuration that stops the Operator at startup.

configuration() now refuses a customRuntime field that the Operator chart
does not define, before it runs a tool, and no longer reads the two
removed fields. The example no longer sets them.

New tests cover the refusal, the Operator chart's customRuntime fields
against the Operator's parser, and the rendered CETIRUN_CUSTOM_RUNTIME
against the parser. The last test fails on the previous code.

* Name the failed step in make deploy errors

A failed tool call printed only the first two words of its command, for
example "kubectl --context failed with exit 1", so the error did not say
which step stopped. Errors now name the tool, its operands and the
namespace, name, timeout, version and dry-run options, for example
"kubectl rollout status deployment/cetirun-operator --namespace
cetirun-system --timeout=600s failed with exit 1".

Tool output stays withheld because it can hold rendered Secrets. The
kube context and option values that are templates or local files are
left out. The script passes Secret values only through values files and
standard input, never as command arguments.

* Stop the platform README asking for a Custom model-access mode

The README still said that Custom images need an explicit model-access
mode, which was the agentManagedModel field that #353 removed. Say instead
that each approved image uses the AI Gateway binding.

* Accept only the priced Microsoft-Decision-1 base model in make deploy

make deploy accepted model_info.base_model Microsoft-Decision-1 without
the azure_ai/ prefix, and the example environment file used that form.
LiteLLM's price table has the model only as azure_ai/Microsoft-Decision-1.
Without the prefix, LiteLLM finds no provider for the name, so the Gateway
lists decision-1 without a price. With the default blockUnpricedModels,
the Operator does not offer an unpriced model, and the auto router, whose
classifier is decision-1, is misconfigured for every Agent. make deploy
still reports success because it makes no model call.

make deploy now accepts only azure_ai/Microsoft-Decision-1 and says why.
The example and the platform README use that form. The tests reject the
form without the prefix.

* Refuse a jev router whose decision model is not configured in models

The chart already refused a router tier, default model or llm classifier
that is not in models. It did not check jev_classifier_config.deployment_name.
LiteLLM accepts any name there, and with the chart's classifier_fallback
default_model a wrong name sends every request quietly to the default model.

The chart now refuses a jev router without a deployment name, or with one
that is not a configured model or is itself a router. The helm test covers
the three cases, and its jev fixtures name a configured model.

* Show the chart's own refusal when make deploy renders offline

A chart that refuses its values, for example a router tier that is not in
models, failed the offline render with only "helm template ... failed with
exit 1". The render runs without a cluster or registry, and a chart refusal
names value fields, not Secret material. make deploy-plan and make deploy
now add each "execution error at (template): message" line of that render
to the error. Output of other commands and other render errors stay
withheld.

* Fill the AI Gateway gaps in the install, configuration and Agent docs

Install with make deploy (platform.md, platform README, helm.md):
- The Microsoft-Decision-1 deployment is a prerequisite, with where to find
  its endpoint and key; the provider-key names match the models.
- Secrets in the platform namespace and context, and without shell history.
- The database volume, prompt storage in the spend log, and which direct
  chart options make deploy refuses.
- A Gateway check after the installation: the model list and a call to auto.
- A Team is optional for a new Agent.

Standalone Gateway (chart README):
- Prerequisites: a StorageClass for the database, image pull, namespace.
- The call example uses a model of the minimal values and sets CLIENT_KEY,
  with a key alias; exposure needs TLS.
- How to supply your own master key, salt key, console and Valkey passwords.
- Fallback targets without operatorIntegration, managed Redis without TLS,
  the router example's models, and four mangled characters.

Policies, routers and Agents (crds.md, models.md, policy-teams.md,
first-instance.md, smart-routing.md, Portal, CRD comment):
- An AgentPolicy modelAccess table, the Copilot switch, and what happens when
  a budget runs out.
- The GitHub limit of ten Copilot tokens for each account.
- A policy-bound Agent manifest that requests its models, and the condition
  when its default model is not allowed.
- The two health causes of a router, and Team status fields.
- The Portal's Team router hint and the Team CRD suggest auto-team, not
  auto, which make deploy installs as a shared model.

* Correct what the master key sees in the Gateway check, and two details

The guard hides decision models only from keys that the operator issued, so
the master key does list decision-1. A router in a Policy also needs its
context compaction model, and Azure Cache for Redis accepts plain
connections when they are turned on.

---------

Co-authored-by: Scott Zhu <mengzezhu@microsoft.com>
Pengfei Ni (feiskyer) pushed a commit that referenced this pull request Nov 18, 2026
… the AI Gateway packages by hash (#626)

* Keep only the refusal of the removed LiteLLM sidecar in the agent chart schema

#353 made the litellm entry refuse every value. Its 106 lines of
properties (the sidecar image v1.82.3-stable, a model, provider
secrets, and more) described a sidecar that no template renders, and
editors that read the schema still offered them. The entry keeps its
type, its message, and the refusal. A render test checks that a
litellm value is still refused.

* Pin the AI Gateway's Python packages by hash

requirements.txt pinned 205 packages by version only, so pip accepted
any file that the index served for a pinned version. Each pin now lists
the sha256 hashes of all files that PyPI has for that version, and the
image build installs with --require-hashes. For the 192 versions from
LiteLLM v1.108.3's uv.lock, the lockfile's hashes are among them.

The advisory comment of ddtrace moves to its own line above the pin,
and the oauthlib test reads a pin that a list of hashes follows.

* Restore the historical litellm schema in the pre-proxy test fixture

The operator's pre-proxy fixture rebuilds a historical agent chart from
the current one and checks it against the original checksum. Its
litellm replacement changed only the header of the tombstone and kept
its properties, which were the historical ones. With the properties gone
from the schema, the replacement restores the whole historical block.

---------

Co-authored-by: Scott Zhu <mengzezhu@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants