I'd argue that the Tang Dynasty, even without the An Shi Rebellion, would probably eventually have suffered the same issues that plagued every Chinese dynasty - overpopulation leading to smaller acreages per capita, which would lead to land speculation, peasant dispossession and large horde of angry, poor farmers with nothing to lose. The resultant explosive situation would have been easily exploited by potential rebel leaders and military governors.
It's difficult to assess Li Linfu (or the eunuchs) objectively because Chinese historical sources (written by bureaucrats) demonstrate quite a bias in these things. I wouldn't put so much stock into the idea that the Li Linfu clique was excessively incompetent or evil, at least not to the extent that the histories paint them as.
Imperial Chinese government has always been notoriously factional (as the Niu-Li struggle in the late Tang would show) and people whom Li Linfu would have seen as reliable supporters of his policies would undoubtedly been castigated by the anti-Li faction as 'yes-men'. Also from the point of Li, cultivating relations with a powerful military governor to overawe his central government opponents couldn't have seemed like such a bad idea at the time. The Tang Dynasty didn't do much better at suppressing the An Lushan Rebellion after the fall of the Li faction either, so his incompetence is probably exaggerated with the benefit of hindsight.
Tang Xuanzong's reliance on eunuchs such as Gao Lishi has also been criticised but it's important to note that in a system where the Emperor was held responsible for so many things, yet frequently did not have the power to deal with them in the face of a powerful bureaucracy, eunuchs were generally the most direct and 'reliable' tools the emperor had at his disposal to execute his well. Use of eunuchs was not necessarily the mark of an incompetent emperor... only one that did not have the power to impose his will on the bureaucracy.
As for the Caliphate... yes, quite possible that further exchange would have stimulated the Tang somewhat, especially if Greek philosophy somehow got transferred to China.
I won't address the parts I don't know enough about, but I will point out that the An Lushan rebellion wasn't a peasant rebellion. We're not dealing with that point yet, and even with the weakness of the Tang government, there weren't any real agrarian rebellions until Pang Xun or so.
Historiography doesn't seem like an issue to me. There might be a few exceptions, but basically every civil official in the Tang Dynasty gets criticized. You can argue that historians were anti-Li Linfu. But they were also anti-Yang Guozhong. And anti-An Lushan. The Confucian bureaucrats hated eunuchs. But they also hated other Confucian bureaucrats. It's not like later historians liked Li Deyu or Niu Sengru either. So while they have their own biases, I'm not convinced they are more biased towards certain officials than others.
Thank you for your answer. China is not a subject I know a lot about.
How damaging were people like Li Linfu to the Empire? I've read his political machinations resulted in the Tang government being staffed by yes-men and other useless, easily manipulated people rather than competent officials who would have been useful during the crisis. Is this an exaggeration or did the quality of the government and bureaucracy seriously deteriorate in this period?
Is there anything useful the Tang and the Caliphate could learn from each other? Supposedly the Arabs learned papermaking from the Chinese around this time; is there anything else of value that could be transported west, or some useful skills the Muslims had the Chinese did not know about?
Li Linfu and Yang Guozhong were damaging to the Tang. That part's true. However, while there was a decline in the Tang government at this time, at least because of the aforementioned centralization of power, it's hard to say if Li and Yang were a cause or an effect. Sure, they were abusive and corrupt and staffed the government with their allies. Everybody in Chinese history did that. But did these two officials become so spectacularly powerful because they convinced Xuanzong to give them so power? Or did they become powerful because Xuanzong decided to abdicate responsibility voluntarily? These questions don't have clear answers. Purges, assassinations, corruption, incompetency ... all of these are hallmarks of Tang history. I think it's impossible to say concretely that Li and Yang were eviler than other figures of the Tang, only that they had much more leeway.
And it's not so clear that anybody else in their position would have acted differently either. Yang was blamed for making bad decisions, ordering the Tang army to attack An Lushan when An's forces were prepared for any frontal assault. But would Chen Xilie or Wei Jiansu (the number two men after Li Linfu and Yang Guozhong, respectively, though they had basically no power) have done anything differently? I don't think we can say for certain.
I don't know what the Caliphate has to give to the Tang. I wonder if silk production and knowledge of that process had spread to the Middle East by then. If not, that's the one thing I can think of that could diffuse.