
178 Cal.App.4th 1510 (2009)
THE PEOPLE, Plaintiff and Respondent,
v.
JACOB TOWNLEY HERNANDEZ, Defendant and Appellant.
No. H031992.
Court of Appeals of California, Sixth District.
November 9, 2009.
*1514 Marc J. Zilversmit for Defendant and Appellant.
Edmund G. Brown, Jr., Attorney General, Dane R. Gillette, Chief Assistant Attorney General, Gerald A. Engler, Assistant Attorney General, Laurence K. Sullivan and Amy Haddix, Deputy Attorneys General, for Plaintiff and Respondent.

OPINION
ELIA, J.
After a jury trial defendant Jacob Townley Hernandez (Townley) was convicted of premeditated attempted murder, in violation of Penal Code sections 187, subdivision (a), and 664. The jury also found true the allegations that Townley had personally used a gun and had personally inflicted great bodily injury in committing the crime. (Pen. Code, § 12022.53, subd. (c); § 12022.7, subd. (a).) On appeal, he raises numerous issues bearing on his right to consult with counsel, admission of statements made by witnesses in police interviews, prosecutor misconduct, improper judicial *1515 comments, admission of gang evidence, and jury instructions. He further challenges the denial of his pretrial motion to suppress evidence obtained as a result of his detention. On July 23, 2009, this court filed an unpublished opinion affirming the judgment. On August 14, 2009, we granted Townley's petition for rehearing to give more attention to a gag order that prevented defense counsel from discussing the contents of two declarations by witnesses with Townley. Upon further review, for the reasons stated below, we will reverse the judgment.[1]

I. BACKGROUND
Seventeen-year-old Townley was accused by information with attempted murder, committed with three accomplices: 18-year-old Jose Ruben Rocha, 16-year-old Jesse Carranco, and 18-year-old Noe Flores. The charges arose from the shooting of Javier Zurita Lazaro around 9:00 p.m. on February 17, 2006. In a telephone call about 7:00 p.m. that night, Townley asked Flores to "do a ride." Flores drove his 1992 white Honda Accord to pick up Townley and his girlfriend, Amanda Johnston, in Santa Cruz. Once in the car, Townley showed Flores a small black handgun, which Flores handled and returned to Townley.
Townley directed Flores to drive to Watsonville, where they picked up Carranco (known as "Little Huero") and Rocha (known as "Listo"), whom Flores had not met before. Townley was wearing People's exhibit No. 23, a red and black plaid flannel jacket, which Johnston had given him as a gift. Carranco wore a red hooded sweatshirt; he had four dots tattooed on his knuckles, signifying his association with the Norteno gang. Flores wore black sweatpants, a white T-shirt, gloves, and a black zip-up hooded sweatshirt. Rocha wore a black flannel jacket with white in it.
The group then drove back to Santa Cruz, dropping Johnston off before heading downtown. They went to an apartment on Harper Street where Anthony Gonzalez lived. About 20 minutes later, the four drove toward the Ocean Terrace apartments, located at the corner of Merrill Street and 17th Avenue in an area known as Sureno gang territory. As they were moving down 17th Avenue, they saw Javier Lazaro on the sidewalk across the street, walking back to his apartment at the Ocean Terrace complex. Lazaro, aged 29, was not associated with any gang, but the sweatshirt he wore was blue, the color associated with the Surenos. Carranco told Flores in a "[k]ind of urgent" voice to turn around and pull over, and Flores did so. Grabbing a T-ball bat that Flores kept in the front passenger area, Carranco jumped out of *1516 the car, along with Townley and Rocha. Flores waited in the driver's seat with the engine running. He heard what sounded like firecrackers; then the three others ran back to the car and Carranco told him "urgently" to go. Flores drove away rapidly with his passengers and followed Carranco's directions back to Gonzalez's apartment.
Lazaro testified that as he was walking back to his apartment he heard three or four voices from inside Flores's car, and then someone yelled, "Come here." He thought it was directed at someone else, so he continued walking without turning around. Just as he reached the parking lot of the apartment complex, he saw the group get out of the car and run across the street toward him. They asked him whether he was Norteno or Sureno. At that point Lazaro was frightened and ran, until he felt something push him to the ground. Lazaro received five gunshot wounds, including a fractured rib and a bruised lung. Two bullets remained in his body.
Lazaro did not see who shot him, but Ginger Weisel, Lazaro's neighbor, was in the parking lot when Lazaro walked away from the group. She heard them call out "fucking scrap" and ask where Lazaro was from before seeing one of them shoot Lazaro six to eight times. Lazaro fell after about four shots. Weisel recalled that the shooter was about five feet nine inches tall[2] and wore a red and black plaid Pendleton shirt. Weisel called 911 from her apartment and returned to help Lazaro.
David Bacon was driving on 17th Avenue when he saw Flores's car parked in a no-parking zone. He saw what appeared to be two Latino males of high school age, about five feet 10 inches tall. Seconds later he heard snapping sounds and saw one of the group standing in a "classic shooting position," holding a gun. He heard a total of five or six shots from what appeared to be a small-caliber gun. Bacon had the impression that the shooter wore a plaid jacket, which could have been People's exhibit No. 22. The second man appeared to be a lookout. Bacon then saw two people run back to the car, which sped away. He parked his car, called 911, and returned to help Lazaro, who was lying on the ground with two women tending to him. Emergency personnel arrived within a minute after the last shot.
Susan Randolph stepped outside her home on 17th Avenue when she heard the gunshots. She described the three as young Latinos between 16 and 20 years old, ranging from five feet six inches to five feet nine inches.
Julie Dufresne was driving on 17th Avenue with Jeanne Taylor when she heard popping noises that sounded like fireworks, followed immediately by *1517 three people running across the street in front of her car. They were all about her height, five feet nine or 10 inches, or probably shorter, and they appeared to be between 15 and 20 years old. One wore a thin, red and black plaid flannel jacket.
Taylor thought there were five popping sounds, followed by the "three young men" running across the street in front of the car. One of them was less than five feet five inches and wore what looked like a plaid Pendleton shirt in black and red. He appeared to be staggering as if he were drunk or "having difficulty with his coordination." The other two were taller; one wore a white and black plaid shirt, People's exhibit No. 22, and the other a hooded sweatshirt. When they reached the white car, one went to the backseat on the driver's side, and the other two went around to the passenger side. Taylor thought that People's exhibit No. 23 looked like the red and black shirt the "shorter person" had been wearing; Dufresne "couldn't say for sure."
Randi Fritts-Nash was one of the teenagers drinking at the Harper Street apartment. Sitting in Gonzalez's bedroom with five others, she heard a car pull into the parking lot, followed by a couple of knocks at the window. Gonzalez went to the window and then left the room. Before he left, Fritts-Nash heard the anxious voices of two people outside, one of whom said the words "hit" and "scrap."
When Gonzalez reappeared, Townley and the other three were with him. Townley was wearing a red and black plaid jacket, People's exhibit No. 23. Fritts-Nash heard Townley say something to Gonzalez about Watsonville Nortenos. She also saw Townley pull a small handgun out of his pocket and wipe off the prints with a blanket. Townley moved the gun several times from one pocket to another, saying, "I need to hide this gun." He also told her he was "looking at 25 to life." Rejecting Fritts-Nash's suggested hiding place, Townley put the gun in his shoe and a small black velvet bag of bullets into his other shoe. Townley told her to cross her fingers for good luck. Fritts-Nash asked him if he had shot someone; his head movement indicated an affirmative answer.
Townley and Carranco were tried together as adults under Welfare and Institutions Code section 707, subdivision (d)(2). On January 25, 2007, the court granted Townley's motion to sever his trial from that of his codefendants. Before trial both Flores and Rocha entered into plea agreements in which the prosecution would reduce the charges in exchange for their declarations under penalty of perjury. Flores thereafter pleaded guilty to assault with a firearm subject to a three-year prison term, and the prosecutor dismissed the attempted murder charge against him. Rocha pleaded guilty to assault with force likely to produce great bodily injury, with an expected *1518 sentence of two years. On the same date that Flores and Rocha entered their pleas, April 17, 2007, the prosecution filed a motion to reconsolidate the cases against Carranco and Townley, which the court subsequently granted on April 26, 2007.
The jury found Townley guilty of attempted premeditated murder and found the People's allegations of firearm use and great bodily injury to be true. (Pen. Code, § 12022.53, subds. (b), (c), (d); § 12022.5, subd. (a); § 12022.7, subd. (a).) On September 12, 2007, he was sentenced to life in prison with the possibility of parole for the attempted murder, with a consecutive term of 25 years to life for the section 12022.53 firearm enhancement.

II. DISCUSSION

A. Issues Related to Witness Declaration


1. Restriction on Attorney-client Discussion of the Flores Declaration

