Welcome to GMTN, Eddie...
If I were to make an educated guess... The Prime Suspect for this situation would be a Failing SAIS Pump Solenoid ... Located slightly off-center on the Passenger Side of the 4.2L Engine Head... That Solenoid ordinarily activates when the vehicle is just being started...and it allows additional Air to gain entry via the SAIS (Secondary Air Injection System) Pump activating for the purpose of adding more 02 into the Catalytic Converter and allow it to Heat Up Faster and behave more efficiently.
If the SAIS Pump is exposed to repetitive water drenching, such as can happen on Fresh and Salt Water Boat Ramps... the Connections can Corrode or Rust and Short Out... which might make the SAIS Pump run continuously. But in the case of the Engine Mounted SAIS Solenoid... it can also get stuck OPEN.
As you probably know... the O2 Sensors' expected response to having TOO MUCH 02 ...is to Dump More Fuel into the Engine to try and regain a Stoichiometric Fuel/Air Balance... and hence... the Engine RPM will Rise. The fact that after you got the P0171 and immediately after the RPM rose to 950-1000... makes me think that that if you R&R the SAIS Solenoid... this problem will be solved.
You can find what you need for this repair at the below RockAuto Link:
https://www.rockauto.com/en/catalog...t+&+emission,air+/+smog+pump+check+valve,4912