Hi Dave!
Thanks for the explanation!
I was able to get a good result doing this instead:
set client configuration timeout=300
SSHLibrary.Write sysupgrade upgrade.img
log "Upgrade performed, Waiting for unit to become ready"
SSHLibrary.Read Until Rebooting system...
This way, instead of always waiting for the timeout and concluding that it signaled that the operation/upgrade had been successful, this different method actually tracks the execution and ends when the operation/upgrade has indeed concluded.