@@ -262,38 +262,22 @@ public IModuleOutputBuffer GetModuleBuffer(Type moduleType)
262262 /// <inheritdoc />
263263 public void FlushModuleOutput ( )
264264 {
265+ // Output is now flushed immediately when modules complete.
266+ // This method remains for API compatibility but only flushes
267+ // unattributed output (pipeline-level logs).
265268 if ( _originalConsoleOut == null )
266269 {
267- throw new InvalidOperationException ( "ConsoleCoordinator is not installed." ) ;
270+ return ; // Not installed, nothing to flush
268271 }
269272
270273 var formatter = _formatterProvider . GetFormatter ( ) ;
271274
272- // Flush unattributed output first (if any)
275+ // Flush unattributed output (if any)
273276 if ( _unattributedBuffer . HasOutput )
274277 {
275278 var unattributedLogger = _outputLogger ?? _loggerFactory . CreateLogger ( "ModularPipelines.Output" ) ;
276279 _unattributedBuffer . FlushTo ( _originalConsoleOut , formatter , unattributedLogger ) ;
277280 }
278-
279- // Flush module buffers in completion order
280- var orderedBuffers = _moduleBuffers . Values
281- . Where ( b => b . HasOutput )
282- . OrderBy ( b => b . CompletedAtUtc ?? DateTime . MaxValue )
283- . ToList ( ) ;
284-
285- foreach ( var buffer in orderedBuffers )
286- {
287- // Resolve the registered ILogger<T> from DI to use any custom loggers injected by tests
288- var loggerType = typeof ( ILogger < > ) . MakeGenericType ( buffer . ModuleType ) ;
289- var moduleLogger = ( ILogger ) _serviceProvider . GetService ( loggerType )
290- ?? _loggerFactory . CreateLogger ( buffer . ModuleType ) ;
291- buffer . FlushTo ( _originalConsoleOut , formatter , moduleLogger ) ;
292- }
293-
294- // Clear buffers after flush to release memory
295- // This prevents accumulation in long-running pipelines
296- _moduleBuffers . Clear ( ) ;
297281 }
298282
299283 /// <inheritdoc />
0 commit comments