async fn link_account(
state: &AppState,
def_id: &str,
__arg2: (&str, bool),
provider: &str,
is_new: bool,
) -> Result<(), String>Expand description
Step 2/4: (re)point the agent’s provider link at this account.
agent_identity_link’s own ON CONFLICT(agent_id, provider) DO UPDATE already overwrites whatever account_id was linked
before, so no separate unlink is needed for the success path:
an unlink that succeeds followed by a link that fails would permanently drop
the agent’s existing provider link with no compensation (the
failure branch below only cleans up for is_new accounts).