I think I might have encountered a bug related to attachments for a hosted feature layer.
So I have a point layer with attachments, if I delete the feature I would assume that the attachment references are cascade deleted as well. Exporting the data to a file geodatabase confirms that.
BUT... if I now add a new point with the same GlobalID as the one deleted, there seems to be some ghost attachment references - it looks like there are attachments, and the REST api queryAttachments confirms that, but they all return 500 server error.
Removing any attachments before deletion of the feature is a workaround.
We have a workflow where we have a in-house geodatabase that periodically syncs with AGOL, and only features that are "active" should be accessible in the AGOL layer, so features are added and deleted and we want to preserve the GlobalID's so that the match the in-house egdb.