It's funny watching people like
@fskimospy who don't know what the law actually says try to explain how this will all go down. Protip - that agreement doesn't require a treaty and could easily be informal and applied based upon judgement of Attorney General. Which BTW is exempt from judicial review per the law.
https://www.law.cornell.edu/uscode/text/8/1158
(2)Exceptions
(A)Safe third country
Paragraph (1) shall not apply to an
alien if the
Attorney General determines that the
alien may be removed, pursuant to a bilateral or multilateral agreement, to a country (other than the country of the
alien’s nationality or, in the case of an
alien having no nationality, the country of the
alien’s last habitual
residence) in which the
alien’s life or freedom would not be threatened on account of race, religion, nationality, membership in a particular social group, or political opinion, and where the
alien would have access to a full and fair procedure for determining a claim to asylum or equivalent temporary protection, unless the
Attorney General finds that it is in the public interest for the
alien to receive asylum in the
United States.
<snip>
(3)Limitation on judicial review No court shall have jurisdiction to review any determination of the
Attorney General under paragraph (2).
Read the law (I've posted it above). Not only is it legal, it's not reviewable by courts.