From b4ce59eea8f749190980a98e84e52f7ad96a9ded Mon Sep 17 00:00:00 2001 From: Aakash Bakhle <48802744+aakashb95@users.noreply.github.com> Date: Tue, 31 Mar 2026 10:35:50 +0530 Subject: [PATCH] feat: reclaim response_bot flag for custom_tools (#13897) Repurpose the deprecated response_bot feature flag slot for custom_tools. Migration disables the flag on any accounts that had response_bot enabled so the repurposed slot starts in its default-off state. Pre-deploy: run the disable script on production using the old flag name (response_bot) before deploying this migration. --- config/features.yml | 6 ++--- ...pose_response_bot_flag_for_custom_tools.rb | 22 +++++++++++++++++++ db/schema.rb | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20260324102005_repurpose_response_bot_flag_for_custom_tools.rb diff --git a/config/features.yml b/config/features.yml index 41515ff64..00f9321b8 100644 --- a/config/features.yml +++ b/config/features.yml @@ -104,10 +104,10 @@ display_name: Audit Logs enabled: false premium: true -- name: response_bot - display_name: Response Bot +- name: custom_tools + display_name: Custom Tools enabled: false - deprecated: true + premium: true - name: message_reply_to display_name: Message Reply To enabled: false diff --git a/db/migrate/20260324102005_repurpose_response_bot_flag_for_custom_tools.rb b/db/migrate/20260324102005_repurpose_response_bot_flag_for_custom_tools.rb new file mode 100644 index 000000000..d6a3199b4 --- /dev/null +++ b/db/migrate/20260324102005_repurpose_response_bot_flag_for_custom_tools.rb @@ -0,0 +1,22 @@ +class RepurposeResponseBotFlagForCustomTools < ActiveRecord::Migration[7.1] + def up + # The response_bot flag (deprecated) has been renamed to custom_tools. + # Disable it on any accounts that had response_bot enabled so the repurposed + # flag starts in its intended default-off state. + Account.feature_custom_tools.find_each(batch_size: 100) do |account| + account.disable_features(:custom_tools) + account.save!(validate: false) + end + + # Remove the stale response_bot entry from ACCOUNT_LEVEL_FEATURE_DEFAULTS. + # ConfigLoader only adds new flags; it never removes renamed ones. + # Leaving it would cause NoMethodError in enable_default_features when + # creating new accounts (feature_response_bot= no longer exists). + config = InstallationConfig.find_by(name: 'ACCOUNT_LEVEL_FEATURE_DEFAULTS') + return if config&.value.blank? + + config.value = config.value.reject { |f| f['name'] == 'response_bot' } + config.save! + GlobalConfig.clear_cache + end +end diff --git a/db/schema.rb b/db/schema.rb index 81f1dfbdd..c8af2be3e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2026_03_20_074636) do +ActiveRecord::Schema[7.1].define(version: 2026_03_24_102005) do # These extensions should be enabled to support this database enable_extension "pg_stat_statements" enable_extension "pg_trgm"