how does AES GCM in SSH work?
The CTR-IV either must be random or regularly incremented in a way that the IV never repeats again. If there is a repetition then the encryption will be insecure.

In rfc5647, it is the second way; regularly incremented.  


invocation_counter is incremented per package. Section 7.1;


  The invocation field is treated as a 64-bit integer and is incremented after each invocation of AES-GCM to process a binary packet.

block_counter is incremented per AES encryption within the package. It must be initialized to 1 for per package, otherwise, an overflow will occur and therefore the IV's cannot be unique. Section 7.1;


  The block_counter is initially set to one (1) and incremented as each    block of key is produced.



The 4-octet block counter matches with the size of the package that is defined in section 5.2 as;

uint32    packet_length;  // 0 &lt;= packet_length &lt; 2^32


Thus, this counter can be incremented for all encrypted blocks within one package. For a new package the set to 1 (that is your latter case).

For the second part, this can happen if ECB mode is used and the data sizes are multiple of the block cipher. Even in this case, a padding scheme must be applied. that will prevent your equation.