The bug
Almost every command in the game produces exactly one line of output, a success or failure message. However, /gamemode produces one line of output for every player whose game mode was changed. This makes a command block for example only show the last affected player in its last output box.
Other commands that affect multiple players only produce one line of output mentioning how many were affected.
How to reproduce
Be in a world with multiple players
/gamemode spectator @a
Expected result
“Set game mode of N players to Spectator Mode”
Observed result
One separate line for each player
Can confirm