CortexIo uses a stateful transform and the global window to attach index number to samples to meet Cortex's time ordering constraint.
For each watched CompoundKey (exporter/interface/tos/application, ...) a list of so called "flushed" timestamps is kept in state that. The list of timestamps for a particular key should be removed from Beam's state after the allowedLateness for a key has passed without seeing a flow for that key for the maximum flushed timestamp.
A possible solution could be based on Beam's timer mechanism using first a timer in the event time domain (waiting for the watermark to pass the on time condition) and then another timer in the processing time domain for clearing the state "max allowed lateness" has passed.
While certainly doable, I asked on the Beam mailing list if there is a simpler solution to that problem (cf. GC state in case of global window).