path_set_alias() generates the wrong alias, and creates a 301 redirect to the desired alias's path
The trick was to set $node-&gt;pathauto_perform_alias = FALSE; before calling node_save.  Then my manual aliasing was allowed to take effect.

I still haven't figured out how to prevent the 301 redirect.  It only produces a warning now, and the alias stays the way I want.