Skip to content

fix(test): retry agent conversation on LLM connection errors - #1596

Merged
pdettori merged 14 commits into
mainfrom
fix/hypershift-ci-stability
May 27, 2026
Merged

pdettori merged 14 commits into
mainfrom
fix/hypershift-ci-stability

Conversation

@Ladas

@Ladas Ladas commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

The weather agent returns "LLM execution failed: Connection error" when the external MaaS endpoint (litellm-prod.apps.maas.redhatworkshops.io) is transiently unreachable from ephemeral HyperShift clusters.

The test already has retry logic for transient errors but the exact string "Connection error" (from openai.APIConnectionError) wasn't in the retry list — only "Cannot connect" was.

  • Add "Connection error" to _TRANSIENT_ERRORS in test_agent_simple_query
  • Add "Connection error" to the retry check in test_agent_multiturn_conversation

Root Cause

PR #1527's green HyperShift run had these tests passing. Subsequent main branch runs fail because the ephemeral cluster intermittently can't reach the external MaaS LLM endpoint. The agent correctly reports the connection failure, but the test treats it as a hard failure instead of retrying.

Test plan

  • /run-e2e — HyperShift E2E passes with LLM retry on connection errors

🤖 Generated with Claude Code

The weather agent returns "LLM execution failed: Connection error"
when the external MaaS endpoint is transiently unreachable from
ephemeral HyperShift clusters. Add "Connection error" to the
transient error retry list in both simple and multiturn tests.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@Ladas

Ladas commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label May 17, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 9bf6e6fa4e5a794e04bb9d6c539adc2880665798
Workflow Run: View logs

Tests are running on OpenShift 4.20.21. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: 9bf6e6fa4e5a794e04bb9d6c539adc2880665798
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

After exhausting all retry attempts on transient LLM errors
(Connection error, Cannot connect), skip the test instead of failing.
Ephemeral HyperShift clusters may not have egress to external MaaS
endpoints.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@Ladas

Ladas commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label May 18, 2026
@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 717c610

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label May 18, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 717c61066352a872d0cd9e6953691cabe6adab9c
Workflow Run: View logs

Tests are running on OpenShift 4.20.21. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: 717c61066352a872d0cd9e6953691cabe6adab9c
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

56-enable-spiffe.sh constructed a separate https://keycloak.localtest.me
URL for OIDC discovery, but on CI the Kind ingress isn't reachable on
port 443 from the runner. Use KC_URL (from get_keycloak_url) which
returns the port-forward URL on Kind.

This has been causing Kind CI on main to fail for 30+ consecutive runs
since the token exchange tests were integrated.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label May 18, 2026
@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 14a3f98

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@Ladas

Ladas commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label May 18, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 14a3f98981327467382004a0f31b5e6e48f074fa
Workflow Run: View logs

Tests are running on OpenShift 4.20.21. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Passed

Commit: 14a3f98981327467382004a0f31b5e6e48f074fa
Result: All tests passed
Workflow Run: View logs

The safe-to-test label indicates this commit has been approved for E2E testing.


If you push new commits, the label will be removed and you'll need to comment /run-e2e again.

@Ladas
Ladas marked this pull request as ready for review May 18, 2026 09:42
The external MaaS LiteLLM proxy (litellm-prod.apps.maas) is
unreachable from ephemeral HyperShift clusters. Switch the weather
agent to use the OpenAI API directly with gpt-4o-mini — the
OPENAI_API_KEY from GitHub secrets authenticates the request.

Revert pytest.skip on exhausted LLM retries — agent conversation
tests must pass, not skip.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@Ladas

Ladas commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label May 19, 2026
@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 1275d4e

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label May 19, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 1275d4e3f206b682959fb2c2649aa96548ad5ed1
Workflow Run: View logs

Tests are running on OpenShift 4.20.21. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: 1275d4e3f206b682959fb2c2649aa96548ad5ed1
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: fecc40e1e860cd7b45934744b71dce5bc0240dad
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: fecc40e1e860cd7b45934744b71dce5bc0240dad
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

Add a Python connectivity test that runs inside the weather-service
pod after deployment to verify DNS resolution and TLS connectivity
to the external LLM endpoint. This will surface the actual network
error (DNS, TCP, TLS) instead of the generic "Connection error"
from the OpenAI client.

