In this case because the spy is an FSB agent I would say they would know the risk. The majority of spies on the other hand being civilians without any understanding of the risks.
Important to note is the fact that a spy is any random person off the street. It doesn't have to be an adult, it can be a child. It does not have to be a human being. Any source of intelligence which helps an intelligence agency can find themselves spying without even knowing they are or what spying is.
A random person off the street can ask you for directions. You give them directions and now you've helped them. This doesn't mean you knew they were an intelligence agent, and so no you cannot be aware of the risks in that case. Since we don't know how the FSB agent was made to provide this information because the information is limited, we simply don't know what happened. Because the charge is treason, my guess is that the FSB agent did know the risk and did know what they were doing because of the charge, and because they being an FSB agent is specifically trained to understand the tactics. They may have even been trained to resist, and to do the same tactics.