From d8f4bb940e522191f57678b853593bd2c352f43f Mon Sep 17 00:00:00 2001 From: Aakash Bakhle <48802744+aakashb95@users.noreply.github.com> Date: Fri, 20 Feb 2026 19:08:36 +0530 Subject: [PATCH 1/4] feat: add resolve_conversation tool for Captain V2 scenarios (#13597) # Pull Request Template ## Description Adds a new built-in tool that allows Captain scenarios to resolve conversations programmatically. This enables automated workflows like the misdirected contact deflector to close conversations after handling them, while still allowing human review via label filtering. ## Type of change Please delete options that are not relevant. - [x] New feature (non-breaking change which adds functionality) ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. tested by mentioning it to be used in captain v2 scenario image ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Claude Opus 4.6 Co-authored-by: Tanmay Deep Sharma <32020192+tds-1@users.noreply.github.com> --- config/agents/tools.yml | 5 ++ config/locales/en.yml | 1 + .../enterprise/activity_message_handler.rb | 35 +++++++------ .../tools/resolve_conversation_tool.rb | 27 ++++++++++ lib/current.rb | 2 + .../tools/resolve_conversation_tool_spec.rb | 52 +++++++++++++++++++ 6 files changed, 105 insertions(+), 17 deletions(-) create mode 100644 enterprise/lib/captain/tools/resolve_conversation_tool.rb create mode 100644 spec/enterprise/lib/captain/tools/resolve_conversation_tool_spec.rb diff --git a/config/agents/tools.yml b/config/agents/tools.yml index c2faf75e7..ff4f7d28f 100644 --- a/config/agents/tools.yml +++ b/config/agents/tools.yml @@ -30,6 +30,11 @@ description: 'Search FAQ responses using semantic similarity' icon: 'search' +- id: resolve_conversation + title: 'Resolve Conversation' + description: 'Resolve a conversation when the issue has been addressed' + icon: 'checkmark' + - id: handoff title: 'Handoff to Human' description: 'Hand off the conversation to a human agent' diff --git a/config/locales/en.yml b/config/locales/en.yml index 07d9b0e2f..a058d28c7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -229,6 +229,7 @@ en: activity: captain: resolved: 'Conversation was marked resolved by %{user_name} due to inactivity' + resolved_by_tool: 'Conversation was marked resolved by %{user_name}: %{reason}' open: 'Conversation was marked open by %{user_name}' agent_bot: error_moved_to_open: 'Conversation was marked open by system due to an error with the agent bot.' diff --git a/enterprise/app/models/enterprise/activity_message_handler.rb b/enterprise/app/models/enterprise/activity_message_handler.rb index e6a93718f..66195ec46 100644 --- a/enterprise/app/models/enterprise/activity_message_handler.rb +++ b/enterprise/app/models/enterprise/activity_message_handler.rb @@ -1,22 +1,23 @@ module Enterprise::ActivityMessageHandler def automation_status_change_activity_content - if Current.executed_by.instance_of?(Captain::Assistant) - locale = Current.executed_by.account.locale - if resolved? - I18n.t( - 'conversations.activity.captain.resolved', - user_name: Current.executed_by.name, - locale: locale - ) - elsif open? - I18n.t( - 'conversations.activity.captain.open', - user_name: Current.executed_by.name, - locale: locale - ) - end - else - super + return super unless Current.executed_by.instance_of?(Captain::Assistant) + + locale = Current.executed_by.account.locale + key = captain_activity_key + return unless key + + I18n.t(key, user_name: Current.executed_by.name, reason: Current.captain_resolve_reason, locale: locale) + end + + private + + def captain_activity_key + if resolved? && Current.captain_resolve_reason.present? + 'conversations.activity.captain.resolved_by_tool' + elsif resolved? + 'conversations.activity.captain.resolved' + elsif open? + 'conversations.activity.captain.open' end end end diff --git a/enterprise/lib/captain/tools/resolve_conversation_tool.rb b/enterprise/lib/captain/tools/resolve_conversation_tool.rb new file mode 100644 index 000000000..0d2563a8b --- /dev/null +++ b/enterprise/lib/captain/tools/resolve_conversation_tool.rb @@ -0,0 +1,27 @@ +class Captain::Tools::ResolveConversationTool < Captain::Tools::BasePublicTool + description 'Resolve a conversation when the issue has been addressed or the conversation should be closed' + param :reason, type: 'string', desc: 'Brief reason for resolving the conversation', required: true + + def perform(tool_context, reason:) + conversation = find_conversation(tool_context.state) + return 'Conversation not found' unless conversation + return "Conversation ##{conversation.display_id} is already resolved" if conversation.resolved? + + log_tool_usage('resolve_conversation', { conversation_id: conversation.id, reason: reason }) + + Current.captain_resolve_reason = reason + begin + conversation.resolved! + ensure + Current.captain_resolve_reason = nil + end + + "Conversation ##{conversation.display_id} resolved#{" (Reason: #{reason})" if reason}" + end + + private + + def permissions + %w[conversation_manage conversation_unassigned_manage conversation_participating_manage] + end +end diff --git a/lib/current.rb b/lib/current.rb index 3376099f8..5097df369 100644 --- a/lib/current.rb +++ b/lib/current.rb @@ -4,6 +4,7 @@ module Current thread_mattr_accessor :account_user thread_mattr_accessor :executed_by thread_mattr_accessor :contact + thread_mattr_accessor :captain_resolve_reason def self.reset Current.user = nil @@ -11,5 +12,6 @@ module Current Current.account_user = nil Current.executed_by = nil Current.contact = nil + Current.captain_resolve_reason = nil end end diff --git a/spec/enterprise/lib/captain/tools/resolve_conversation_tool_spec.rb b/spec/enterprise/lib/captain/tools/resolve_conversation_tool_spec.rb new file mode 100644 index 000000000..f91f430e8 --- /dev/null +++ b/spec/enterprise/lib/captain/tools/resolve_conversation_tool_spec.rb @@ -0,0 +1,52 @@ +require 'rails_helper' + +RSpec.describe Captain::Tools::ResolveConversationTool do + let(:account) { create(:account) } + let(:assistant) { create(:captain_assistant, account: account) } + let(:inbox) { create(:inbox, account: account) } + let(:conversation) { create(:conversation, account: account, inbox: inbox, status: :open) } + let(:tool) { described_class.new(assistant) } + let(:tool_context) { Struct.new(:state).new({ conversation: { id: conversation.id } }) } + + before do + Current.executed_by = assistant + end + + after do + Current.reset + end + + describe 'resolving a conversation' do + it 'marks resolved and enqueues an activity message with the reason' do + tool.perform(tool_context, reason: 'Possible spam') + + expect(conversation.reload).to be_resolved + expect(Conversations::ActivityMessageJob).to have_been_enqueued.with( + conversation, + hash_including( + content: I18n.t('conversations.activity.captain.resolved_by_tool', user_name: assistant.name, reason: 'Possible spam') + ) + ) + end + + it 'clears captain_resolve_reason after execution' do + tool.perform(tool_context, reason: 'Possible spam') + + expect(Current.captain_resolve_reason).to be_nil + end + end + + describe 'resolving an already resolved conversation' do + let(:conversation) { create(:conversation, account: account, inbox: inbox, status: :resolved) } + + it 'does not re-resolve and returns an already resolved message' do + queue_adapter = ActiveJob::Base.queue_adapter + queue_adapter.enqueued_jobs.clear + + result = tool.perform(tool_context, reason: 'Possible spam') + + expect(result).to include('already resolved') + expect(Conversations::ActivityMessageJob).not_to have_been_enqueued + end + end +end From 280ca06e5bcce6a818eb0381e67e92241bfc3c2c Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 20 Feb 2026 19:39:23 +0530 Subject: [PATCH 2/4] fix: url endpoint fix: spec --- app/javascript/v3/components/GoogleOauth/Button.spec.js | 2 +- app/javascript/v3/components/GoogleOauth/Button.vue | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/javascript/v3/components/GoogleOauth/Button.spec.js b/app/javascript/v3/components/GoogleOauth/Button.spec.js index dbc2aaf90..139f0779e 100644 --- a/app/javascript/v3/components/GoogleOauth/Button.spec.js +++ b/app/javascript/v3/components/GoogleOauth/Button.spec.js @@ -24,7 +24,7 @@ describe('GoogleOAuthButton.vue', () => { const googleAuthUrl = new URL(wrapper.vm.getGoogleAuthUrl()); const params = googleAuthUrl.searchParams; expect(googleAuthUrl.origin).toBe('https://accounts.google.com'); - expect(googleAuthUrl.pathname).toBe('/o/oauth2/auth/oauthchooseaccount'); + expect(googleAuthUrl.pathname).toBe('/o/oauth2/auth'); expect(params.get('client_id')).toBe('clientId'); expect(params.get('redirect_uri')).toBe( 'http://localhost:3000/test-callback' diff --git a/app/javascript/v3/components/GoogleOauth/Button.vue b/app/javascript/v3/components/GoogleOauth/Button.vue index 2d1fc5a4e..be387ddbe 100644 --- a/app/javascript/v3/components/GoogleOauth/Button.vue +++ b/app/javascript/v3/components/GoogleOauth/Button.vue @@ -6,8 +6,7 @@ export default { // Creating the URL manually because the devise-token-auth with // omniauth has a standing issue on redirecting the post request // https://github.com/lynndylanhurley/devise_token_auth/issues/1466 - const baseUrl = - 'https://accounts.google.com/o/oauth2/auth/oauthchooseaccount'; + const baseUrl = 'https://accounts.google.com/o/oauth2/auth'; const clientId = window.chatwootConfig.googleOAuthClientId; const redirectUri = window.chatwootConfig.googleOAuthCallbackUrl; const responseType = 'code'; From 15f25f019e9743999d0f75b15d707c4f03886ece Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 20 Feb 2026 20:02:09 +0530 Subject: [PATCH 3/4] chore: bump version --- VERSION_CW | 2 +- config/app.yml | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION_CW b/VERSION_CW index a162ea75a..d782fca8f 100644 --- a/VERSION_CW +++ b/VERSION_CW @@ -1 +1 @@ -4.11.0 +4.11.1 diff --git a/config/app.yml b/config/app.yml index 9f7a3980c..4a1b004ac 100644 --- a/config/app.yml +++ b/config/app.yml @@ -1,5 +1,5 @@ shared: &shared - version: '4.11.0' + version: '4.11.1' development: <<: *shared diff --git a/package.json b/package.json index b062495a0..b51ad5ffa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@chatwoot/chatwoot", - "version": "4.11.0", + "version": "4.11.1", "license": "MIT", "scripts": { "eslint": "eslint app/**/*.{js,vue}", From 418bd177f814c089ffedb74251d73abd20099685 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Fri, 20 Feb 2026 20:20:32 +0530 Subject: [PATCH 4/4] fix: Adjust inbox settings pages layout width (#13590) # Pull Request Template ## Description This PR includes, 1. Adjusting the inbox settings page layout width from 3xl to 4xl for the collaborators, configuration, and bot configuration sections. 2. Adding a dynamic max-width for inbox settings banners based on the selected tab. 3. Making the sender name preview layout responsive. 4. Reordering automation rule row buttons so Clone appears before Delete. 5. Update the Gmail icon ratio. 6. Fix height issues with team/inbox pages 7. The delete button changes to red on hover 8. Add border to conversation header when no dashboard apps present ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- .../AttributeListItem.vue | 8 ++++- .../widgets/conversation/ConversationBox.vue | 3 ++ .../dashboard/settings/agentBots/Index.vue | 1 + .../dashboard/settings/agents/Index.vue | 1 + .../settings/automation/AutomationRuleRow.vue | 17 +++++----- .../dashboard/settings/canned/Index.vue | 1 + .../component/CustomRoleTableBody.vue | 1 + .../dashboard/settings/inbox/ChannelList.vue | 22 ++++++------- .../dashboard/settings/inbox/ImapSettings.vue | 8 ++--- .../settings/inbox/InboxChannels.vue | 4 +-- .../routes/dashboard/settings/inbox/Index.vue | 1 + .../dashboard/settings/inbox/Settings.vue | 32 +++++++++++++++++-- .../dashboard/settings/inbox/SmtpSettings.vue | 14 ++++---- .../inbox/components/BotConfiguration.vue | 2 +- .../components/SenderNameExamplePreview.vue | 9 +++++- .../inbox/settingsPage/ConfigurationPage.vue | 14 ++++---- .../DashboardApps/DashboardAppsRow.vue | 1 + .../integrations/MultipleIntegrationHooks.vue | 1 + .../integrations/Webhooks/WebhookRow.vue | 1 + .../dashboard/settings/labels/Index.vue | 1 + .../settings/macros/MacrosTableRow.vue | 1 + .../routes/dashboard/settings/sla/Index.vue | 1 + .../settings/teams/Create/AddAgents.vue | 19 ++++------- .../settings/teams/Create/CreateTeam.vue | 2 +- .../dashboard/settings/teams/Create/Index.vue | 2 +- .../settings/teams/Edit/EditAgents.vue | 19 ++++------- .../settings/teams/Edit/EditTeam.vue | 2 +- .../dashboard/settings/teams/Edit/Index.vue | 2 +- .../routes/dashboard/settings/teams/Index.vue | 1 + theme/icons.js | 2 +- 30 files changed, 118 insertions(+), 75 deletions(-) diff --git a/app/javascript/dashboard/components-next/ConversationWorkflow/AttributeListItem.vue b/app/javascript/dashboard/components-next/ConversationWorkflow/AttributeListItem.vue index 624ba2981..d0b660e27 100644 --- a/app/javascript/dashboard/components-next/ConversationWorkflow/AttributeListItem.vue +++ b/app/javascript/dashboard/components-next/ConversationWorkflow/AttributeListItem.vue @@ -82,7 +82,13 @@ const attributeIcon = computed(() => { sm @click="emit('edit', attribute)" /> -