[Code chat Rollout] Add chatops command for assisting with the rollout

Background

In https://gitlab.com/gitlab-com/gl-infra/production/-/issues/20379#note_2702832071, we learned that CRs with Rails console commands are not going to be approved anymore.

Proposal

Let's add several chatops commands to assist with the rollout:

1. Connection Management

  • List all connections and show which is active:

    /chatops run active_context connection list
  • Activate/deactivate the connection (replaces: connection.activate! and connection.deactivate!):

    /chatops run active_context connection activate --connection-id=<id>
    /chatops run active_context connection deactivate [--connection-id=<id>]  # Optional, defaults to active

2. Collection Queue Management

  • Update collection records (replaces: collection.update_options!)
    /chatops run active_context collection set <collection_name/collection_id> --queue-shard-count=<n> --queue-shard-limit=<n> [--connection-id=<id>]

3. Enabled Namespace Management

  • Update Ai::ActiveContext::Code::EnabledNamespace records (replaces: EnabledNamespace.find_by(...).pending!)
    /chatops run active_context code enabled_namespace set <namespace_path/namespace_id> --state=<state> [--connection-id=<id>]

Context

Edited by 🤖 GitLab Bot 🤖