From 49c7de70829a23b13ec3433daa664b20adcd67e3 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Tue, 14 Apr 2026 23:19:17 +0200 Subject: [PATCH] feat: stop container log capture when agent SSE connects Co-Authored-By: Claude Opus 4.6 (1M context) --- .../server/app/agent/SseConnectionManager.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cameleer3-server-app/src/main/java/com/cameleer3/server/app/agent/SseConnectionManager.java b/cameleer3-server-app/src/main/java/com/cameleer3/server/app/agent/SseConnectionManager.java index 65506d26..6c575643 100644 --- a/cameleer3-server-app/src/main/java/com/cameleer3/server/app/agent/SseConnectionManager.java +++ b/cameleer3-server-app/src/main/java/com/cameleer3/server/app/agent/SseConnectionManager.java @@ -3,7 +3,9 @@ package com.cameleer3.server.app.agent; import com.cameleer3.server.app.config.AgentRegistryConfig; import com.cameleer3.server.core.agent.AgentCommand; import com.cameleer3.server.core.agent.AgentEventListener; +import com.cameleer3.server.core.agent.AgentInfo; import com.cameleer3.server.core.agent.AgentRegistryService; +import com.cameleer3.server.core.runtime.RuntimeOrchestrator; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.annotation.PostConstruct; @@ -35,13 +37,16 @@ public class SseConnectionManager implements AgentEventListener { private final AgentRegistryConfig config; private final SsePayloadSigner ssePayloadSigner; private final ObjectMapper objectMapper; + private final RuntimeOrchestrator runtimeOrchestrator; public SseConnectionManager(AgentRegistryService registryService, AgentRegistryConfig config, - SsePayloadSigner ssePayloadSigner, ObjectMapper objectMapper) { + SsePayloadSigner ssePayloadSigner, ObjectMapper objectMapper, + RuntimeOrchestrator runtimeOrchestrator) { this.registryService = registryService; this.config = config; this.ssePayloadSigner = ssePayloadSigner; this.objectMapper = objectMapper; + this.runtimeOrchestrator = runtimeOrchestrator; } @PostConstruct @@ -81,6 +86,13 @@ public class SseConnectionManager implements AgentEventListener { }); log.info("SSE connection established for agent {}", agentId); + + // Stop container log capture — agent is now online and will send its own logs + AgentInfo agent = registryService.findById(agentId); + if (agent != null) { + runtimeOrchestrator.stopLogCaptureByApp(agent.applicationId(), agent.environmentId()); + } + return emitter; }