This is essentially the same as https://feedback.bistudio.com/T146461.
However, according to @BIS_fnc_KK, this is not a bug (but I still believe it is). So I'm going to re-post it as a feature request.
As mentioned before, the combatMode command is broken, unless you use Group setCombatMode Mode.
However, if the unit's combat mode was changed without using setCombatMode on the original gorup, combatMode doesn't return the correct value.
There are two ways to reproduce the issue (see the Steps To Reproduce section)
The 1st method is the only way to change the combat mode of a selection of units (instead of the entire group) without using the vanilla commanding menus (I believe that the vanilla commanding menu uses the same trick too).
@BIS_fnc_KK
Regarding your comment:
This does affect the unit. The unit's combat mode successfully changes (as indicated in the "group bar", as well as unit's behavior), but it can't be returned using combatMode. You can test it yourself if you don't believe me!
TL;DR, what I'm requesting is a getter for whatever changes the unit's combat mode in the group bar, i.e this one:
(I've used the commanding menus in this screenshot; you can clearly see the bug)
Either the same command:
combatMode unit
return value: String. An individual unit's combat mode, not his group's (i.e. what is shown in the "group bar")
or a new command:
getCombatMode unit
return value: String. An individual unit's combat mode, not his group's (i.e. what is shown in the "group bar")