Duden defines gleich as
in relativ kurzer Zeit, sofort, [sehr] bald,
which can be translated as
very soon or
The interpretation of gleich can actually vary between
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.
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.