Although the interplay between CCP 664.6’s two sentences is not entirely clear, this decision holds that if a settlement is entered into before the court and a motion to enforce the settlement is brought while the action is still pending, the court retains jurisdiction to rule on the motion to enforce the settlement even if the parties have not agreed to, and the court has not ordered, that it retains jurisdiction to enforce the settlement.  Here, plaintiff voluntarily dismissed the complaint before the settlement, but the action was still pending because one defendant’s cross-complaint was still pending and unresolved.  Therefore, the court had jurisdiction to rule on that defendant’s motion to enforce the settlement.  Though another defendant was no longer a party to the pending action, the court could enforce the terms of the settlement requiring plaintiff to dismiss its appeal form the judgment in that defendant’s favor.  No personal jurisdiction over or agreement by the absent defendant was required since the only term of the settlement that affected him was in his favor, making him a third party beneficiary of the other parties’ settlement agreement.