That’s a hell of a good question, I must admit.
Is it even possible to give a CIA agent immunity (current or former)?
My gut tells me this ends up with the CIA basically telling any Congressional investigative committee to go f*** itself and the proceed to stonewalling. End of story.
There is an alternative....closed-door, off-the-record hearings, with the testimony classified as “National Security” and all those involved forbidden to publicly disclose the results under penalty of law. That’s actually a distinct possibility.
What a lot of people are overlooking here is that this all really comes down to Petraeus, not the CIA or the Obama White House. They can come up with any reason they’d like to keep him from testifying, but if he willingly goes and testifies — most likely under immunity — he can sing like a canary and there isn’t much they can do about it.