tough to diag without being there. But my $0.02 is 3 possibilities. Ejector, it is in the bolt opposite the extractor. Use a little punch, hell tooth pick might work and push it in towards bolt face and make sure it doesn't bottom out before being flush or slightly below bolt face. If it will not go flush or lower then it could stop the bolt and hence the extractor from going over the rim.
Could be an extractor issue.
upper could be under gassed or right on the knife edge (which would still be under gassed). I have seen an AR that was just slightly under gassed that the brass instead of getting flung out of the ejection port would just barely have enough oomph to get the brass to dribble out the port, once in awhile it would not have enough ooomph and the empty brass would just bounce around in the upper. When this happened the bolt didn't have enough rear travel to pick up the next round and would close on the "ejected" brass like in your 1st post 2nd picture.