When the vehicle turns on it will hang around 750 rpm for 1 sec then go to 1250 and stay there. Eventually a p1399 code will come up. I turn the car off then back on and it immediately goes down to 250 rpm and stays there for 10 sec then goes up to 1250 again and a cylinder 4 misfire occurs. If I rev the engine to 2500 and hold, once I release off the pedal it will stay at 250 and all cylinders will have misfires. If I erase all dtc's then it will restart the issue from the beginning. All while this is happening the stft is at -27.3 and the ltft stays at 0. I have replaced the egr, fuel pressure regulator, valve cover gasket and spark plug gaskets, plugs, plug wires, distributor, o2 sensor in the manifold, pcv valve, and done a valve adjustment. I'm lost as to what it could be.
I think the misfire (P0304, P1399) is caused by being way too lean. The STFT seems pegged low. Misfires usually INCREASE the fuel trims, due to the O2 sensor detecting so much extra oxygen from the misfired cylinders, and then compensating by adding more fuel.
Get more PIDS (like Ben suggested) and try and determine why the ECU wants it to be lean. Check intake air temp and coolant temp sensors for plausibility. Check operation of idle air control and timing (crank/camshaft sensors) for plausible values as well.
EGR gasses have no combustion value and would not affect O2 readings.
Check for vacuum leaks (un-metered air), because it's always a good start. Although, vacuum leaks would cause a high STFT for the reasons I mentioned.