I did generalize and simplify the problem presented to make it simpler.
The real calculation of the arbitrary-length sequence is made inside the block. The block is actually a sync block. Some (not all) of the items it outputs are tagged. Tags are determined by the calculation ran on the sequence.
If I understand correctly, the fact that I need to tag items from the past means that the approach of storing them in a memory buffer of the block isn't going to solve my problem: I'll be able to find out what is the max value, but I won't be able to tag the item if it was consumed by a former call to work() - can't tag past items.
The solution presented in peak_detector2_fb was the inspiration to my solution, and my questions in the original post arise from it (how do I increase the maximum possible number of items, specifically in Python, how do I handle the error if it indeed occurs, and a theoretical question - why do I need to use output_multiple and the scheduler doesn't feed my block with more items if it has more ready as an input because the last call to work() didn't consume any).