The guilty pleas in Flores's and Rocha's cases were taken in closed proceedings and the reporter's transcripts were sealed by trial court order.[3] At Flores's plea hearing the prosecutor stated that Flores would be permitted to serve his sentence out of state "because he was previously stabbed in the jail. There are very serious concerns about his physical well-being."
Rocha's declaration stated that he understood that he had "to tell the judge in open court and under oath what I myself did on February 17, 2006." In Flores's declaration, on the other hand, he stated: "I understand that I have to tell the judge in open court and under oath that the contents of this declaration are true." He also stated, "I do understand that I may be called as a witness in any hearing related to the events that transpired on February 17, 2006."
At each change-of-plea hearing, the court ordered the declaration to be filed under seal, to be opened only if the prosecution called him to testify about any of the matters covered in the declaration. Defense counsel were *1519 permitted to look at the document, but they were "prohibited from discussing the contents or the existence of the document with their client or any other person." Defense counsel also were not permitted to have a copy of the declarations. As the Attorney General notes, Flores's counsel emphasized that, even if the declaration was opened under those circumstances, it "will not ultimately be part of the paperwork that follows Mr. Flores to his prison commitment." Thereafter, the prosecution provided a written copy to the defense counsel.[4]
Counsel for Townley and Carranco were unsuccessful in moving to withdraw the order not to discuss the contents or existence of the document with their clients. At a hearing from which the defendants were excluded, the court reasoned that it would be improper to rescind the order without Flores's and Rocha's counsel being present. The court did advise defense counsel that if the witnesses testified inconsistently with their statements, then the sealing order "would be undone" and counsel would be free to cross-examine them with the declarations. When the prosecutor asserted that defense counsel had a right to use the documents to cross-examine and impeach them, the court stated, "That's going a little beyond what we put on the record, those plea agreements. The agreement was for their protection." The court agreed with the prosecutor's statement, "So once they take the stand, the order would necessarily disappear because it doesn't make sense anymore."
Neither Flores nor Rocha was on the prosecutor's list of proposed witnesses filed April 27, 2007. Rocha was not called as a witness at trial. Flores was called as a witness on the second day of trial testimony. At the end of the day, in the jury's absence, his attorney was called into a hearing at which the court explained that, "in order to provide for adequate cross-examination of Mr. Flores ... that Counsel be provided with copies of his statement.... [T]he statement may not be shared with the clients. We've already talked about that." "They're subject to the same nondisclosure to clients, to investigator, to other attorneys[. I]t's only to be used by" defense counsel for purposes of cross-examination. "They have to be returned." Carranco's *1520 counsel asked again to be able to discuss it with his client. The court denied the request, pointing out that counsel had a lengthy statement from Flores to the police. The court added, "Put that in your briefcase and do not share it with Mr. Carranco. Put it in [your] briefcase right now."
Direct examination of Flores resumed two trial days later. He was the sole witness on the fifth day of testimony. During Carranco's cross-examination of Flores, the prosecutor successfully objected to defense counsel's reading the title of the document. Carranco's counsel tried to ask Flores about the requirement that he sign the declaration in order to obtain the three-year sentence; again the prosecutor's objection was sustained, as was a question about Flores's methamphetamine use on the night of the shooting. In the jury's absence, the court explained that it also sustained some of the prosecutor's objections because they were "questions about things that weren't in the document ... suggesting to the jury that we'd intentionally omitted facts. And that's misleading." The court stated that "[t]he document is sealed for protection of Mr. Flores." The examination of Flores concluded on the sixth day of testimony. Eventually the trial court took judicial notice of the fact that the declaration was part of the plea bargain and accordingly instructed the jury.
On appeal, Townley contends that the court's restrictions before trial and during examination of Flores violated Townley's Sixth Amendment right to consult with his attorney. Finding no California authority directly on point, we review federal authority.
(1) Maine v. Moulton (1985) 474 U.S. 159 [88 L.Ed.2d 481, 106 S.Ct. 477] recognized at pages 168 and 169: "The right to the assistance of counsel guaranteed by the Sixth and Fourteenth Amendments is indispensable to the fair administration of our adversarial system of criminal justice. [Fn. omitted.] Embodying `a realistic recognition of the obvious truth that the average defendant does not have the professional legal skill to protect himself ...' Johnson v. Zerbst [(1938)] 304 U.S. 458, 462-463 [82 L.Ed. 1461, 58 S.Ct. 1019], the right to counsel safeguards the other rights deemed essential for the fair prosecution of a criminal proceeding."
"The special value of the right to the assistance of counsel explains why `[i]t has long been recognized that the right to counsel is the right to the effective assistance of counsel.'" (United States v. Cronic (1984) 466 U.S. 648, 654 [80 L.Ed.2d 657, 104 S.Ct. 2039], quoting McMann v. Richardson (1970) 397 U.S. 759, 771, fn. 14 [25 L.Ed.2d 763, 90 S.Ct. 1441].)
Courts have recognized that legal assistance can be more effective when attorneys and clients are allowed to confer, consult, and communicate. *1521 Inevitably, there are practical limitations that restrict the opportunities of criminal defendants to consult with their attorneys, including the defendant's custodial status, technological means available, the attorney's other commitments, the availability of courtrooms, and the need for orderly and timely court proceedings. In the context of a request for continuance, the United States Supreme Court has recognized, "Not every restriction on counsel's time or opportunity to investigate or to consult with his client or otherwise to prepare for trial violates a defendant's Sixth Amendment right to counsel." (Morris v. Slappy (1983) 461 U.S. 1, 11 [75 L.Ed.2d 610, 103 S.Ct. 1610].) But when the government unjustifiably interferes with attorney-client communication, the result may be determined to be a violation of a criminal defendant's constitutional "right to the assistance of counsel." (Geders v. United States (1976) 425 U.S. 80, 91 [47 L.Ed.2d 592, 96 S.Ct. 1330] (Geders).)
In Perry v. Leeke (1989) 488 U.S. 272 [102 L.Ed.2d 624, 109 S.Ct. 594] (Perry), the United States Supreme Court discussed 20 cases from federal and state courts (but not California) in footnote 2 on page 277 in support of the proposition: "Federal and state courts since Geders have expressed varying views on the constitutionality of orders barring a criminal defendant's access to his or her attorney during a trial recess." (Cf. Annot., Trial court's order that accused and his attorney not communicate during recess in trial as reversible error under Sixth Amendment guaranty of right to counsel (1989) 95 A.L.R. Fed. 601; Annot., Scope and extent, and remedy or sanctions for infringement, of accused's right to communicate with his attorney (1966) 5 A.L.R.3d 1360.)
In Geders, the United States Supreme Court held "that an order preventing petitioner from consulting his counsel `about anything' during a 17-hour overnight recess between his direct-and cross-examination impinged upon his right to the assistance of counsel guaranteed by the Sixth Amendment." (Geders, supra, 425 U.S. 80, 91.) In Perry, the United States Supreme Court held "that the Federal Constitution does not compel every trial judge to allow the defendant to consult with his lawyer while his testimony is in progress if the judge decides that there is a good reason to interrupt the trial for a few minutes." (Perry, supra, 488 U.S. 272, 284-285.) "[W]hen a defendant becomes a witness, he has no constitutional right to consult with his lawyer while he is testifying." (Id. at p. 281.) In Perry, "[a]t the conclusion of his direct testimony, the trial judge declared a 15-minute recess, and, without advance notice to counsel, ordered that petitioner not be allowed to talk to anyone, including his lawyer, during the break." (Id. at p. 274.)
California decisions are in accord. People v. Zammora (1944) 66 Cal.App.2d 166 [152 P.2d 180] (Zammora) appears to have been a gang case *1522 of sorts (though not a criminal street gang) involving 22 defendants, 12 of whom were convicted of murder and assault with a deadly weapon. (Id. at pp. 173-174.) On appeal, the defendants asserted "that the right of appellants to defend in person and with counsel was unduly restricted by the seating arrangement of the appellants in the courtroom, which, together with certain rulings of the court, prevented the defendants from consulting with their counsel during the course of the trial or during recess periods." (Id. at p. 226.) The defendants were seated in a group in the courtroom at sufficient distance from the five defense counsel as to be unable to confer except by walking the distance between their locations. (Id. at pp. 227, 234.) The court had ordered that counsel not talk to the defendants during court recesses. (Id. at p. 227.)
(2) The appellate court observed: "To us it seems extremely important that, during the progress of a trial, defendants shall have the opportunity of conveying information to their attorneys during the course of the examination of witnesses. The right to be represented by counsel at all stages of the proceedings, guaranteed by both the federal and state Constitutions, includes the right of conference with the attorney, and such right to confer is at no time more important than during the progress of the trial." (Zammora, supra, 66 Cal.App.2d 166, 234.) "The Constitution primarily guarantees a defendant the right to present his case with the aid of counsel. That does not simply mean the right to have counsel present at the trial, but means that a defendant shall not be hindered or obstructed in having free consultation with his counsel, especially at the critical moment when his alleged guilt is being made the subject of inquiry by a jury sworn to pass thereon." (Id. at pp. 234-235.) The convictions were reversed on this basis. (Id. at pp. 235-236.)
People v. Miller (1960) 185 Cal.App.2d 59 [8 Cal.Rptr. 91] presented a different situation. In that case the trial court denied a defendant's request to confer with his attorney in the middle of the defendant's cross-examination. The appellate court concluded, "The refusal of the trial court to permit the defendant to speak to his counsel in the midst of his cross-examination did not constitute an infringement upon his constitutionally guaranteed right to counsel. This right assures a defendant of every reasonable opportunity to consult with his counsel in the preparation and presentation of his defense [citations], but does not confer upon him the right to obstruct the orderly progress of a trial." (Id. at pp. 77-78.)
The court orders in the cases above involved a total ban, though limited temporally, on attorney-client communication, not what we may call a topical ban. None of the above cases involved an order preventing an attorney from *1523 talking with a defendant about a part of the evidence.[5] The same distinction applies to Jones v. Vacco (2d Cir. 1997) 126 F.3d 408, on which Townley relies. In that case, the trial judge ordered the defendant not to talk to his attorney during an overnight break in his cross-examination. (Id. at p. 411.) The court found Geders controlling. (Id. at p. 416.)
Townley also invokes precedent involving court orders containing topical bans of varying durations. In four cases, trial courts barred defense attorneys from discussing the defendant's testimony, though explicitly or implicitly allowing consultation on other topics. In Mudd v. U.S. (D.C. Cir. 1986) 255 U.S. App.D.C. 78 [798 F.2d 1509] (Mudd), the restriction was imposed during a weekend recess between the defendant's direct and cross-examination. (Id. at p. 1510.) In U.S. v. Cobb (4th Cir. 1990) 905 F.2d 784 (Cobb), the restriction was imposed during a weekend recess in the cross-examination of the defendant. (Id. at p. 786.) In U.S. v. Santos (7th Cir. 2000) 201 F.3d 953 (Santos), the restriction was imposed during an overnight recess between the defendant's direct and cross-examinations. The court also essentially told defense counsel to comply with Perry. (Id. at p. 965.) In U.S. v. Sandoval-Mendoza (9th Cir. 2006) 472 F.3d 645 (Sandoval-Mendoza), the restriction was imposed during two morning recesses, a lunch recess, and an overnight recess in the defendant's cross-examination. (Id. at p. 650.)
In Mudd, which predated Perry, the court concluded that, "While the order in this case was indeed more limited than the one in Geders, the interference with [S]ixth [A]mendment rights was not significantly diminished." (Mudd, supra, 798 F.2d at p. 1512.) "[A]n order such as the one in this case can have a chilling effect on cautious attorneys, who might avoid giving advice on non-testimonial matters for fear of violating the court's directive." (Ibid.)
The court in Cobb had "no difficulty in concluding that the trial court's order, although limited to discussions of Cobb's ongoing testimony, effectively denied him access to counsel." (Cobb, supra, 905 F.2d at p. 792.)
Santos concluded, "Perry makes clear, as do the cases before and after it (though some of the `before' cases go too far, by forbidding any limit on discussions between lawyer and client), that while the judge may instruct the lawyer not to coach his client, he may not forbid all `consideration of the defendant's ongoing testimony' during a substantial recess, 488 U.S. at 284, *1524 since that would as a practical matter preclude the assistance of counsel across a range of legitimate legal and tactical questions, such as warning the defendant not to mention excluded evidence." (Santos, supra, 201 F.3d at p. 965.) The appellate court concluded that defense counsel in that case "was given confusing marching orders that may well have inhibited the exercise of Sixth Amendment rights" (Id. at p. 966.)
In 2006, the Ninth Circuit, in reliance on Geders and Perry, concluded in Sandoval-Mendoza "that trial courts may prohibit all communication between a defendant and his lawyer during a brief recess before or during cross-examination, but may not restrict communications during an overnight recess." (Sandoval-Mendoza, supra, 472 F.3d at p. 651, fn. omitted.) In view of this rule, the trial court "erred in prohibiting Sandoval-Mendoza and his lawyer from discussing his testimony during an overnight recess." (Id. at p. 652.)[6]
Perry explained that a criminal defendant's right to the assistance of counsel does not include obtaining advice during short trial recesses about how to answer ongoing cross-examination. However, it does protect "the normal consultation between attorney and client that occurs during an overnight recess [which] would encompass matters that go beyond the content of the defendant's own testimonymatters that the defendant does have a constitutional right to discuss with his lawyer, such as the availability of other witnesses, trial tactics, or even the possibility of negotiating a plea bargain." (Perry, supra, 488 U.S. 272, 284, italics added.)
Despite this language in Perry, one decision, on which the Attorney General heavily relies, has upheld an order barring a defense attorney from identifying to the defendant one of the witnesses anticipated the following day at trial. In Morgan v. Bennett (2d Cir. 2000) 204 F.3d 360 (Morgan), the Second Circuit Court of Appeals concluded "that Geders and Perry stand for the principle that the court should not, absent an important need to protect a countervailing interest, restrict the defendant's ability to consult with his *1525 attorney, but that when such a need is present and is difficult to fulfill in other ways, a carefully tailored, limited restriction on the defendant's right to consult counsel is permissible." (Id. at p. 367.)
In Morgan, the defendant was charged with murder as well as the attempted murder of a former girlfriend. The girlfriend was a potential witness. Before trial, she declined to testify because two associates of the defendant had made threatening statements while visiting her in jail. The defendant had also been making comments to the witness in the courthouse halls. (Morgan, supra, 204 F.3d at pp. 362-363.) It was apparently to avoid further witness intimidation that the trial court made its order. (Id. at p. 368.)
The appellate court stated: "In the present case, the problem addressed by the state trial court's limited gag order was far more troubling than the possibility of witness coaching involved in Geders and Perry, for intimidation of witnesses raises concerns for both the well-being of the witness and her family and the integrity of the judicial process." (Morgan, supra, 204 F.3d at p. 367.) The court concluded "that valid concerns for the safety of witnesses and their families and for the integrity of the judicial process may justify a limited restriction on a defendant's access to information known to his attorney." (Id. at p. 368.)
The court upheld the order, observing that its impact was quite limited. The attorney and client could discuss everything except the expected appearance of one witness. Since the witness had already been scheduled to testify, defense counsel presumably was already prepared to cross-examine her, so there was no impact on counsel's preparation. (Morgan, supra, 204 F.3d at p. 368.)
Again, we find California law in general accord. At issue in Alvarado v. Superior Court (2000) 23 Cal.4th 1121 [99 Cal.Rptr.2d 149, 5 P.3d 203] (Alvarado) was not an order confining information to defense counsel, but "the validity of an order, entered prior to trial in a criminal action, that authorizes the prosecution to refuse to disclose to the defendants or their counsel, both prior to and at trial, the identities of the crucial witnesses whom the prosecution proposes to call at trial, on the ground that disclosure of the identities of the witnesses is likely to pose a significant danger to their safety." (Id. at p. 1125, some italics added.) The court concluded that it violated neither the right of confrontation nor due process to keep a witness's identity secret before trial for good cause. (Id. at pp. 1034-1036.) "`Good cause' is limited to threats or possible danger to the safety of a victim or witness, possible loss or destruction of evidence, or possible compromise of other investigations by law enforcement." (Pen. Code, § 1054.7.) The court noted that, included in California discovery statutes in the Penal Code, "is the *1526 requirement that a prosecutor disclose the names and addresses of the individuals whom he or she intends to call at trial. (§ 1054.1, subd. (a).) The disclosure may be made to defense counsel, who is prohibited from revealing, to the defendant or others, information that identifies the address or telephone number of the prosecution's potential witnesses, absent permission by the court after a hearing and a showing of good cause. (§ 1054.2.)" (Alvarado, supra, at p. 1132.)
The Supreme Court found that "the evidence presented to the trial court clearly justified its order protecting the witnesses' identities before trial." (Alvarado, supra, 23 Cal.4th at p. 1136.) In issuing its order after a series of in camera hearings from which the defense was excluded, the trial court explained in part: the charged crime was apparently an organized jailhouse murder of a snitch ordered by the Mexican Mafia prison gang; the Mexican Mafia is known for ordering the murders of other snitches and it has an excellent intelligence gathering network; before such a murder is ordered, the gang has an informal trial based in part on paperwork identifying the snitch; and one of the three prospective witnesses had been cut while in jail and warned not to testify. (Id. at pp. 1128-1129.)
As to precluding pretrial disclosure to the defense, the court stated: "we are keenly aware of the serious nature and magnitude of the problem of witness intimidation. [Fn. omitted.] Further, we agree that the state's ability to afford protection to witnesses whose testimony is crucial to the conduct of criminal proceedings is an absolutely essential element of the criminal justice system. As we have explained, a trial court has broad discretion to postpone disclosure of a prospective witness's identity in order to protect his or her safety, and may restrict such pretrial disclosure to defense counsel (and ancillary personnel) alone." (Alvarado, supra, 23 Cal.4th at pp. 1149-1150.)
However, the Supreme Court reached a different conclusion about the impact on the rights of confrontation and cross-examination of keeping a witness anonymous during trial. The court reviewed United States Supreme Court authority requiring witnesses in criminal trials in general to provide their names and residences during cross-examination and a number of California and federal appellate opinions considering whether danger to the witness changed those requirements. (Alvarado, supra, 23 Cal.4th at pp. 1141-1146.) It summarized precedent as follows on page 1146: "In short, although the People correctly assert that the confrontation clause does not establish an absolute rule that a witness's true identity always must be disclosed, in every case in which the testimony of a witness has been found crucial to the prosecution's case the courts have determined that it is improper at trial to withhold information (for example, the name or address of the witness) essential to the defendant's ability to conduct an effective *1527 cross-examination. (Accord, Roviaro v. United States [(1957)] 353 U.S. 53 [1 L.Ed.2d 639, 77 S.Ct. 623] [when an informant is a material witness on the issue of guilt, the prosecution must disclose his or her identity or incur a dismissal]; Eleazer v. Superior Court (1970) 1 Cal.3d 847, 851-853 [83 Cal.Rptr. 586, 464 P.2d 42] [when an informant is a material witness to the crime of which the defendant is accused, the prosecution must disclose the informant's name and whereabouts]; People v. Garcia (1967) 67 Cal.2d 830 [64 Cal.Rptr. 110, 434 P.2d 366] [same].) [Fn. omitted.]"
The court concluded in Alvarado, "the state's legitimate interest in protecting individuals who, by chance or otherwise, happen to become witnesses to a criminal offense cannot justify depriving the defendant of a fair trial. Thus, when nondisclosure of the identity of a crucial witness will preclude effective investigation and cross-examination of that witness, the confrontation clause does not permit the prosecution to rely upon the testimony of that witness at trial while refusing to disclose his or her identity." (Alvarado, supra, 23 Cal.4th at p. 1151.) "[W]e conclude that the trial court erred in ruling, on the record before it, that the witnesses in question may testify anonymously at trial." (Id. at p. 1149, fn. omitted.)
It is also relevant to our analysis that a criminal defendant in California is generally entitled to discover before trial "[r]elevant written ... statements of witnesses ... whom the prosecutor intends to call at the trial." (Pen. Code, § 1054.1, subd. (f); cf. Funk v. Superior Court (1959) 52 Cal.2d 423, 424 [340 P.2d 593].) People v. Fauber (1992) 2 Cal.4th 792 [9 Cal.Rptr.2d 24, 831 P.2d 249] stated on page 821: "[T]he existence of a plea agreement is relevant impeachment evidence that must be disclosed to the defense because it bears on the witness's credibility. (Giglio v. United States (1972) 405 U.S. 150, 153-155 [31 L.Ed.2d 104, 92 S.Ct. 763].) Indeed, we have held that `when an accomplice testifies for the prosecution, full disclosure of any agreement affecting the witness is required to ensure that the jury has a complete picture of the factors affecting the witness's credibility.' (People v. Phillips (1985) 41 Cal.3d 29, 47 [222 Cal.Rptr. 127, 711 P.2d 423].)"[7]
*1528 With the foregoing precedent in mind, we examine the order at issue and the parties' contentions. Absent countervailing considerations, Flores's written statement should have been disclosed to the defense during pretrial discovery once the prosecutor determined to call him as a witness, particularly because it reflected a plea agreement that was potentially relevant to his credibility. In this case, there were apparently some countervailing considerations that motivated the trial court to order the conditional sealing of the statement as well as the reporter's transcript of Flores's change of plea hearing that contained the court's sealing order. Flores's counsel expressed his concern that the paperwork not follow him into prison. The court several times stated that the order was made for the protection of Flores.
On appeal, the Attorney General asserts that "[t]his state's policy of protecting witnesses from bodily harm and intimidation is in accord with the principles in Morgan." "[T]he trial court's order here was narrowly tailored to address a compelling need to protect witness Flores's life. Flores was a cooperating witness in a gang-motivated attempted murder. He had been assaulted and stabbed with a knife while in pretrial custody." Citing a Web site and the facts in People v. Reyes (2008) 165 Cal.App.4th 426, 429 [80 Cal.Rptr.3d 619], the Attorney General claims, "[i]t is well established that a cooperating witness's assistance to law enforcement is severely punished (usually with death) when the `paperwork' documenting the individual's cooperation becomes known to the gang community."
This assertion is an attempt to create a record that was not made in this case to justify a restriction broader than the one upheld in Morgan, supra, 204 F.3d 360. In that case, defense counsel was prohibited from disclosing that the attempted murder victim would be appearing as a witness the following day. In this case, defense counsel was prohibited, as best we can tell, from both showing Flores's written declaration to Townley and discussing its contents with him, whether before, during, or after Flores's testimony at trial. Contrary to the Attorney General's characterization, this went well *1529 beyond "simply prevent[ing] the documentary evidence of Flores's cooperation... from being circulated through [Townley] into jail and prison populations." If that were the court's objective, it could have been served by a much more limited order prohibiting counsel from providing Townley with a copy, while permitting discussion of its contents.
The Attorney General asserts that the "order did not materially impede defendant's ability to consult with his attorney about Flores's knowledge of the crime and his statements." After all, Townley and his counsel had access to a police report of an interview of Flores. According to the Attorney General, "[t]hese statements were substantially similar." According to a part of Townley's petition for rehearing that was filed under seal, there are 23 different details in the declaration. Since the declaration remains under seal, it would be improper for us to discuss purported differences in an opinion that will become part of the public record. To the extent there was no difference between the report and the declaration, we perceive no need to prohibit defense counsel from discussing the contents of the declaration with Townley. But we have to wonder why the prosecutor drafted a declaration for Flores to sign if his other pretrial statements were equally incriminatory.
The Attorney General further points out that Townley did eventually learn at trial about the existence and contents of Flores's sealed declaration, at least to the extent that its contents were brought out during direct and cross examination of Flores. The Attorney General asserts that "nothing in the court's order prevented counsel from discussing fully with his client Flores's testimony at trial."
We do not believe that the scope of the court's order was that clear. During in limine motions, the court acceded to the prosecutor's statement that "the order would necessarily disappear" once Flores or Rocha took the witness stand. But later, during the direct examination of Flores, the court denied a request by Carranco's counsel to discuss the statement with his client and instructed counsel to put the written statement in his briefcase immediately. The court had initially explained the terms and conditions of the sealing order at Flores's change of plea hearing, but Townley's attorney was not present at that hearing and its transcript was itself sealed, at least initially. As restated by the court during the trial, the order could be reasonably interpreted as prohibiting counsel from discussing the contents of the declaration with Townley even after Flores testified to the contents. Any ambiguity in the sealing order could well encourage defense counsel to err on the side of caution to avoid the risk of "inviting the judge's wrath, and possibly even courting sanctions for contempt of court, in disobeying the judge's instruction." (Santos, supra, 201 F.3d 953, 966.)
*1530 For the sake of discussion, we will accept the holding of Morgan, supra, 204 F.3d 360, "that the court should not, absent an important need to protect a countervailing interest, restrict the defendant's ability to consult with his attorney, but that when such a need is present and is difficult to fulfill in other ways, a carefully tailored, limited restriction on the defendant's right to consult counsel is permissible." (Id. at p. 367.)
(3) Even under this test, the challenged order exhibits fatal defects. As indicated above, it was not carefully tailored to serve the objective of keeping "paperwork" out of the hands of prison gangs. Instead, it appears to have been tailored to allow the prosecution to produce trial testimony that was a surprise to Townley, if not his counsel. It was also tailored to impede counsel's investigation of the accuracy of the declaration, as he was prohibited from discussing its contents with Townley, his investigator, and anyone else.
In addition, assuming that such a nondisclosure order could be justified based on an "important need" for witness protection, there was no express finding or showing of this kind of good cause. Rule 2.550 of the California Rules of Court provides in part: "Unless confidentiality is required by law, court records are presumed to be open." (Id., subd. (c).) "The court may order that a record be filed under seal only if it expressly finds facts that establish: [¶] (1) There exists an overriding interest that overcomes the right of public access to the record; [¶] (2) The overriding interest supports sealing the record; [¶] (3) A substantial probability exists that the overriding interest will be prejudiced if the record is not sealed; [¶] (4) The proposed sealing is narrowly tailored; and [¶] (5) No less restrictive means exist to achieve the overriding interest." (Id., subd. (d).)[8]
We do not discount the evidence that Flores was stabbed in jail. But we see neither evidence nor a finding in the record that this assault was directed or intended by Townley or his codefendant or the Mexican Mafia or any other gang to silence Flores in this case. There is no allusion in the sealed record to other hearings at which Flores or the prosecution made such a showing. On this point, the record pales in comparison to the evidence of witness intimidation before the trial courts in Morgan and in Alvarado. And we note that, despite the compelling showing made in Alvarado, the California *1531 Supreme Court concluded that it did not justify allowing witnesses in a prison gang case to testify anonymously at trial. In that case, the court discussed a number of other ways by which the government could attempt to ensure witness safety and prevent witness intimidation. (Alvarado, supra, 23 Cal.4th 1121, 1150-1151.) In seeking to accomplish these worthy objectives, trial courts should consider the entire range of available alternatives before imposing orders that restrict open communication and consultation between criminal defendants and their counsel about the written pretrial statements of prosecution witnesses against the defendant.
Without more evidence of good cause for a court order barring defense counsel from discussing the contents of Flores's written declaration with Townley, we conclude that this order unjustifiably infringed on Townley's constitutional right to the effective assistance of counsel.
(4) The remaining question is what standard of prejudice applies to such a constitutional violation. That was the question on which the United States granted certiorari in Perry, supra, 488 U.S. 272. (Id. at p. 277.) The court concluded, "[t]here is merit in petitioner's argument that a showing of prejudice is not an essential component of a violation of the rule announced in Geders. In that case, we simply reversed the defendant's conviction without pausing to consider the extent of the actual prejudice, if any, that resulted from the defendant's denial of access to his lawyer ...." (Id. at pp. 278-279.) The court distinguished its later discussion in Strickland v. Washington (1984) 466 U.S. 668 [80 L.Ed.2d 674, 104 S.Ct. 2052] of "the standard for determining whether counsel's legal assistance to his client was so inadequate that it effectively deprived the client of the protections guaranteed by the Sixth Amendment." (Perry, supra, at p. 279.) Strickland's citation of Geders "was intended to make clear that `[a]ctual or constructive denial of the assistance of counsel altogether' [citation], is not subject to the kind of prejudice analysis that is appropriate in determining whether the quality of a lawyer's performance itself has been constitutionally ineffective." (Id. at p. 280.)
Despite this clear holding, the Attorney General argues that the automatic reversal rule adopted by Perry does not qualify under later United States Supreme Court rules for identifying structural error.
United States v. Gonzalez-Lopez (2006) 548 U.S. 140 [165 L.Ed.2d 409, 126 S.Ct. 2557] explained this concept at pages 148 and 149. "In Arizona v. Fulminante, 499 U. S. 279 [113 L.Ed.2d 302, 111 S.Ct. 1246] (1991), we divided constitutional errors into two classes. The first we called `trial error,' because the errors `occurred during presentation of the case to the jury' and their effect may `be quantitatively assessed in the context of other evidence *1532 presented in order to determine whether [they were] harmless beyond a reasonable doubt.' Id., at 307-308 (internal quotation marks omitted). These include `most constitutional errors.' Id., at 306. The second class of constitutional error we called `structural defects.' These `defy analysis by "harmless-error" standards' because they `affec[t] the framework within which the trial proceeds,' and are not `simply an error in the trial process itself.' Id., at 309-310. [Fn. omitted.] See also Neder v. United States, 527 U. S. 1, 7-9 [144 L.Ed.2d 35, 119 S.Ct. 1827] (1999). Such errors include the denial of counsel, see Gideon v. Wainwright, 372 U. S. 335 [9 L.Ed.2d 799, 83 S.Ct. 792] (1963), the denial of the right of self-representation, see McKaskle v. Wiggins, 465 U. S. 168, 177-178, n. 8 [79 L.Ed.2d 122, 104 S.Ct. 944] (1984), the denial of the right to public trial, see Waller v. Georgia[, supra], 467 U. S. 39, 49, n. 9 ..., and the denial of the right to trial by jury by the giving of a defective reasonable-doubt instruction, see Sullivan v. Louisiana, 508 U. S. 275 [124 L.Ed.2d 182, 113 S.Ct. 2078] (1993)." To that list of structural errors, United States v. Gonzalez-Lopez, supra, 548 U.S. 140 added "erroneous deprivation of the right to counsel of choice." (Id. at p. 150.)
The United States Supreme Court has not expressly considered whether Geders involved a structural defect or a trial error. Some federal courts have avoided answering this question by finding other reversible error. (Sandoval-Mendoza, supra, 472 F.3d 645, 652; Santos, supra, 201 F.3d 953, 966.) However, Geders was among the cases cited in footnote 25 of United States v. Cronic, supra, 466 U.S. 648 for the proposition, "The Court has uniformly found constitutional error without any showing of prejudice when counsel was either totally absent, or prevented from assisting the accused during a critical stage of the proceeding." (Id. at p. 659, fn. 25.) Jones v. Vacco, supra, 126 F.3d 408 stated, "Inherent in Geders, and later made explicit, is the presumption that prejudice is so likely to follow a violation of a defendant's Sixth Amendment right to counsel that it constitutes a structural defect which defies harmless error analysis and requires automatic reversal." (Id. at p. 416.)
Mudd, supra, 798 F.2d 1509, which was decided before Perry, reasoned: "We find that a per se rule best vindicates the right to the effective assistance of counsel. To require a showing of prejudice would not only burden one of the fundamental rights enjoyed by the accused [citation], but also would create an unacceptable risk of infringing on the attorney-client privilege. [Citation.] The only way that a defendant could show prejudice would be to present evidence of what he and counsel discussed, what they were prevented from discussing, and how the order altered the preparation of his defense." (Id. at p. 1513.)
We need not wander far afield to determine whether the United States Supreme Court meant what it said in Perry. The Attorney General provides *1533 no authority that the United States Supreme Court has retreated from that holding. The Attorney General's attempts to minimize the impact of the restriction in this case of "counsel's ability to confer with his client on one very limited topic" do not alter our conclusion that on this topicthe written declaration of an accomplice who was a significant witness at trialTownley was deprived by court order of the effective assistance of counsel. It follows that Townley is entitled to reversal without making a showing of prejudice resulting from this error. In light of this conclusion, we consider other issues only to the extent necessary to provide guidance in the event of a retrial. We need not and do not reach Townley's claims of prosecutorial misconduct and improper judicial comment.

