Getting "Auto resize VM with window" working in virt-manager with a Linux guest

This is weirdly undocumented and difficult to figure out. You might encounter a grayed-out "Auto resize VM with window" option in the View > Scale Display menu in Virtual Machine Manager (virt-manager) with a Linux VM. Hovering over this option tells you, "Guest agent is not running&