NOT TO BE PUBLISHED
MAURO, Acting P. J.
Defendant Matthew John Taylor entered into a plea agreement in which he pleaded no contest to possession of marijuana for sale in a 2015 case and admitted violating probation in a 2011 case in exchange for three years in prison. Despite the plea agreement, the trial court sentenced defendant to three years eight months in prison and did not advise him that he could withdraw his plea.
Defendant now contends (1) the three-year eight-month term exceeded the agreed-upon sentence, and (2) the trial court erred in allocating custody credit between the 2011 and 2015 cases.
We will modify the judgment to strike the eight-month term and reallocate the custody credit. We will affirm the judgment as modified.
In 2011, pursuant to a plea agreement in case No. 11F07008 (the 2011 case), defendant pleaded no contest to possession of marijuana for sale . (Health & Saf. Code, § 11359.) The trial court suspended execution of a three-year prison term and placed defendant on probation for five years with various terms and conditions, including that defendant serve 200 days in jail.
Later, in 2015, marijuana was found in defendant's car, resulting in case No. 15F01538 (the 2015 case). Defense counsel informed the trial court execution of a three-year term had been suspended in the 2011 case and defendant would plead no contest in the 2015 case for "no additional time." The trial court explained to defendant that the maximum sentence in the 2015 case was three years, but the trial court would not impose additional time in that case. The trial court said it would execute the suspended three-year term in the 2011 case based on the admitted violation of probation. Pursuant to the plea agreement, defendant pleaded no contest to marijuana possession for sale (Health & Saf. Code, § 11359) in the 2015 case and admitted violating probation in the 2011 case.
The probation report recommended execution of the suspended three-year term in the 2011 case, but it also recommended a consecutive eight-month term (one-third the middle term) in the 2015 case. The probation report noted, "This recommendation is in conflict with the negotiated plea."
Nevertheless, at sentencing the trial court suggested the plea agreement was for a three-year eight-month term; defense counsel responded, "Okay." In the 2011 case the trial court executed the suspended three-year term and awarded 200 days of presentence credit (100 actual days and 100 conduct days). And in the 2015 case it imposed the middle term, stayed all but eight months, and awarded 316 days of presentence credit (158 actual days and 158 conduct days), which included defendant's time in custody since 2015 plus 16 days of credit from 2013. Defense counsel asserted the credit from 2013 should have been included in the 2011 case, but the trial court declined to make that change.
The trial court did not advise defendant at the plea hearing or at sentencing that if the court withdrew its approval of the plea agreement defendant could withdraw his plea.
Defendant contends the three-year eight-month term exceeded the agreed-upon sentence. We agree.
"When a guilty plea is entered in exchange for specified benefits such as the dismissal of other counts or an agreed maximum punishment, both parties, including the state, must abide by the terms of the agreement. The punishment may not significantly exceed that which the parties agreed upon." (People v. Walker (1991) 54 Cal.3d 1013, 1024 (Walker), overruled on other grounds as stated in People v. Villalobos (2012) 54 Cal.4th 177, 183.)
Here, defendant pleaded no contest in the 2015 case in exchange for no additional time in that case. Imposition of an eight-month term in the 2015 case exceeded the agreed-upon sentence. Defendant did not forfeit his challenge on appeal by failing to object at sentencing because he was never admonished that he could withdraw his plea if the court withdrew approval of the agreement. (See Walker, supra, 54 Cal.3d at pp. 1024-1025 [whether a defendant forfeits a challenge to punishment exceeding the agreement depends on whether the trial court admonished the defendant under Penal Code section 1192.5].)
The People note that defense counsel said "Okay" in response to the trial court's suggestion that the plea agreement was for three years eight months, indicating the parties had agreed to a second or modified plea agreement. The People suggest an off-the-record agreement was reached to impose the eight-month term in exchange for allowing defendant to serve the sentence in jail. But the terms of a plea agreement must be placed on the record. (In re Honesto (2005) 130 Cal.App.4th 81, 92.) Here, the terms of the original agreement are plainly reflected in the record, and we will not speculate about an off-the-record modified agreement. (See People v. West (1970) 3 Cal.3d 595, 611 [requiring that a plea bargain be placed on the record facilitates the prompt and accurate disposition of appeals and collateral attacks].)
The parties disagree on the proper remedy. Defendant asks for specific performance, but the People urge remand to permit defendant to withdraw his plea, arguing specific performance would deprive the trial court of discretion to sentence defendant to state prison should defendant be convicted after withdrawing his plea. We are sensitive to the People's point but on these facts we will modify the judgment because defendant has already served most, if not all, of his obligation under the plea agreement. (See Walker, supra, 54 Cal.3d at p. 1028 [the passage of time tilts the relevant interest strongly toward granting specific performance: "Because normally the defendant will have `completed a substantial portion of his prison term, permitting him to withdraw his guilty plea cannot restore the status he enjoyed before sentencing'"].)
We will modify the judgment to strike the eight-month term in the 2015 case.
Defendant also contends the trial court erred in allocating custody credit between the 2011 and 2015 cases. The People agree that credit attributable to defendant's 2011 case should be allocated to that case to avoid unused credit.
"Credit shall be given only once for a single period of custody attributable to multiple offenses for which a consecutive sentence is imposed." (Pen. Code, § 2900.5, subd. (b).) Here, with the exception of time served on March 12 and 13 of 2015, defendant's custody time awaiting his most recent sentencing is attributable to both his 2011 and 2015 cases. Having struck the term for his 2015 case, we may therefore award all attributable credit to his 2011 term. (See In re Marquez (2003) 30 Cal.4th 14, 23, original italics ["[T]he choice is not between awarding credit once or awarding it twice. The choice is instead between granting petitioner credit once for his time in custody . . . or granting him no credit at all for this period of local custody."].)
Accordingly, we will modify the judgment to allocate 512 days of presentence credit (256 actual days and 256 conduct days) to the 2011 case.
The judgment is modified to strike the eight-month consecutive term for possession of marijuana for sale in case No. 15F01538 and to award 512 days of presentence credit in case No. 11F07008. The judgment is affirmed as modified. The trial court is directed to prepare an amended abstract of judgment and to forward a certified copy of the amended abstract to the relevant authority.
HOCH, J., and RENNER, J., concurs.