Thanks for sharing this, and good job standing up for yourself and walking off. I once spent about four hours at a gate (before the new rules, and in Canada) and wish I had stood up to the CSRs and walked. I wound up missing Thanksgiving dinner because of that delay.
I hope you also file a DOT report on this one. Even if the delay is technically within the letter of the rules, the DOT needs to see screwups like this.
To the UA reps who are surely reading this: please get rid of that gate agent.