Very important stuff, and thankfully Cornell has a pretty well laid out resource, as well as a very helpful & responsive department for this.
https://international.globallearning.cornell.edu/maintaining-your-status
[relevant screenshot]
https://international.globallearning.cornell.edu/travel
Remember that you need a valid travel signature in your I-20 (for F1 visa) or DS-2019 (for J1 visa). It is only valid for 1 year so you have to renew this every year.
Other travel documents that are good to bring just in case are explained in the link above.
International Services at the Office of Global Learning cover a lot of immigration related affairs.
https://international.globallearning.cornell.edu/
You can also get advice from their expert staff by appointment (in-person or Zoom), Email and Phone. You have to schedule appointments in advance (1-2 weeks usually). For emails, from my experience, they respond really fast if your situation is urgent. For phone, sometimes they don't pick up immediately, but I have had an experience when I dropped a voicemail explaining my urgent situation and they called me back fast.