The authbridge v0.6.0-alpha.3 uses proxy-sidecar mode (no proxy-init
init container, no iptables interception), so the previous
OUTBOUND_PORTS_EXCLUDE workaround had no effect. The connection
error is caused by something else blocking external HTTPS.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label May 25, 2026
@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 2a2e407

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@Ladas

Ladas commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label May 25, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 2a2e40791f7de4b29e00e21c432ccd4114186227
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: 2a2e40791f7de4b29e00e21c432ccd4114186227
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

DNS and TLS pass from the pod but OpenAI client gets "Connection
error". Add httpx and OpenAI client tests inside the pod to find the
actual failure layer. Also check for HTTP_PROXY env vars that the
authbridge sidecar might inject.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@Ladas

Ladas commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label May 25, 2026
@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 5df03df

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label May 25, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 5df03df1f74efc2796906acc4c00eb8490262480
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: 5df03df1f74efc2796906acc4c00eb8490262480
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

Root cause: the authbridge proxy-sidecar sets HTTPS_PROXY=http://
127.0.0.1:8081 on all containers, routing ALL outbound HTTPS through
the proxy. The proxy doesn't forward requests to external endpoints
outside the mesh, causing "Connection error" from the OpenAI client.

Fix: add the MaaS LiteLLM host to NO_PROXY so the agent connects
directly to the external LLM endpoint, bypassing the authbridge proxy.
Also include .svc and .svc.cluster.local for internal service traffic.

Remove the obsolete proxy-init OUTBOUND_PORTS_EXCLUDE workaround —
proxy-init is not injected in the default proxy-sidecar mode.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@Ladas

Ladas commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label May 25, 2026
@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 99c463f

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label May 25, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 99c463fee32d0f0ede19a63e3f55993250411b55
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Passed

Commit: 99c463fee32d0f0ede19a63e3f55993250411b55
Result: All tests passed
Workflow Run: View logs

The safe-to-test label indicates this commit has been approved for E2E testing.


If you push new commits, the label will be removed and you'll need to comment /run-e2e again.

@pdettori pdettori 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.

Solid debugging journey. The PR correctly identifies and fixes the root cause (authbridge HTTPS_PROXY blocking external LLM egress) and adds useful diagnostics. CI fixes for stuck HostedCluster cleanup and VPC deletion are straightforward robustness improvements.

Areas reviewed: Shell, Python, Security
Commits: 14, all DCO signed-off
CI: all passing (including E2E HyperShift)


echo " - Attempting manual VPC delete:"
VPC_DELETE_OUTPUT=$(aws ec2 delete-vpc --region "$AWS_REGION" --vpc-id "$vpc" 2>&1)
VPC_DELETE_OUTPUT=$(aws ec2 delete-vpc --region "$AWS_REGION" --vpc-id "$vpc" 2>&1) || true

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.

nit: After || true, VPC_DELETE_EXIT=$? will always be 0 — the subsequent success/failure branch on line 318 is now dead code. Fine if the intent is "always continue", but you could simplify by removing the exit-code check entirely.

exit 1
fi

# Diagnostic: verify LLM endpoint is reachable from inside the pod

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.

suggestion: The inline Python diagnostic is ~45 lines embedded in a heredoc. Consider extracting to a standalone script (e.g. scripts/diagnostics/test_llm_connectivity.py) or at minimum adding a comment noting when this can be removed (once the connectivity issue is fully resolved upstream).

"Cannot connect" in error_text
and attempt < _LLM_QUERY_MAX_ATTEMPTS
):
is_transient = any(

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.

nit: The multiturn test uses a local tuple ("Cannot connect", "Connection error") while the simple-query test reuses the module-level _TRANSIENT_ERRORS constant. Consider reusing _TRANSIENT_ERRORS here too for consistency.

@pdettori
pdettori merged commit 973e0a3 into main May 27, 2026
22 checks passed
@github-project-automation github-project-automation Bot moved this from New /:ToDo to Done in Rossoctl Issue Prioritization May 27, 2026
@pdettori
pdettori deleted the fix/hypershift-ci-stability branch May 27, 2026 02:39
@Ladas Ladas mentioned this pull request May 27, 2026
2 tasks
pdettori added a commit that referenced this pull request May 27, 2026
fix(test): retry agent conversation on LLM connection errors

(cherry picked from commit 973e0a3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Maintainer reviewed - safe to run E2E tests

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants