Repository navigation
Description
Describe the bug
Kagenti's OpenShell version seems to block traffic within the cluster (see #1647)
At some point, OpenShell changed the meaning of network_policies.<name>.endpoints[].port. Internally, there is a ports (plural), and OpenShell provides some legacy support to promote the old port: <int> to ports: [<int>].
If I submit a policy using ports with openshell sandbox create it should be preserved, but openshell sandbox get <sandbox> --policy-only does not show the list.
Steps To Reproduce
- Create a configuration normalized-example-policy-data.yaml:
version: 1
filesystem_policy:
include_workdir: true
read_only:
- /usr
- /lib
- /lib64
- /etc
- /home
- /bin
- /sbin
read_write:
- /tmp
- /app
- /root
- /var/log
process:
run_as_user: ""
run_as_group: ""
network_policies:
internal:
name: "Allow OpenTelemetry cluster services"
endpoints:
# Kagenti OpenTelemetry Collector
- host: otel-collector.kagenti-system
ports: [8335]
# Kagenti OpenTelemetry Collector
- host: otel-collector.kagenti-system.svc.cluster.local
ports: [8335]
binaries:
- path: /usr/bin/curl
- path: /**- Deploy a sandbox:
target/release/openshell sandbox create \
--policy ~/junk/ecs-normalized-example-policy-data.yaml \
--name try-otel -- bash- Check that the sandbox appears correctly:
openshell sandbox get try-otel --policy-onlyNote that the output sandbox doesn't see ports: [8335], it sees port: 8335.
Expected Behavior
The policy that appears should like like the one that was supplied
Additional Context
ports is a list, not an integer, and sandbox-policy.rego#L100 only if endpoint.ports[_] == network.port.
With our policies, when I deploy a sandbox traffic to the OpenTelemetry collector is blocked, even if I explicitly enable it:
curl -v -X POST -H "Content-Type: application/json" "http://otel-collector.kagenti-system.svc.cluster.local/v1/traces" --data '=== TRACES ==='
{"detail":"POST otel-collector.kagenti-system.svc.cluster.local:80/v1/traces not permitted by policy","error":"policy_denied"}
Debugging policies is usually done interactively with regorus, e.g.:
regorus eval \
-d crates/openshell-sandbox/data/sandbox-policy.rego \
-d ecs-normalized-example-policy-data.yaml \
-i ecs-example-opa-input.yaml \
'data.openshell.sandbox.allow_network'
(It is very difficult to debug policies, especially when OpenShell components are "normalizing" the YAML).
cc @Ladas
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
esnible commentedon May 26, 2026
Note that Claude believes the
openshellCLI callsGetSandboxConfig(sandbox_id=<uuid>)(run.rs:2186). This is the same RPC the supervisor makes inside the sandbox pod at startup.Thus, it seems that the sandbox really believes that
network_policies.<policy-name>.endpoints[].port:is in the sameport: <int>, which could explain the difficult with rego policies that seem to assume we haveports: <list of int>.esnible commentedon May 26, 2026
Note that
shows the actual shape of the policy, and it does have both
portandports, unlike the CLI:Ladas commentedon May 27, 2026
Confirmed — our agent policy files in PR #1498 use
port: 8080(singular), which maps to the legacy path. The rego evaluator checksendpoint.ports[_](plural list). The normalization fromport→portsmay silently fail or produceport: 0entries.Our affected files:
deployments/openshell/agents/claude-sdk-agent/policy-data.yamldeployments/openshell/agents/adk-agent-supervised/policy-data.yamldeployments/openshell/agents/weather-agent-supervised/policy-data.yamlAll use
port: <int>(singular). Should beports: [<int>]once the normalization bug is fixed upstream.This is a different issue from #1581 (Service creation race). Same symptom (in-cluster connectivity broken) but different root cause (OPA policy matching vs. K8s RBAC).
esnible commentedon May 27, 2026
@Ladas , I agree the analysis. However, using
ports: [<int>]doesn't actually work either! Do you recall if this ever worked in the past? If so, I will usegit bisectto see what caused it to fail. If not, I will continue diagnosing.Ladas commentedon May 27, 2026
Checked upstream NVIDIA/OpenShell proto — the
ports(plural) field exists at field 9 inNetworkEndpoint. The proto comments say: "If port is set and ports is empty, port is normalized to ports: [port]."The proto definition is correct, but the bug #1669 reports is in the gateway's response normalization — when you
GETthe sandbox policy back, it showsport(singular) instead of the submittedportslist. This is a display/serialization issue in the gateway, not the proto.ai-openshell/openshell#359 (closed Mar 16) added wildcard + multi-port support. Our fork at v0.0.36-kagenti.8 should include this, but the gateway normalization behavior may still strip
ports→portin responses. Filed upgrade tracking at kagenti/openshell (issues disabled there, tracking here: #1695).docs(research): OpenShell fork analysis — patches, drivers, upgrade path
feat(openshell): upgrade to mvp-v2 branch (upstream v0.0.49+)
docs(research): OpenShell fork analysis — patches, drivers, upgrade path
feat(openshell): upgrade to mvp-v2 branch (upstream v0.0.49+)
docs(research): OpenShell fork analysis — patches, drivers, upgrade path
feat(openshell): upgrade to mvp-v2 branch (upstream v0.0.49+)
pdettori commentedon Jul 16, 2026
closing for now - upstream openshell is evolving rapidly and we are putting this work on the back burner until openshell stabilizes more.