SG-1 travels through the Stargate to P7J-989 -- a lush, beautiful garden paradise. But there is one thing here that is disturbing: the planet's inhabitants are unconscious, plugged into giant machines. SG-1 investigates these devices, and are pulled against their will into a virtual reality world.
Jack O'Neill and Teal'c find themselves alone in a wooded area. As they attempt to assess the situation, a vehicle drives up. Out steps two old friends and fellow soldiers, including Charles Kawalsky, who died more than a year ago after being infected by a Goa'uld.
O'Neill realizes that this event is from his past. The place is East Germany, the year is 1982. O'Neill is a captain, and the covert operation that is to take place on this day would result in the death of his friend, John. The men refer to Teal'c -- who has curiously grown a full head of hair -- as "Thomas."
Their mission is to infiltrate a small compound and grab a Russian agent. But back in 1982, there were snipers on the roof waiting for them. John, the team leader, was killed, and the mission was a failure. It was one of O'Neill's darkest hours, and now he is forced to relive it.
O'Neill fails to change things, and John is shot dead. As he and Teal'c flee the compound, they witness the same truck drive up the same road. The dead colonel and Charles Kawalsky again step out, as if nothing had happened. O'Neill is forced to play out the scene again and again, trying to make it right. But each time, the rules seem to change. The snipers on the roof are eliminated, but men with machine guns surprise the team from behind the hedges. On the third attempt, the men are behind a wall. O'Neill cannot win, and witnesses his friend die over and over again.
Captain Carter and Dr. Jackson find themselves at the New York Museum of Art, on a cold day when Daniel's parents were crushed to death by a giant stone slab. Jackson tries many different methods of trying to coax them out from underneath the rock before it falls, but each time fails. They see him only as a child, at the age he was when they died.
As O'Neill and Jackson become increasingly frustrated with their individual scenarios, a man arrives. He is "the Keeper," and is delighted with his new guests. The Keeper believes he has provided the men with a great gift: the ability to try different combinations, explore different possibilites, rather than spending their lives asking, "Is there anything I could have done differently?"
O'Neill and Jackson are horrified, and refuse to play -- even if that means standing with their arms folded, and their backs turned to the cries of their dying loved ones.
The Keeper finally ends it, and brings the four team members back together. He explains that long ago -- 1,022 years to be exact -- this planet was destroyed by a chemical disaster. The inhabitants are sustained within the virtual reality world, with nothing but their own thoughts and experiences to draw from. The arrival of SG-1 provided four new minds, filled with new experiences for the inhabitants to watch. They are, in essence, "new software" for the machine.
SG-1 demands to be released, and finally the alien spokesman consents. They wake up in the VR machines, and quickly move back to the Stargate and to Earth.
General Hammond, though, is not acting quite right. During their debriefing, Hammond orders SG-1 to return to the planet and reenter the VR world. He even gives an eloquent salespitch for the machines. The team figures him out quickly -- he isn't the real general. SG-1 is still inside the virtual reality world.
Hammond does not respond well to O'Neill's insubordinate accusations, and throws them into an isolation cell under guard. One guard is Charles Kawalsky; he reveals that their suspicions are correct, but tries to talk them into staying inside the machine voluntarily.
SG-1 manages to break out of the cell, and is immediately met by the cloaked figures of the planet's inhabitants. The team tells the people that the Keeper is deceiving them; in fact, their world has recovered from the disaster during their 1,000 years in virtual reality, and is now a beautiful garden.
SG-1 tracks the Keeper back through a strange doorway leading from the S.G.C. back to the garden planet, and are finally released from the machine. The Keeper pleads with them, claiming that he kept the people in the machine because he knew they would just ruin their world all over again.
But, it is too late. The people are out and about, exploring the garden and picking flowers.