Skip to content

fix(sales-assist): resolve AI Assist agent from params, company setting, then fallback - #11342

Merged
kaioken merged 1 commit into
developmentfrom
fix/ai-assist-agent-resolution
Sep 23, 2026
Merged

kaioken merged 1 commit into
developmentfrom
fix/ai-assist-agent-resolution

Conversation

@FredPeal

Copy link
Copy Markdown
Contributor

Summary

The AI Assist channel created after a SalesAssist lead pull (and now also from the SalesAssist Create Contact Channel workflow activity) resolves its agent with this precedence:

  1. ai_assist_agent_id workflow param
  2. the company's ai_assist_agent setting (new ConfigurationEnum::AI_ASSIST_AGENT_ID)
  3. the agent_id the step already runs with

The enabled check plus this resolution now live in one place, CreateAIAssistChannelAction::ifEnabled(), which returns null when AI Assist is off so callers just ?->execute().

Fixes along the way

  • CreateSocialChannelsAfterPullAction read an undefined $params (should be $this->params), so the param override never applied.
  • CreateSocialChannelActivity read $this->agentId, which does not exist on the activity. With no company setting this passed null to an int and threw a TypeError.
  • The company setting value is cast to int before reaching the action.
  • The hardcoded 'ai_assist_agent' key moved into Kanvas\Intelligence\Enums\ConfigurationEnum.

Tests

  • CreateAIAssistChannelActionTest::testIfEnabledReturnsNullWhenAiAssistIsOff
  • CreateAIAssistChannelActionTest::testIfEnabledResolvesAgentByPrecedence
  • Existing PullLeadActivityReynoldsResolvedLeadTest covers the activity path.

PHPStan (level 0) clean on src/Domains/Connectors/SalesAssist and src/Domains/Intelligence/Enums. php-cs-fixer clean on every touched file.

…ng, then fallback

Move the enabled check and agent resolution into CreateAIAssistChannelAction::ifEnabled so the pull action and the social channel activity share one implementation. Fixes the undefined $params / $this->agentId references and adds the ai_assist_agent company setting to the Intelligence ConfigurationEnum.
@kaioken
kaioken merged commit 66f2bca into development Sep 23, 2026
27 of 30 checks passed
@kaioken
kaioken deleted the fix/ai-assist-agent-resolution branch September 26, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants