Метод relaunchAfterUpgrade
Сигнатура метода
private function relaunchAfterUpgrade(int $templateId, array $constantValues = []): void
Возвращает:
void
Описание
Re-launches a freshly upgraded copy on the new version via the manual-start two-part handshake — the same path as the grid "Restart" action (startAction plus the setup-panel submit), applied here server-side (ADR §10.3 step 5 / §10.5). Called strictly after AgentUpgradeService has applied and committed the in-place upgrade (that service owns the transaction), so this runs outside any transaction — startTemplate() starts a workflow, and MySQL does not support the nested transaction that wrapping it would create. The handshake is two parts, both mandatory: 1. startTemplate() fires the AiAgentStartTrigger; the workflow starts and suspends (CBPWorkflowStatus::Suspended) waiting for its setup constants. 2. fill() delivers those constants to the suspended instance, which then resumes and completes — the agent is really up on the new version. Skipping fill() would leave a Suspended orphan and the agent would never run. fill() runs only when the start actually suspended for setup (startResult->setupTemplateEvent captured); otherwise the agent already completed and this step is skipped — there is nothing to fill. The re-launch is attributed to the copy owner (ACTIVATED_BY), not the administrator who triggered the upgrade: the onboarding start branch reads the starting user ({=AiAgentStartTrigger:startedBy}) for the greeting, bot author and responsible, so an admin upgrading someone else's copy must not redirect those to the admin. The owner is used for both handshake steps; the current user is only a fallback when the owner cannot be resolved (preserving the prior behaviour). The same userId is used for both steps: startTemplate() registers a setup-data handler keyed by userId, and fill() must match it. A NEW instance is started on the new version (AC-018); any previously running instance is left untouched (AC-017). Both steps are best-effort: the upgrade is already committed, so a failure here must never undo it — it is only journaled for observability. A start that reports success but yields no instance id (trigger not applied) is treated as a failure, so the interim silent-drop is no longer masked as a successful re-launch.
Параметры
2| Имя | Тип | По умолчанию | Флаги |
|---|---|---|---|
$templateId
|
int
|
—
|
—
|
$constantValues
|
array
|
[]
|
—
|
Расположение
Исходный файл метода в Bitrix Framework
~/bitrix/modulesbizproc/lib/Infrastructure/Controller/Integration/AiAgent/Template.php