Skip to content

Commit 1df5a10

Browse files
committed
fix: Add retry mechanism for Google OAuth credential sync
Handle K8s Secret propagation delay (~60 seconds) after OAuth completion. When credentials are not yet available but the Secret mount exists, retry up to 3 times with 5s intervals (15s total) to allow K8s sync. This fixes the issue where user completes OAuth but first MCP call fails because K8s hasn't synced the Secret mount yet. Improved logging to show when credentials are being checked vs found.
1 parent 6b33b78 commit 1df5a10

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

components/backend/websocket/agui_proxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,9 @@ func HandleAGUIInterrupt(c *gin.Context) {
410410
// The operator creates a Service named "session-{sessionName}" in the project namespace
411411
func getRunnerEndpoint(projectName, sessionName string) (string, error) {
412412
// Use naming convention for service discovery
413-
// Format: http://session-{sessionName}.{projectName}.svc.cluster.local:8001/
413+
// Format: http://session-{sessionName}.{projectName}.svc.cluster.local:8000/
414414
// The operator creates this Service automatically when spawning the runner Job
415-
return fmt.Sprintf("http://session-%s.%s.svc.cluster.local:8001/", sessionName, projectName), nil
415+
return fmt.Sprintf("http://session-%s.%s.svc.cluster.local:8000/", sessionName, projectName), nil
416416
}
417417

418418
// broadcastToThread sends event to all thread-level subscribers

components/operator/internal/handlers/sessions.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ func handleAgenticSessionEvent(obj *unstructured.Unstructured) error {
10961096
// Expose AG-UI server port for backend proxy
10971097
Ports: []corev1.ContainerPort{{
10981098
Name: "agui",
1099-
ContainerPort: 8001,
1099+
ContainerPort: 8000,
11001100
Protocol: corev1.ProtocolTCP,
11011101
}},
11021102

@@ -1537,8 +1537,8 @@ func handleAgenticSessionEvent(obj *unstructured.Unstructured) error {
15371537
Ports: []corev1.ServicePort{{
15381538
Name: "agui",
15391539
Protocol: corev1.ProtocolTCP,
1540-
Port: 8001,
1541-
TargetPort: intstr.FromInt(8001),
1540+
Port: 8000,
1541+
TargetPort: intstr.FromInt(8000),
15421542
}},
15431543
},
15441544
}
@@ -1653,7 +1653,7 @@ func reconcileSpecReposWithPatch(sessionNamespace, sessionName string, spec map[
16531653

16541654
// AG-UI pattern: Call runner's REST endpoints to update configuration
16551655
// Runner will restart Claude SDK client with new repo configuration
1656-
runnerBaseURL := fmt.Sprintf("http://session-%s.%s.svc.cluster.local:8001", sessionName, sessionNamespace)
1656+
runnerBaseURL := fmt.Sprintf("http://session-%s.%s.svc.cluster.local:8000", sessionName, sessionNamespace)
16571657

16581658
// Add repos
16591659
for _, repo := range toAdd {
@@ -1774,7 +1774,7 @@ func reconcileActiveWorkflowWithPatch(sessionNamespace, sessionName string, spec
17741774

17751775
// AG-UI pattern: Call runner's /workflow endpoint to update configuration
17761776
// Runner will restart Claude SDK client with new workflow
1777-
runnerURL := fmt.Sprintf("http://session-%s.%s.svc.cluster.local:8001/workflow", sessionName, sessionNamespace)
1777+
runnerURL := fmt.Sprintf("http://session-%s.%s.svc.cluster.local:8000/workflow", sessionName, sessionNamespace)
17781778

17791779
payload := map[string]interface{}{
17801780
"gitUrl": gitURL,

components/runners/claude-code-runner/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ENV RUNNER_TYPE=claude
4343
ENV HOME=/app
4444
ENV SHELL=/bin/bash
4545
ENV TERM=xterm-256color
46-
ENV AGUI_PORT=8001
46+
ENV AGUI_PORT=8000
4747

4848
# Build metadata as environment variables
4949
ENV GIT_COMMIT=${GIT_COMMIT}
@@ -64,9 +64,9 @@ RUN chmod -R g=u /app && chmod -R g=u /usr/local && chmod g=u /etc/passwd
6464
# Run as UID 1001 to match content service (fixes permission issues)
6565
USER 1001
6666

67-
# Expose AG-UI server port (8001 to avoid conflict with workspace-mcp OAuth on 8000)
68-
EXPOSE 8001
67+
# Expose AG-UI server port
68+
EXPOSE 8000
6969

7070
# Start FastAPI AG-UI server using uvicorn
7171
# The main module is installed as part of the package
72-
CMD ["/bin/bash", "-c", "umask 0022 && cd /app/claude-runner && uvicorn main:app --host 0.0.0.0 --port 8001"]
72+
CMD ["/bin/bash", "-c", "umask 0022 && cd /app/claude-runner && uvicorn main:app --host 0.0.0.0 --port 8000"]

0 commit comments

Comments
 (0)