Most LEOs never experience a real life shoot/no-shoot scenario in their lifetime. Half of them are undertrained in this area as well. Faced with that situation, with adrenaline pumping, it seems like you'd be asking to get shot if you produced your handgun unless you can also produce a badge.
That might depend more on the department that you are dealing with than anything else. The training for these situations is pretty good in my department, and working on the streets has placed many of us in a number of critical incidents in our careers. In some areas officers are more accustomed to seeing armed citizens, and in other areas a citizen with a gun might be viewed as a threat (Chicago, etc).
I'll say this much: I'd generally recommend that a citizen stay on the sidelines unless it is clear that I'm in need of immediate assistance. Sometimes it is hard to tell who is a friend and who is an enemy, especially in a densely populated area like the one where I work. I'd hate to end up accidentally shooting a CCW'er who came up behind me during a gang fight, simply because I thought that they were trying to ambush me. Sometimes it is easy to tell the difference between a friend and foe, while other times it is much more difficult.
Honestly, our undercover officers are equally cautious when approaching these situations, for fear of misidentification. But, they have the advantage of wearing a badge, and being able to announce that they are police officers!
Still, if I was ever getting my butt handed to me on the streets, I'd gladly accept any help I could get! I just recommend a cautious approach into these situations, as they can be dangerous for anyone involved. If you do decide to get into a fight to help an officer, you simply might consider announcing your intentions as you approach: "Officer, what can I do to help?", or "I've got your back officer", or "Officer, I'm coming up beside you and I'm armed... tell me where I can help".
In these situations just be prepared to follow directions. If the officer asks you to step back, step back. If the officer asks you to help, try to help.
I once had a retired police officer (who wasn't carrying a badge) help me as I took custody of a couple of robbery suspects. I didn't know this officer, and he didn't immediately tell me that he was a retired cop. But, he announced what he was doing, and that he was armed, and provided cover for me until my cover showed up. He then backed out of the situation and waited to provide a witness statement.