@@ -246,6 +246,7 @@ func (app *App) RunNonInteractive(ctx context.Context, output io.Writer, prompt,
246 done <- response{
246 done <- response{
247 err: fmt.Errorf("failed to start agent processing stream: %w", err),
247 err: fmt.Errorf("failed to start agent processing stream: %w", err),
250 done <- response{
251 done <- response{
251 result: result,
252 result: result,
@@ -551,7 +552,7 @@ func (app *App) Shutdown() {
551 var wg sync.WaitGroup
552 var wg sync.WaitGroup
553 // Shared shutdown context for all timeout-bounded cleanup.
554 // Shared shutdown context for all timeout-bounded cleanup.
554− shutdownCtx, cancel := context.WithTimeout(app.globalCtx, 5*time.Second)
555+ shutdownCtx, cancel := context.WithTimeout(context.WithoutCancel(app.globalCtx), 5*time.Second)
555 defer cancel()
556 defer cancel()
557 // Send exit event
558 // Send exit event