Skip to content

Commit 0274ee7

Browse files
sallyomclaude
andauthored
fix: Only validate ambient-runner-secrets when Vertex AI is disabled (#418)
Fixes a regression where ambient-runner-secrets validation occurs unconditionally, causing session creation to fail even when CLAUDE_CODE_USE_VERTEX=1. This fix wraps the runner secret validation in a !vertexEnabled check, since the secret is only needed when Vertex AI is disabled. When Vertex is enabled, the ambient-vertex secret is used instead. Changes: - Wrap runner secret validation in 'if !vertexEnabled' block - Add descriptive log messages for both Vertex enabled/disabled cases - Maintain error handling and status conditions for non-Vertex case Signed-off-by: sallyom <somalley@redhat.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent c79118c commit 0274ee7

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

components/operator/internal/handlers/sessions.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -810,21 +810,27 @@ func handleAgenticSessionEvent(obj *unstructured.Unstructured) error {
810810
const runnerSecretsName = "ambient-runner-secrets" // ANTHROPIC_API_KEY only (ignored when Vertex enabled)
811811
const integrationSecretsName = "ambient-non-vertex-integrations" // GIT_*, JIRA_*, custom keys (optional)
812812

813-
// Check if integration secrets exist (optional)
814-
if _, err := config.K8sClient.CoreV1().Secrets(sessionNamespace).Get(context.TODO(), runnerSecretsName, v1.GetOptions{}); err != nil {
815-
if !errors.IsNotFound(err) {
816-
log.Printf("Error checking runner secret %s: %v", runnerSecretsName, err)
817-
} else {
818-
log.Printf("Runner secret %s missing in %s", runnerSecretsName, sessionNamespace)
813+
// Only check for runner secrets when Vertex is disabled
814+
// When Vertex is enabled, ambient-vertex secret is used instead
815+
if !vertexEnabled {
816+
if _, err := config.K8sClient.CoreV1().Secrets(sessionNamespace).Get(context.TODO(), runnerSecretsName, v1.GetOptions{}); err != nil {
817+
if !errors.IsNotFound(err) {
818+
log.Printf("Error checking runner secret %s: %v", runnerSecretsName, err)
819+
} else {
820+
log.Printf("Runner secret %s missing in %s (Vertex disabled)", runnerSecretsName, sessionNamespace)
821+
}
822+
statusPatch.AddCondition(conditionUpdate{
823+
Type: conditionSecretsReady,
824+
Status: "False",
825+
Reason: "RunnerSecretMissing",
826+
Message: fmt.Sprintf("Secret %s missing", runnerSecretsName),
827+
})
828+
_ = statusPatch.Apply()
829+
return fmt.Errorf("runner secret %s missing in namespace %s", runnerSecretsName, sessionNamespace)
819830
}
820-
statusPatch.AddCondition(conditionUpdate{
821-
Type: conditionSecretsReady,
822-
Status: "False",
823-
Reason: "RunnerSecretMissing",
824-
Message: fmt.Sprintf("Secret %s missing", runnerSecretsName),
825-
})
826-
_ = statusPatch.Apply()
827-
return fmt.Errorf("runner secret %s missing in namespace %s", runnerSecretsName, sessionNamespace)
831+
log.Printf("Found runner secret %s in %s (Vertex disabled)", runnerSecretsName, sessionNamespace)
832+
} else {
833+
log.Printf("Vertex AI enabled, skipping runner secret %s validation", runnerSecretsName)
828834
}
829835

830836
integrationSecretsExist := false

0 commit comments

Comments
 (0)