d01 · Roll back history (~5 min)
Mutation and references. Edit drills.py. Standard library only; no model calls, no API key.
def run_with_rollback(messages, step):
Call step(messages) and return what it returns.
step may append to messages and may also change messages already in it,
including their nested content lists and blocks. If step raises, put messages
back exactly as it was before the call (same list object, same contents at every
level) and re-raise the same exception.
Failure messages are enough to go on, so leave the tests unread until you submit.