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.
This commit is contained in:
Aakash Bakhle
2026-03-31 10:35:50 +05:30
committed by GitHub
parent 42441dbd28
commit b4ce59eea8
3 changed files with 26 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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"