2. Testimony by Flores to a Particular Version of Facts

(5) "A prosecutor may grant immunity from prosecution to a witness on condition that he or she testify truthfully to the facts involved. (People v. Green (1951) 102 Cal.App.2d 831, 838-839 [228 P.2d 867].)" (People v. Boyer (2006) 38 Cal.4th 412, 455 [42 Cal.Rptr.3d 677, 133 P.3d 581].) "[A]n agreement [that] requires only that the witness testify fully and truthfully is valid, and indeed such a requirement would seem necessary to prevent the witness from sabotaging the bargain." (People v. Fields (1983) 35 Cal.3d 329, 361 [197 Cal.Rptr. 803, 673 P.2d 680].) "But if the immunity agreement places the witness under a strong compulsion to testify in a particular fashion, the testimony is tainted by the witness's self-interest, and thus inadmissible. (People v. Medina (1974) 41 Cal.App.3d 438, 455 [116 Cal.Rptr. 133].) Such a `strong compulsion' may be created by a condition `"that the witness not materially or substantially change her testimony from her tape-recorded statement already given to ... law enforcement officers."' (People v. Medina, supra, 41 Cal.App.3d at p. 450.)" (People v. Boyer, supra, 38 Cal.4th at p. 455.)
In this case Townley contends that Flores's declaration compelled him to testify to the version of facts contained in that document or risk being prosecuted for perjury and losing the benefit of his plea bargain. That compulsion, Townley insists, "tainted" Flores's testimony, resulting in error that was prejudicial in light of the importance the prosecutor placed on this testimony. We disagree. In the declaration Flores averred that the statements he was making in the document were "true under penalty of perjury." He had discussed his statement with his attorney and had not been threatened or offered an agreement to testify in exchange for telling the truth in the declaration, aside from the plea agreement his attorney had negotiated. Flores's understanding that he would be expected toindeed, "have to"tell the judge that he had made truthful statements in the declaration did not nullify his claim in the declaration itself that he was telling the truth. The trial *1534 court properly interpreted Flores's statement to mean that if he testified, he must do so truthfully. Furthermore, we have taken judicial notice of a subsequent modification of Flores's declaration. The challenged sentence was replaced with the following: "I understand that I have to acknowledge to the Judge in open court and under oath that the contents of this declaration are true at the time of the entrance of my plea." Also added was Flores's handwritten statement, "I understand if called as a witness I must tell the truth." Flores was cross-examined on these changes at trial.
In these procedural circumstances we find no error. The declaration at issue does not compare to People v. Medina, supra, 41 Cal.App.3d at page 450, where accomplice witnesses were given immunity on the condition that they not "materially or substantially" alter their testimony from the recorded account they had given to the police. Also clearly distinguishable is People v. Green, supra, 102 Cal.App.2d at pages 838-839, where the accomplice was promised dismissal of the case against him if his testimony resulted in the defendant's being held to answer for the same charges. It was not improper to require the witness to tell the truth in court.

