I don't have the answer for you, but I do have a question. Did this bag always have a lock problem, or did this problem only show up after the dealership changed out the bag? I assume from your original post it started after they transferred all the parts from the old bag to the new bag. If that's the case, I think you already know where the problem came from.
With the lid open while you watch the locking mechanism, press the lock button and see if the lock operates correctly. Then close the lid and see what happens. Any misalignment that causes the mechanism to bind can cause what you described. The reason it would go ahead and lock on the second attempt would have to do with the amount of power needed to engage all of the locks at once, versus the smaller amount of power required to just operate one lock. First make certain there is no binding, then make certain the electrical connections are pristine with no voltage drop across any connection.
Just a guess, hope it helps.
Jerry