fn link_new_agent_account(
id_store: &Store,
identity_store: &Store,
broker: &Broker,
def: &AgentDefinition,
chosen: &str,
)Expand description
Link a new agent to the account it is created with, for its own provider: chosen (the account the caller
picked) when it is one of this channel’s accounts for that provider, else the provider’s only account.
Two or more accounts with none chosen leave it unbound: that is a choice, made in Accounts.
The launch writes this link too (linkLaunchAccount), but only after it has started the controller, so
the new agent’s first spawn found no link, refused with “no credentials”, and nothing started it again
once the link landed, while Accounts already counted the agent as using the account. The same race
inherit_source_account_links closes for a fork. Best-effort: a failure is logged and leaves the agent
unbound, as before.