The picker passed no target, so the staleness guard never ran and a file
chosen after switching tabs was attached to the newly active document. Pass
the active document like Import data and the image picker do. A test covers
the tab switch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>