Duden defines gleich as
in relativ kurzer Zeit, sofort, [sehr] bald,
which can be translated as very soon
or right away
.
The interpretation of gleich can actually vary between immediately
and after whatever is happening is finished
.
You can find both in your example.
Du sollst aber GLEICH kommen.
You're supposed to come immediately.
Ja, ich komme gleich.
Yes, I'll come when I'm done / in 5 minutes.
For the after whatever is happening is finished
meaning, imagine the following:
A teenager is playing a computer game.
Teenager's mom: "Mach jetzt bitte Deine Hausaufgaben!"
Teenager: "Ja, gleich."
Teenager finishes his game and forgets about his homework.