diff --git a/langstream-agents/langstream-agent-grpc/src/main/java/ai/langstream/agents/grpc/GrpcAgentProcessor.java b/langstream-agents/langstream-agent-grpc/src/main/java/ai/langstream/agents/grpc/GrpcAgentProcessor.java index 049d2eb4f..377d49b95 100644 --- a/langstream-agents/langstream-agent-grpc/src/main/java/ai/langstream/agents/grpc/GrpcAgentProcessor.java +++ b/langstream-agents/langstream-agent-grpc/src/main/java/ai/langstream/agents/grpc/GrpcAgentProcessor.java @@ -177,6 +177,7 @@ public void onError(Throwable throwable) { @Override public void onCompleted() { + if (!restarting.get()) { agentContext.criticalFailure( new RuntimeException("gRPC server completed the stream unexpectedly")); diff --git a/langstream-agents/langstream-agent-grpc/src/test/java/ai/langstream/agents/grpc/AbstractGrpcAgentTest.java b/langstream-agents/langstream-agent-grpc/src/test/java/ai/langstream/agents/grpc/AbstractGrpcAgentTest.java index c05b23755..7c29659bb 100644 --- a/langstream-agents/langstream-agent-grpc/src/test/java/ai/langstream/agents/grpc/AbstractGrpcAgentTest.java +++ b/langstream-agents/langstream-agent-grpc/src/test/java/ai/langstream/agents/grpc/AbstractGrpcAgentTest.java @@ -132,6 +132,7 @@ public void onCompleted() { @BeforeEach public void setUp() throws Exception { + log.info("Starting test"); String serverName = InProcessServerBuilder.generateName(); server = InProcessServerBuilder.forName(serverName) @@ -145,6 +146,7 @@ public void setUp() throws Exception { @AfterEach public void tearDown() throws Exception { + log.info("Shutting down test"); processor.close(); channel.shutdownNow(); server.shutdownNow(); @@ -170,11 +172,13 @@ void testTopicProducerSuccess() throws Exception { @Test void testTopicProducerError() throws Exception { + log.info("Starting testTopicProducerError"); TestAgentContext context = new TestAgentContextFailure(); startProcessor(context); assertEquals( "getTopicProducerRecords: gRPC server sent error: INTERNAL: test-error", context.failure.get(15, TimeUnit.SECONDS).getMessage()); + log.info("Finished testTopicProducerError"); } @Test