feat: stop container log capture when agent SSE connects
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user