Change spec to demand op group is the first triple of the output scrtipt
The spec, as I write this, states that there is no rule and it states in several places that a second op_group should be ignored.
I would prefer we do not have the ambiguity and instead use the fact that this is miner-validated and enforce there to be only one op_group. On top of this the op-group triple should be the first in the output script.
There are a number of reasons why this is better.
ambiguity in the spec leads to bugs in software. Allowing more than one Op-Group guarantees that it will happen on-chain and the different software can interpret the second one differently. There is currently one example implementation, but there will be a dozen more when this consensus change gets activated. Less uncertainty avoids bugs, avoids chain-splits and that builds confidence.
Placing the 2 pushes followed by the OP_GROUP opcode at the start of a script, by consensus, provides a simple way for code that detects templates in scripts to do its job. First, it guarantees that old (or simply buggy) wallet-code detecting p2pkh will not mistakenly detect p2pkh because a user placed his op_group after the template. And at the same time the forcing of placement of the op_group triplet at the start doesn't make the template detecting very much more complex. Allowing it to be anywhere would make it much more complex.
An output script is not parsed while mining / validating the transaction with that output script. The only component that looks at the output_script during validation is the group-validation-code. Here the concept of KISS is useful. Only parsing the part that is needed to get parsed, instead of the whole thing finding something that may or may not be there, helps validation. Both to be bugfree and to be faster.