The AC wiring rubs bare on a bolt on the rear of the AC compressor... it does cause some weirdness. I found mine worn through quite a bit of wiring insulation, with a fairly large bare spot. It caused a rougher than normal idle... the truck actually started hard initially once it was repaired (like the PCM/ECM were relearning a new parameter).
I remember reading it is a combined circuit that also serves the crank/cam sensors?
Been a while since I read that... this was a common thing in 2003/2004... and its in the archives here at TDR. I cannot take credit for discovering it, only for remembering it from way back.
Your symptoms however, sound like a failed FCA. The cycling idle are very characteristic of a failed FCA...