Repository navigation
fix: add retry logic for flaky LLM responses and grant anyuid SCC for agent sidecars - #933
Conversation
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
ChristianZaccaria
left a comment
There was a problem hiding this comment.
I tested this on OpenShift 4.21.2. When deploying the weather service (Deployment), I got the following error message:
pods "weather-service-7f5d9c4988-" is forbidden: unable to validate against any security context constraint: [provider "openshift-ai-llminferenceservice-multi-node-scc": Forbidden: not usable by user or serviceaccount, provider "openshift-ai-llminferenceservice-scc": Forbidden: not usable by user or serviceaccount, provider anyuid: .initContainers[0].privileged: Invalid value: true: Privileged containers are not allowed, provider "pipelines-scc": Forbidden: not usable by user or serviceaccount, provider restricted-v2: .initContainers[0].runAsUser: Invalid value: 0: must be in the ranges: [1001160000, 1001169999], provider restricted-v2: .initContainers[0].privileged: Invalid value: true: Privileged containers are not allowed, provider restricted-v2: .containers[1].runAsUser: Invalid value: 1337: must be in the ranges: [1001160000, 1001169999], provider restricted-v2: .containers[2].runAsUser: Invalid value: 1000: must be in the ranges: [1001160000, 1001169999], provider restricted-v2: .containers[3].runAsUser: Invalid value: 1000: must be in the ranges: [1001160000, 1001169999], provider restricted-v3: .spec.securityContext.hostUsers: Invalid value: null: Host Users must be set to false, provider restricted-v3: .initContainers[0].runAsUser: Invalid value: 0: must be in the ranges: [1000, 65534], provider restricted-v3: .initContainers[0].privileged: Invalid value: true: Privileged containers are not allowed, provider "restricted": Forbidden: not usable by user or serviceaccount, provider "nested-container": Forbidden: not usable by user or serviceaccount, provider "nonroot-v2": Forbidden: not usable by user or serviceaccount, provider "nonroot": Forbidden: not usable by user or serviceaccount, provider "pcap-dedicated-admins": Forbidden: not usable by user or serviceaccount, provider "hostmount-anyuid": Forbidden: not usable by user or serviceaccount, provider "hostmount-anyuid-v2": Forbidden: not usable by user or serviceaccount, provider "hostnetwork-v2": Forbidden: not usable by user or serviceaccount, provider "hostnetwork": Forbidden: not usable by user or serviceaccount, provider "hostaccess": Forbidden: not usable by user or serviceaccount, provider "nfd-worker": Forbidden: not usable by user or serviceaccount, provider "nfd-topology-updater": Forbidden: not usable by user or serviceaccount, provider "spire-spiffe-csi-driver": Forbidden: not usable by user or serviceaccount, provider "insights-runtime-extractor-scc": Forbidden: not usable by user or serviceaccount, provider "nvidia-driver": Forbidden: not usable by user or serviceaccount, provider "nvidia-gpu-feature-discovery": Forbidden: not usable by user or serviceaccount, provider "nvidia-mig-manager": Forbidden: not usable by user or serviceaccount, provider "nvidia-node-status-exporter": Forbidden: not usable by user or serviceaccount, provider "nvidia-operator-validator": Forbidden: not usable by user or serviceaccount, provider "nvidia-dcgm-exporter": Forbidden: not usable by user or serviceaccount, provider "spire-agent": Forbidden: not usable by user or serviceaccount, provider "node-exporter": Forbidden: not usable by user or serviceaccount, provider "nvidia-dcgm": Forbidden: not usable by user or serviceaccount, provider "privileged": Forbidden: not usable by user or serviceaccount]
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
The weather agent E2E tests (test_agent_simple_query, test_agent_multiturn_conversation) fail intermittently when the LLM returns empty/null content. The agent completes the task but with no response artifacts, causing assertion failures. Add retry logic (up to 3 attempts with 5s delay) when the agent returns an empty response. Extract the response collection into a shared helper _send_and_collect_response() to reduce duplication between both tests. Failed task responses (TaskState.failed) still fail immediately without retry, as those indicate a real agent-side error. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
The operator creates agent SAs dynamically (name = agent name), but only the pipeline and default SAs had SCC grants. Operator-injected sidecars (spiffe-helper, client-registration) need UIDs outside the restricted SCC range, causing pod creation failures on OpenShift. Add an anyuid SCC RoleBinding for all service accounts in agent namespaces using the system:serviceaccounts:<namespace> group subject. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
On HyperShift/OpenShift, page.goto triggers a Keycloak OAuth redirect that adds 5-15s latency before page content renders. The default 5s assertion timeout and 30s test timeout are insufficient. - Set test timeout to 60s on CI (was 30s default) - Set expect timeout to 15s on CI (was 5s default) Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
The RHOAI installer had a bare 120s timeout with no retries for istiod rollout, while the main installer uses 300s + 3 retries. This caused flaky CI failures when istiod pods were slow to terminate during the shared CA restart. Match the main installer's resilience pattern: 300s timeout, 3 retries with 30s delay. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
eea507d to
6e5bb46
Compare
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
The HyperShift CI was running all Playwright UI tests including @Extended ones, which fail because they require specific backend state or test error/empty states via API mocking that doesn't work reliably on a live cluster. Kind CI already excludes these via PLAYWRIGHT_GREP_INVERT. Align HyperShift with Kind by excluding @Extended tests. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
Set PLAYWRIGHT_GREP_INVERT to @Extended by default in the UI test script. The @Extended tests require specific mock/state setup that doesn't work reliably against a live cluster. Workflows can override by setting the env var explicitly. This fixes HyperShift E2E failures where all 19 @Extended tests fail because they test error/empty UI states via API mocking. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
|
/run-e2e |
E2E HyperShift Tests PassedCommit: The If you push new commits, the label will be removed and you'll need to comment |
The weather-tool-mcp pod may still be initializing when E2E tests start, causing "Cannot connect to MCP weather service" task failures. Extend the existing retry logic to also retry when the agent returns a failed task with "Cannot connect" in the error message, with the same 3 attempts / 5s delay used for empty LLM responses. Signed-off-by: Ladislav Smola <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
|
/run-e2e --extensions-ref fix/proxy-init-drop-privileged |
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
E2E HyperShift Tests PassedCommit: The If you push new commits, the label will be removed and you'll need to comment |
…orward ## What broke PR rossoctl#933 merged the custom `kagenti-authbridge` SCC for OpenShift agent namespaces. This SCC is needed because the kagenti-webhook injects an AuthBridge sidecar stack into agent pods (proxy-init, envoy, spiffe-helper, client-registration) that requires specific UIDs and NET_ADMIN/NET_RAW capabilities. Shortly after, kagenti-extensions#242 and rossoctl#250 merged, which: 1. Replaced privileged mode with NET_ADMIN/NET_RAW capabilities in the webhook (good) 2. Started pushing :latest image tags on every merge to main (good) 3. But the :latest proxy-init image now requires POD_IP env var that the OLD webhook chart (v0.4.0-alpha.5) doesn't inject (broke CI) This created a version mismatch: the packaged webhook chart (v0.4.0-alpha.5) creates init containers WITHOUT the POD_IP env var, but pulls proxy-init:latest which now requires it. Result: proxy-init CrashLoopBackOff on every CI run. ## Why these fixes must be combined The fixes span SCC configuration, image builds, and deploy scripts because the root cause is a version mismatch between the packaged chart dependency and unreleased upstream fixes. Until kagenti-extensions releases a new chart version (>= v0.4.0-alpha.9), CI must build the webhook from source. ## Fixes **SCC (OpenShift):** - Custom `kagenti-authbridge` SCC: allows NET_ADMIN/NET_RAW + RunAsAny UID - Relaxed requiredDropCapabilities from ALL to MKNOD (sidecars don't specify drop:ALL, causing pod rejection) - Explicit ClusterRole (OpenShift doesn't auto-create for custom SCCs) **Dependency builds from source:** - Generic `30-build-dep-image.sh`: builds any dep from branch, tag, pr/<number>, or commit SHA - Registry `31-build-deps-from-refs.sh`: maps repos to build configs with allow list (kagenti-extensions, kagenti-operator) - Hardcoded default: builds kagenti-extensions@main on both Kind and HyperShift until the chart dependency is bumped - /run-e2e --build org/repo=ref for ad-hoc overrides (after merge) **Port-forward (Kind):** - Use kubectl wait for deployment readiness instead of kubectl exec (exec targets injected sidecar container, not the agent) ## After kagenti-extensions releases new chart Remove the hardcoded KAGENTI_DEP_BUILDS defaults from: - .github/scripts/hypershift/ci/70-deploy-kagenti.sh - .github/scripts/local-setup/kind-full-test.sh And bump Chart.yaml: kagenti-webhook-chart >= v0.4.0-alpha.9 Signed-off-by: Ladislav Smola <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
…orward ## What broke PR rossoctl#933 merged the custom `kagenti-authbridge` SCC for OpenShift agent namespaces. This SCC is needed because the kagenti-webhook injects an AuthBridge sidecar stack into agent pods (proxy-init, envoy, spiffe-helper, client-registration) that requires specific UIDs and NET_ADMIN/NET_RAW capabilities. Shortly after, kagenti-extensions#242 and rossoctl#250 merged, which: 1. Replaced privileged mode with NET_ADMIN/NET_RAW capabilities in the webhook (good) 2. Started pushing :latest image tags on every merge to main (good) 3. But the :latest proxy-init image now requires POD_IP env var that the OLD webhook chart (v0.4.0-alpha.5) doesn't inject (broke CI) This created a version mismatch: the packaged webhook chart (v0.4.0-alpha.5) creates init containers WITHOUT the POD_IP env var, but pulls proxy-init:latest which now requires it. Result: proxy-init CrashLoopBackOff on every CI run. ## Why these fixes must be combined The fixes span SCC configuration, image builds, and deploy scripts because the root cause is a version mismatch between the packaged chart dependency and unreleased upstream fixes. Until kagenti-extensions releases a new chart version (>= v0.4.0-alpha.9), CI must build the webhook from source. ## Fixes **SCC (OpenShift):** - Custom `kagenti-authbridge` SCC: allows NET_ADMIN/NET_RAW + RunAsAny UID - Relaxed requiredDropCapabilities from ALL to MKNOD (sidecars don't specify drop:ALL, causing pod rejection) - Explicit ClusterRole (OpenShift doesn't auto-create for custom SCCs) **Dependency builds from source:** - Generic `30-build-dep-image.sh`: builds any dep from branch, tag, pr/<number>, or commit SHA - Registry `31-build-deps-from-refs.sh`: maps repos to build configs with allow list (kagenti-extensions, kagenti-operator) - Hardcoded default: builds kagenti-extensions@main on both Kind and HyperShift until the chart dependency is bumped - /run-e2e --build org/repo=ref for ad-hoc overrides (after merge) **Port-forward (Kind):** - Use kubectl wait for deployment readiness instead of kubectl exec (exec targets injected sidecar container, not the agent) ## After kagenti-extensions releases new chart Remove the hardcoded KAGENTI_DEP_BUILDS defaults from: - .github/scripts/hypershift/ci/70-deploy-kagenti.sh - .github/scripts/local-setup/kind-full-test.sh And bump Chart.yaml: kagenti-webhook-chart >= v0.4.0-alpha.9 Signed-off-by: Ladislav Smola <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
PR rossoctl#933 introduced a command injection vulnerability that CodeQL missed (it only scans Python, not workflow YAML). Scorecard caught it post-merge but by then the vulnerability was on main. Changes: - Add actionlint as blocking PR check (detects expression injection in run: blocks, validates workflow syntax, reports inline via reviewdog) - Add pull_request trigger to Scorecard (runs Dangerous-Workflow analysis on PRs, disables OpenSSF API publishing since no OIDC on PR context) Both checks would have caught the injection in rossoctl#933 before merge. Signed-off-by: Ladislav Smola <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
…orward ## What broke PR rossoctl#933 merged the custom `kagenti-authbridge` SCC for OpenShift agent namespaces. This SCC is needed because the kagenti-webhook injects an AuthBridge sidecar stack into agent pods (proxy-init, envoy, spiffe-helper, client-registration) that requires specific UIDs and NET_ADMIN/NET_RAW capabilities. Shortly after, kagenti-extensions#242 and rossoctl#250 merged, which: 1. Replaced privileged mode with NET_ADMIN/NET_RAW capabilities in the webhook (good) 2. Started pushing :latest image tags on every merge to main (good) 3. But the :latest proxy-init image now requires POD_IP env var that the OLD webhook chart (v0.4.0-alpha.5) doesn't inject (broke CI) This created a version mismatch: the packaged webhook chart (v0.4.0-alpha.5) creates init containers WITHOUT the POD_IP env var, but pulls proxy-init:latest which now requires it. Result: proxy-init CrashLoopBackOff on every CI run. ## Why these fixes must be combined The fixes span SCC configuration, image builds, and deploy scripts because the root cause is a version mismatch between the packaged chart dependency and unreleased upstream fixes. Until kagenti-extensions releases a new chart version (>= v0.4.0-alpha.9), CI must build the webhook from source. ## Fixes **SCC (OpenShift):** - Custom `kagenti-authbridge` SCC: allows NET_ADMIN/NET_RAW + RunAsAny UID - Relaxed requiredDropCapabilities from ALL to MKNOD (sidecars don't specify drop:ALL, causing pod rejection) - Explicit ClusterRole (OpenShift doesn't auto-create for custom SCCs) **Dependency builds from source:** - Generic `30-build-dep-image.sh`: builds any dep from branch, tag, pr/<number>, or commit SHA - Registry `31-build-deps-from-refs.sh`: maps repos to build configs with allow list (kagenti-extensions, kagenti-operator) - Hardcoded default: builds kagenti-extensions@main on both Kind and HyperShift until the chart dependency is bumped - /run-e2e --build org/repo=ref for ad-hoc overrides (after merge) **Port-forward (Kind):** - Use kubectl wait for deployment readiness instead of kubectl exec (exec targets injected sidecar container, not the agent) ## After kagenti-extensions releases new chart Remove the hardcoded KAGENTI_DEP_BUILDS defaults from: - .github/scripts/hypershift/ci/70-deploy-kagenti.sh - .github/scripts/local-setup/kind-full-test.sh And bump Chart.yaml: kagenti-webhook-chart >= v0.4.0-alpha.9 Signed-off-by: Ladislav Smola <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
Summary
test_agent_simple_queryandtest_agent_multiturn_conversationwhen the agent returns an empty response_send_and_collect_response()helper to reduce duplicationTaskState.failed) still fail immediately — only empty responses are retriedanyuidSCC to all service accounts in agent namespaces on OpenShift, so operator-injected sidecars (spiffe-helper, client-registration) can run with UIDs outside the restricted SCC rangeRoot Cause
Empty LLM responses (E2E flakiness)
CI run #23017735524 failed because the weather agent returned
Task(final)with no artifacts. MLflow traces confirm the LLM was invoked (ChatOpenAI spans exist) but produced no output content. This is an intermittent LLM flakiness issue, not a code bug in the agent.The secondary MLflow
spanOutputsfailure is a consequence — no response means no output to record.SCC violation on OpenShift (sidecar injection)
The kagenti-controller-manager webhook injects sidecar containers (spiffe-helper, client-registration) into agent deployments. These sidecars run with UIDs outside OpenShift's
restrictedSCC range. Agent service accounts are created dynamically by the operator (SA name = agent name), but only thepipelineanddefaultSAs had SCC grants — agent SAs had none.Fix: Added an
agent-anyuid-sccRoleBinding incharts/kagenti/templates/agent-namespaces.yamlthat grantssystem:openshift:scc:anyuidto all service accounts in each agent namespace via thesystem:serviceaccounts:<namespace>group. Usesanyuid(notprivileged) for minimal privilege.Test plan
openshift=trueopenshift=true