diff --git a/app/models/account.rb b/app/models/account.rb index 667058a2f..0fa3e6659 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -54,7 +54,7 @@ class Account < ApplicationRecord store_accessor :settings, :captain_models, :captain_features store_accessor :settings, :reporting_timezone store_accessor :settings, :keep_pending_on_bot_failure - store_accessor :settings, :captain_auto_resolve_mode + store_accessor :settings, :captain_auto_resolve_mode, :captain_false_promise_harness_enabled include AccountCaptainAutoResolve has_many :account_users, dependent: :destroy_async diff --git a/app/models/concerns/account_settings_schema.rb b/app/models/concerns/account_settings_schema.rb index 52e1c2811..c3242fa30 100644 --- a/app/models/concerns/account_settings_schema.rb +++ b/app/models/concerns/account_settings_schema.rb @@ -12,6 +12,7 @@ module AccountSettingsSchema 'auto_resolve_label': { 'type': %w[string null] }, 'keep_pending_on_bot_failure': { 'type': %w[boolean null] }, 'captain_auto_resolve_mode': { 'type': %w[string null], 'enum': ['evaluated', 'legacy', 'disabled', nil] }, + 'captain_false_promise_harness_enabled': { 'type': %w[boolean null] }, 'conversation_required_attributes': { 'type': %w[array null], 'items': { 'type': 'string' } diff --git a/enterprise/app/jobs/captain/conversation/v1_false_promise_handler.rb b/enterprise/app/jobs/captain/conversation/v1_false_promise_handler.rb index d3c99a73c..9e56fc207 100644 --- a/enterprise/app/jobs/captain/conversation/v1_false_promise_handler.rb +++ b/enterprise/app/jobs/captain/conversation/v1_false_promise_handler.rb @@ -80,7 +80,7 @@ module Captain::Conversation::V1FalsePromiseHandler end def v1_false_promise_harness_enabled? - ActiveModel::Type::Boolean.new.cast(@assistant.config['false_promise_harness_enabled']) + ActiveModel::Type::Boolean.new.cast(account.captain_false_promise_harness_enabled) end def log_v1_false_promise_detection(detection) diff --git a/spec/enterprise/jobs/captain/conversation/response_builder_job_spec.rb b/spec/enterprise/jobs/captain/conversation/response_builder_job_spec.rb index c671edd2a..3cb6958f5 100644 --- a/spec/enterprise/jobs/captain/conversation/response_builder_job_spec.rb +++ b/spec/enterprise/jobs/captain/conversation/response_builder_job_spec.rb @@ -62,7 +62,7 @@ RSpec.describe Captain::Conversation::ResponseBuilderJob, type: :job do expect(conversation.messages.last.content).to eq('Hey, welcome to Captain Specs') end - it 'does not run the false promise harness when the assistant setting is disabled' do + it 'does not run the false promise harness when the account setting is disabled' do expect(Captain::Llm::AssistantFalsePromiseService).not_to receive(:new) described_class.perform_now(conversation, assistant) @@ -70,9 +70,9 @@ RSpec.describe Captain::Conversation::ResponseBuilderJob, type: :job do expect(conversation.messages.last.content).to eq('Hey, welcome to Captain Specs') end - context 'when false promise harness is enabled in assistant config' do + context 'when false promise harness is enabled in account settings' do before do - assistant.update!(config: assistant.config.merge('false_promise_harness_enabled' => true)) + account.update!(settings: account.settings.merge('captain_false_promise_harness_enabled' => true)) end it 'sends the original response when the detector marks it safe' do