3. Earlier Versions of Witness Declarations

Townley next contends that he should have been afforded the opportunity to inspect previous versions of Flores's and Rocha's declarations, which they had declined to sign, along with correspondence between the prosecutor and Flores about factual scenarios Flores refused to confirm. In Townley's view, these materials were discoverable under section 1054 and its predecessor authority, People v. Westmoreland (1976) 58 Cal.App.3d 32 [129 Cal.Rptr. 554]. In Westmoreland, the court held that the prosecutor must disclose to the defense "any discussions he may have had with the potential witness as to the possibility of leniency in exchange for favorable testimony even though no offer actually was made or accepted." (58 Cal.App.3d at pp. 46-47.) Townley further argues that the withholding of these "discussions of leniency" denied him his constitutional rights to due process and confrontation of witnesses.
The trial court expressed the view that prior drafts of the witnesses' plea agreements were "not evidence of anything." It did, however, query whether an unsigned version might allow the jury to find a discrepancy worth exploring at trial. The prosecutor maintained that this was work product, a "creature of [her] head" which was not discoverable, and the People adhere to this position on appeal. After extensive discussion among counsel and the court, the court reiterated its opinion that an unsigned declaration was not evidence of anything and that no obligation to produce it arose under Brady v. Maryland (1963) 373 U.S. 83 [10 L.Ed.2d 215, 83 S.Ct. 1194].
*1535 We find no error in this ruling. Even discounting the People's position that the prosecutor's suggested version represented her work product, we nonetheless agree with the court that the unsigned declaration was not relevant or material evidence. This case does not present facts similar to those in Westmoreland, where the prosecutor remained silent while the witness falsely testified that he had not been offered the opportunity to plead guilty to a lesser offense. Here there was no attempt to mislead the jury or any arrangement that was not disclosed to the defense. Flores was not promised leniency beyond the negotiated disposition of his case. And here the witness did not agree to any version of the document except the one he signed. That was the relevant evidence that was material to Flores's credibility, and on that document defense counsel were permitted to cross-examine the witness.
Furthermore, even if any prior draft was material evidence favorable to the defense, any error in excluding it was harmless beyond a reasonable doubt. (Cf. People v. Phillips, supra, 41 Cal.3d 29, 48 [failure to disclose agreement between prosecution and witness's attorney but not communicated to witness harmless error].) The jury was fully informed of the details of the plea bargain between Flores and the prosecution. He was cross-examined on the discrepancy between his testimony and his declaration, including the statement in the declaration that he had been wearing a "red and black Pendleton shirt" on the night of the shooting. In addition, the court instructed the jury that Flores's declaration was part of his plea agreement with the prosecution. The withholding of the earlier versions offered to Flores was not prejudicial to Townley.

B. Exclusion of Defendants During Discussions of Declarations

(6) Townley next claims that his exclusion from hearings at which the declarations were discussed violated his constitutional right to be present at critical stages of the proceedings against him. "The rule is established that a defendant has a federal constitutional right that emanates not only from the confrontation clause of the Sixth Amendment but also from the due process clause of the Fourteenth Amendment to be present at any stage of the criminal proceedings `"that is critical to its outcome if his presence would contribute to the fairness of the procedure."' [Citation.]" (People v. Marks (2007) 152 Cal.App.4th 1325, 1332-1333 [62 Cal.Rptr.3d 322].) It is also settled, however, that "a defendant does not have a right to be present at every hearing held in the course of a trial. `During trial, a defendant is not entitled to be personally present at the court's discussions with counsel occurring outside the jury's presence on questions of law or other matters unless the defendant's presence bears a reasonable and substantial relation to a full opportunity to defend against the charges. [Citation.] A defendant claiming a violation of the right to personal presence at trial bears the burden *1536 of demonstrating that personal presence could have substantially benefited the defense. [Citation.]'" (People v. Price (1991) 1 Cal.4th 324, 407-408 [3 Cal.Rptr.2d 106, 821 P.2d 610].)
Townley has not met that burden. He has not shown that his physical presence would have contributed to his attorney's efforts to secure a retraction of the order to withhold the declarations from him. Nor does he offer argument to support the bare assertion that "the error was not harmless beyond a reasonable doubt."

C. Admission of Witness Statements for Impeachment

At trial the prosecution called Anthony Gonzalez and Sarah Oreb, who were among the teenagers at Gonzalez's Harper Street apartment when Townley arrived with Flores, Carranco, and Rocha. Oreb, who was Gonzalez's girlfriend at the time, said that she was "pretty drunk" when sheriffs arrived. To one of the officers, Stefan Fish, however, Oreb appeared to be sober. Several of the teenagers were taken to the sheriff's office for interrogation.
During her first interview by Detective Pintabona, Oreb said she saw the white Honda, a statement she denied at trial. Oreb contributed no further information to Pintabona; she swore "on [her] life up and down" that she did not hear anyone say what Pintabona quoted four others as saying, that the visitors to Gonzalez's apartment had "just shot some scraps." Even when Pintabona insinuated that she could be treated as an accessory, she insisted that she was telling him the truth and that he was "badgering" her to get her to lie. While sitting with the others in the hallway, Oreb saw Gonzalez being taken into custody. A short time later, angry and frustrated, she was reinterviewed. This time Oreb said she heard the words "hit" or "scrap." At trial, she explained that she had told that to Pintabona only so that she could go home. By that time it was almost 7:00 a.m.; she had not slept and had not eaten since the evening.
Stefan Fish, a sergeant by the time of trial, testified that the day after the shooting, Oreb contacted him by telephone and agreed to meet with him because she "felt bad" that she had not previously told the investigator what she had heard the night before. Oreb said that she was at the window in Gonzalez's apartment when she heard one of the people outside say that a "Scrap got hit."
At trial Oreb recanted much of her statement to the police. During examination as a hostile witness by the prosecution, she denied hearing the words "I hit a scrap" spoken outside the window. She testified that the police took her and her friends to the police station, where she told the officers that *1537 she had not heard anything outside the window. The police did not believe her, and they kept threatening to lock her up "just like [her] boyfriend," so she eventually lied and told the officer what he wanted to hear. Oreb denied telling Sergeant (then Deputy) Fish that she felt bad about lying the day before; she initiated the contact only to ask him why Gonzalez had been arrested.
In light of Oreb's adamant retraction, the prosecutor sought to play for the jury a recording of the first police interview between Officer Pintabona and Oreb. Over defense objections, the court allowed the evidence, finding that Oreb's trial testimony was "a fabrication .... It was really shocking." Based on a draft prepared jointly by Townley's counsel and the prosecutor, the trial court gave the jury a cautionary instruction about the use of that evidence. The court explained that any opinion, conclusion, or summary of the facts by the officer was an interviewing technique which could not be used as evidence of either defendant's guilt. The jury was admonished to "totally discount what the police officer says," particularly those statements that the officers "know things" about the defendants. Instead, the jurors were permitted to weigh what they heard in the taped interview against what Oreb had said on the witness stand "about how that interview was conducted."
On appeal, Townley contends that Oreb's incriminating statements should not have been admitted because they were coerced: She was only 16 years old, she was intoxicated, she was deprived of food and sleep for six hours, and she was threatened without Miranda warnings (Miranda v. Arizona (1966) 384 U.S. 436 [16 L.Ed.2d 694, 86 S.Ct. 1602]) before she finally told the officer what he wanted to hear to avoid being arrested.
The evidence on these points was not so straightforward, however. Oreb did not appear to be inebriated to Deputy Fish when he arrived at the apartment. At trial Oreb said she arrived at 1:00 or 2:00 in the morning; yet during the interviewwhich appears to have lasted between 30 minutes and an hourPintabona mentioned that it was 3:00 a.m. After listening to the compact disc recording, Oreb conceded that she was not threatened, but only felt threatened. She also admitted that she was not threatened during the second interview when she told the detective "what he wanted to hear." The trial court found that "Oreb's statements about what happened during the interview were quite consistent with what happened during the interview." The transcripts of her trial testimony and the recorded interview support this factual conclusion. Oreb resisted the officer's attempt to persuade her to accede to his account of the statement about shooting a "scrap." She admitted that there was no badgering or threats in the second interview, at which she voluntarily admitted hearing the reference to "scraps." And even if the second interview was a product of the earlier pressure, the effect did not carry over *1538 to the contact with Deputy Fish the next day, which she initiated by asking specifically for him. Oreb told the deputy that she had heard the words "hit" and "scrap," and that she felt bad for not having admitted this earlier. There is no evidence that this disclosure was precipitated by trauma or the fear of arrest; Oreb herself denied having repeated those words and explained that she had contacted the deputy only to discuss Gonzalez's arrest.
Additionally, almost six weeks after the shooting, while Gonzalez was out of custody, Oreb met with Detective Montes, who investigated gang-related cases for the district attorney's office. Montes showed a photo spread to Oreb. In the course of their meeting, she told him that at the window of Gonzalez's apartment she had overheard "somebody say they hit a scrap." Oreb was not threatened with custody, nor was Gonzalez in custody at that time. She mentioned the statement three times, and her demeanor was "[c]alm, patient, soft spoken[, and] pleasant." She was cooperative, "[j]ust fine."
Finally, in none of the interviews did she attribute the "scrap" reference to Townley. Taking all of these circumstances into account, we find no conceivable prejudice from Oreb's statements. Any error in admitting the assertedly coerced statement was harmless beyond a reasonable doubt. (Cf. People v. Cahill (1993) 5 Cal.4th 478, 510 [20 Cal.Rptr.2d 582, 853 P.2d 1037] [adopting the federal prejudice standard for evaluating admission of defendant's coerced confession]; Arizona v. Fulminante, supra, 499 U.S. at pp. 306-312 [111 S.Ct. 1246]; see also People v. Lee (2002) 95 Cal.App.4th 772, 789 [115 Cal.Rptr.2d 828] [coerced identification of defendant not harmless beyond a reasonable doubt where other evidence of defendant's guilt insufficient].)
When police officers arrived at the Harper Street apartment, they saw that Gonzalez was drunk and was being held up by Oreb. Sergeant Sulay thought Gonzalez was "probably still under the influence" when he was at the station being interviewed, an impression reinforced by Gonzalez at trial. During the interview, however, he said he did not think he was still drunk.
The transcript of the interview with Gonzalez reflected his persistent denials of knowledge. Eventually, the interviewer arrested Gonzalez "for accessory to attempted murder" because he was "covering up." At that point he was read his Miranda rights. That interview lasted about 45 minutes in the early morning of February 18, 2006. In a second conversation with Sergeant Sulay, Gonzalez offered the statement that Townley had come to his house and said, "We beat up some scrap," and shortly afterward the police showed up and started "harassing" him and the rest of the group. At trial Gonzalez said that he did not recall making this statement.
*1539 (7) Townley contends that Gonzalez, like Oreb, was coerced into giving the inculpatory statement. We disagree. The first interview was not unduly prolonged, nor, contrary to Gonzalez's claim at trial, did the interviewer tell him what he wanted Gonzalez to say. The evidence of Gonzalez's degree of inebriation was conflicting. The bare fact that the interviewer advised Gonzalez that if he withheld information he could be considered an accessory after the fact did not in itself make his later statement involuntary. "There is nothing improper in confronting a suspect with the predicament he or she is in, or with an offer to refrain from prosecuting the suspect if the witness will cooperate with the police investigation. More is needed to show that testimony is the inadmissible product of coercion ...." (People v. Daniels (1991) 52 Cal.3d 815, 863 [277 Cal.Rptr. 122, 802 P.2d 906].) Unlike the defendant in People v. Lee, supra, 95 Cal.App.4th 772, on which Townley relies, neither Oreb nor Gonzalez was threatened with an accusation of the charged crime itself. Our independent review reveals no coercion in violation of Townley's due process rights.

D. Instruction on Voluntary Intoxication

Jeanne Taylor, who was the passenger in the car driven by Julie Dufresne, testified at trial that she saw three young men running across the street in front of the car. The shorter one in the red and black plaid Pendleton jacket (which she recognized when shown People's exhibit No. 23) was memorable because he had a "staggered ga[it]" and was "almost stumbling." Having been professionally involved in body mechanics, Taylor thought the gait "looked like a staggering drunk in an attempt to run.... Not losing his balance, just having difficulty with his coordination."
Townley contends that in light of this testimony, the trial court had a duty to instruct the jury on voluntary intoxication with CALCRIM No. 626. Recognizing that he did not request such instruction, he argues that it should have been given sua sponte because there was substantial evidence that the shooter was voluntarily intoxicated. If the jury had received the instruction, Townley maintains, the jury might not have found intent to kill or premeditation and deliberation.
(8) Townley's argument cannot succeed. The Supreme Court has repeatedly held that "an instruction on voluntary intoxication, explaining how evidence of a defendant's voluntary intoxication affects the determination whether defendant had the mental states required for the offenses charged, is a form of pinpoint instruction that the trial court is not required to give in the absence of a request." (People v. Bolden (2002) 29 Cal.4th 515, 559 [127 Cal.Rptr.2d 802, 58 P.3d 931], citing People v. Saille (1991) 54 Cal.3d 1103, 1120 [2 Cal.Rptr.2d 364, 820 P.2d 588]; see also People v. Rundle (2008) 43 *1540 Cal.4th 76, 145 [74 Cal.Rptr.3d 454, 180 P.3d 224], disapproved on another point in People v. Doolin (2009) 45 Cal.4th 390, 421, fn. 22 [87 Cal.Rptr.3d 209, 198 P.3d 11].) Nor would it have been error to refuse the instruction had there been a request. "A defendant is entitled to such an instruction only when there is substantial evidence of the defendant's voluntary intoxication and the intoxication affected the defendant's `actual formation of specific intent.'" (People v. Williams (1997) 16 Cal.4th 635, 677 [66 Cal.Rptr.2d 573, 941 P.2d 752]; accord, People v. Roldan (2005) 35 Cal.4th 646, 715 [27 Cal.Rptr.3d 360, 110 P.3d 289].) Jeanne Taylor was the only witness who suggested that the person wearing exhibit No. 23 "looked like a staggering drunk" as he ran across the street; no other witness made any observation or reported that he had been drinking, much less that he was incapable of forming the requisite intent for attempted murder. It is not remotely probable that the jury could have had a reasonable doubt on the question of whether Townley was "not conscious of his actions or the nature of those actions," within the meaning of CALCRIM No. 626. Thus, no pinpoint instruction on voluntary intoxication was necessary.

E. Instruction on Intent to Kill

The trial court instructed the jury with CALCRIM Nos. 875 and 915, which defined the lesser offenses of assault with a deadly weapon and simple assault. Townley recognizes that these were proper instructions in themselves, but he asserts error in the failure of the court to state clearly that these instructions applied only to the assault crimes. By giving "[c]ontradictory instructions," Townley argues, the court "eliminated the prosecution's burden of proving intent to use force and intent to kill in the attempted murder, premeditation and enhancement instructions."
This contention requires no expansive analysis, because the record discloses no ambiguity in the instructions given. The trial court introduced each crime and associated element and enhancement by clearly stating what the prosecution had to prove for that specific concept. In defining attempted murder, for example, the court explicitly stated that the People must affirmatively prove the defendant's specific intent to kill the victim. In defining premeditation and deliberation, the court twice stated that it was the prosecution's burden to prove the allegation and that these elements could not be inferred merely from the commission of an assault with a deadly weapon. The explanations of the assault charges were clearly distinguished from the instructions pertaining to attempted murder. We find no reasonable likelihood that the jury was confused or misled into incorrectly applying the intent instructions. (Cf. People v. Kelly (2007) 42 Cal.4th 763, 791 [68 Cal.Rptr.3d 531, 171 P.3d 548] [no reasonable likelihood the jury would have interpreted instruction not to require intent]; People v. Coffman and Marlow (2004) 34 *1541 Cal.4th 1, 123 [17 Cal.Rptr.3d 710, 96 P.3d 30] [no reasonable likelihood the jury was confused by lack of instruction defining implied malice].)

F. Holding Case for Medina
Townley requested that this court "defer consideration of the appeal" pending the Supreme Court's decision in People v. Medina (2009) 46 Cal.4th 913 [95 Cal.Rptr.3d 202, 209 P.3d 105] regarding the "natural and probable consequences" doctrine. The Supreme Court's opinion in Medina has now been filed, and it offers no ground for reversal in this case.

G. Admission of Gang Evidence

Townley next asserts prejudicial error in admitting evidence of gang membership, vocabulary, and behavior, because he was not a gang member. "Even if the evidence had some relevance to Carranco's case, the court should have denied the prosecutor's 11th-hour motion to consolidate their cases," presumably for the same reason, that it was irrelevant to Townley's. We find no error.
(9) "In cases not involving the gang enhancement, we have held that evidence of gang membership is potentially prejudicial and should not be admitted if its probative value is minimal. (E.g., People v. Cardenas (1982) 31 Cal.3d 897, 904-905 [184 Cal.Rptr. 165, 647 P.2d 569].) But evidence of gang membership is often relevant to, and admissible regarding, the charged offense. Evidence of the defendant's gang affiliationincluding evidence of the gang's territory, membership, signs, symbols, beliefs and practices, criminal enterprises, rivalries, and the likecan help prove identity, motive, modus operandi, specific intent, means of applying force or fear, or other issues pertinent to guilt of the charged crime." (People v. Hernandez (2004) 33 Cal.4th 1040, 1049 [16 Cal.Rptr.3d 880, 94 P.3d 1080].)
Here there was abundant evidence that the shooting was gang related and that Townley had participated for the benefit of the Norteno gang, even though he was not a member. Codefendant Carranco clearly was a Norteno member; the occupants of the car talked about finding a Sureno; the victim happened to be wearing blue, the color of the rival Sureno gang, and was walking outside an apartment complex associated with the Surenos; the assailants demanded to know whether the victim was a Norteno or a Sureno and one yelled the word "scrap"; and later at Gonzalez's apartmenta Norteno-safe refugeone of them mentioned having "hit a scrap," a slang reference to assaulting a Sureno. Given the irrefutable motivation for the shooting, this evidence was unquestionably probative. It made no difference that Townley was not a formal member of the Norteno gang. Thus, even *1542 without the evidence recovered from a search of his bedroom (which included items reflecting a Norteno association), the record unambiguously supports the trial court's admission of testimony explaining the practices, culture, and parlance of these rival gangs. Likewise, it was neither error nor prejudicial to admit testimony from Sergeant Fish and Detective Montes that the Ocean Terrace apartments were associated with the Surenos. Because the admission of the gang evidence was proper as to Townley, his assertion of prejudice from the joint trial with Carranco must also fail.

H. Detention and Transportation

Before trial the defense moved to suppress the evidence of the gun and ammunition found in Townley's shoes while being transported to the sheriff's station. The defense argued that the evidence was the fruit of an unlawful detention; although Townley was subject to a probation search, the scope of that condition did not encompass consent to any detention for questioning. The trial court denied the motion, relying on the probation search condition and the evidence the officers had gathered from interviewing witnesses in Gonzalez's bedroom.[9] The court agreed with the prosecutor's suggestion that the officers had probable cause to arrest Townley based on these interviews, but the prosecutor insisted that the transportation was only a detention. The court found that the officers had "probable cause to accuse him of something" when they decided to transport Townley, and they "certainly had probable cause to arrest him" once they had the information from Fritts-Nash about the gun in his shoe.
The People concede that the decision to transport Townley was a "de facto" arrest, but they maintain that it was supported by probable cause. Alternatively, they argue, the probation search condition, along with the information supplied by Fritts-Nash, provided an independent source for the search of the shoes, thereby attenuating any illegality of the transportation. Even if probable cause to arrest was lacking, we agree that the valid probation search condition attenuated the connection between the transportation to the sheriff's station and the subsequent discovery of the concealed gun and ammunition. (Cf. People v. Brendlin (2008) 45 Cal.4th 262, 272 [85 Cal.Rptr.3d 496, 195 P.3d 1074] [outstanding warrant sufficiently attenuated connection between unlawful traffic stop and subsequent discovery of drug paraphernalia].)


*1543 DISPOSITION
The judgment is reversed.
Rushing, P. J., and Premo, J., concurred.
NOTES
[1]  Since we have focused on this one issue on rehearing, our opinion has remained the same on other issues to the extent they remain relevant to this appeal and opinion.
[2]  One of the detectives who investigated the case testified that Townley was about five feet, seven inches. Carranco was about five feet six inches; and Rocha, about five feet nine inches.
[3]  The sealed transcripts and declarations are in the record on appeal and have been provided to appellate counsel, but, on April 15, 2008, this court denied Townley's request to unseal these documents. Accordingly, they remain sealed and should not be disclosed in a document filed publicly. (Cal. Rules of Court, rule 8.160(g).) Though the Attorney General opposed the request to unseal the documents, the Attorney General's later brief quoted from the sealed transcripts, possibly recognizing that the court's orders cannot be justified without reference to the sealed record.
[4]  The Attorney General asserts that counsel "received both Flores's sealed declaration and his plea hearing transcript with ample time to prepare for cross-examination." It is unclear from the record what happened with the reporter's transcripts of the change of plea hearings. The court did provide counsel with copies in order to explain its denial of an in limine motion. After this ruling, the court stated, "you need to give those back to the court reporter." The prosecutor asserted to have understood that the court had ordered that "the copies of the transcript would be made available with the same understanding and under the same conditions as were the declarations." The court responded, "I think I did, actually, and they'reand it actually would be more prophylactic if we just left them sealed and took the plea if all he agrees to do is testify truthfully.... [¶] So you can keep those. You can't show those to your client. You can't show them to anybody else." We are not sure whether "those" referred to the declarations or the transcripts, or how it "would be more prophylactic" to allow counsel to retain copies of the transcripts.
[5]  In Moore v. Purkett (8th Cir. 2001) 275 F.3d 685, the court restricted the criminal defendant's method of communicating, telling him if he had anything to say to his attorney while court was in session, he should write a note, and not speak, no matter how quietly. The attorney objected that the defendant's writing skills were limited. (Id. at p. 687.) The appellate court concluded that "Moore was actually or constructively denied the assistance of counsel altogether during trial court proceedings." (Id. at p. 689.)
[6]  In U.S. v. Triumph Capital Group, Inc. (2d Cir. 2007) 487 F.3d 124, the Second Circuit Court of Appeals claimed to "join our sister circuits and hold that a restriction on communication during a long recess can violate the Sixth Amendment even if the restriction bars discussion only of the defendant's testimony." (Id. at p. 133.)

This purported holding was dictum, however. In that case, the trial court rescinded its order after three hours, so it was only in effect between 5:00 p.m. and 8:00 p.m. (U.S. v. Triumph Capital Group, Inc., supra, 487 F.3d at p. 133.) The appellate court's actual conclusion was that "the court's restriction was trivial and did not meaningfully interfere with the defendant's Sixth Amendment rights to effective assistance of counsel." (Id. at p. 135.) The defense counsel was on notice within 20 minutes of the court order that the government might seek rescission of the order and was aware within two hours that the rescission was likely. (Ibid.) Moreover, the following day, the defendant was given all the time he needed to confer with his attorney before resuming the witness stand for cross-examination. (Id. at p. 136.)
[7]  In contrast, under the federal Constitution, "[a] criminal defendant is entitled to rather limited discovery, with no general right to obtain the statements of the Government's witnesses before they have testified. Fed. Rules Crim. Proc. 16(a)(2), 26.2." (Degen v. United States (1996) 517 U.S. 820, 825 [135 L.Ed.2d 102, 116 S.Ct. 1777].) The rule providing for such discovery is sometimes referred to in federal law as the Jencks rule.

It is because of this critical difference between federal and California law that we do not attach much significance to the decision in Harris v. U.S. (D.C. Cir. 1991) 594 A.2d 546, which is otherwise factually most similar. In that case, two days before a witness testified, the government gave defense counsel the witness's taped confession, which discussed a number of crimes with which the defendant had not been charged. Before ruling on the government's request for a protective order limiting disclosure, the trial court gave defense counsel a chance to review the tape, but barred counsel from giving the tape or a transcript of its contents to the defendant. "[I]t was unclear whether counsel could discuss its contents with him." (Id. at p. 547.) The following day, the government limited its request to allow counsel to discuss the contents without giving the defendant a physical copy. Defense counsel said he might have no objection to that approach, and did not object thereafter. (Id. at p. 548.)
On appeal the defendant contended "that his right to effective assistance of counsel was violated by the trial court's ruling temporarily prohibiting full discussion of the tape between him and defense counsel." (Harris v. U.S., supra, 594 A.2d at p. 548.) The appellate court concluded, "[a] restriction on defense counsel that prevents him from revealing what is possibly Jencks material does not materially interfere with counsel's duty to advise a defendant on trial-related matters." (Id. at p. 549.) It was reasonable of the trial court to "place a temporary and limited restriction on defense counsel's use of what was possibly Jencks material" while the court itself completed screening the tape. (Ibid.) Since the defense got the tape earlier than required by the Jencks rule, the court found "no violation of Harris's right to effective assistance of counsel." (Ibid.)
[8]  Similar rules are applied in determining when "public access to a criminal proceeding may be denied: (1) there must be `an overriding interest that is likely to be prejudiced' if the proceeding is left open; [fn. omitted] (2) `the closure must be no broader than necessary to protect that interest'; (3) `the trial court must consider reasonable alternatives to closing the proceeding'; and (4) the trial court must articulate the interest being protected and make specific findings sufficient for a reviewing court to determine whether closure was proper." (People v. Baldwin (2006) 142 Cal.App.4th 1416, 1421 [48 Cal.Rptr.3d 792], quoting Waller v. Georgia (1984) 467 U.S. 39, 45, 48 [81 L.Ed.2d 31, 104 S.Ct. 2210].)
[9]  These interviews gave the officers reason to suspect Townley as a participant in the crime or at least an accessory after the fact. Sergeant Sulay in particular believed that Townley's nervous behavior and evasive responses to questioning indicated that he knew more than he was saying. He also admitted ownership of the red and black plaid jacket, People's exhibit No. 23. Once Sulay obtained information about the gun and ammunition from Fritts-Nash, he considered it urgent to contact the deputy transporting Townley, who was riding in the patrol car unhandcuffed.
