Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8243: feat(selfhost): wire feature flags through Compose and Helm (#9523)
wrj978981630a878a
diff --git a/.env.example b/.env.exampleindex 8676616f6a..b78173d5ad 100644--- a/.env.example+++ b/.env.example@@ -215,6 +215,20 @@ MULTICA_CODEX_WORKDIR=# process with the env var set.MULTICA_FEATURE_FLAGS_FILE=+# Self-host feature flags+#+# The Docker Compose stack enables Workflows (`project_workflows_v1`) by+# default because it shipped GA in v0.7.0. Experimental and Cloud-only flags+# stay off. Compose forwards `MULTICA_FEATURE_FLAGS_FILE` and+# `FF_PROJECT_WORKFLOWS_V1`; set any other flag by mounting a YAML rule file+# or by adding the FF_<FLAG_KEY> variable in a compose override. The Helm chart+# exposes the same switches through backend.config.featureFlags. See+# SELF_HOSTING_ADVANCED.md#feature-flags.+#+# Set to false to hide Workflows (statuses then stay under+# Settings → Issue Statuses):+FF_PROJECT_WORKFLOWS_V1=+# Web/Desktop keep a local search index per workspace and sync it through# /api/search-index. On by default; turning it off makes clients stop syncing# and search through the server again:diff --git a/SELF_HOSTING_ADVANCED.md b/SELF_HOSTING_ADVANCED.mdindex f84f01dbbc..47b6d482b6 100644--- a/SELF_HOSTING_ADVANCED.md+++ b/SELF_HOSTING_ADVANCED.md@@ -111,6 +111,90 @@ Things to know:> Note: setting `ALLOW_SIGNUP=false` enables invite-only account creation. A new user with a live pending workspace invitation can create an account with the invited email; users without an allowlist match or a valid invitation remain blocked. Invitations also permit emails outside configured allowlists when `ALLOW_SIGNUP=true`. Revocation does not delete accounts already created using an invitation or prevent those accounts from signing in. Combine this with `DISABLE_WORKSPACE_CREATION=true` when invitees must join an existing workspace instead of creating their own.+### Feature Flags++The server reads feature flags from two optional sources; the first match wins:++1. `FF_<FLAG_KEY>` environment variables, for example `FF_PROJECT_WORKFLOWS_V1=false`. These are the operator kill switches and beat the file.+2. The YAML rule file at `MULTICA_FEATURE_FLAGS_FILE`, when set. It supports `default`, a `variant` label, allow/deny entries, and percentage rollouts; see `server/pkg/featureflag` for the schema.+3. The built-in default for the flag.++Self-hosted deployments turn on the flags that are generally available and leave experimental or Cloud-only features off:++| Flag | Self-host default | Controls |+| --- | --- | --- |+| `project_workflows_v1` | on | Workflows: project status flows, handoffs, and `Settings → Workflows` |+| `plugins_v1` | off | Plugin catalog and lifecycle APIs (experimental; also needs `MULTICA_PLUGIN_SECRET_KEY` and `MULTICA_PLUGIN_SURFACE_ORIGIN`) |+| `composio_mcp_apps` | off | Composio app connections (also needs `COMPOSIO_API_KEY`) |+| `billing_workspace_subscriptions` | off | Cloud subscription and billing proxying (requires `MULTICA_CLOUD_URL`) |+| `local_search_index` | on | Web/Desktop local search index sync |++#### Docker Compose++`docker-compose.selfhost.yml` forwards `FF_PROJECT_WORKFLOWS_V1` (default `true`) and `MULTICA_FEATURE_FLAGS_FILE`. Set the flag in `.env` to hide Workflows:++```dotenv+FF_PROJECT_WORKFLOWS_V1=false+```++Compose only passes variables listed in its backend service. To set any other flag, add it to a `docker-compose.override.yml` next to the compose file; Compose merges that file automatically:++```yaml+services:+ backend:+ environment:+ FF_PLUGINS_V1: "true"+```++For allowlists or percentage rollouts, mount a rule file and point `MULTICA_FEATURE_FLAGS_FILE` at it:++```yaml+services:+ backend:+ environment:+ MULTICA_FEATURE_FLAGS_FILE: /etc/multica/feature-flags.yaml+ volumes:+ - ./feature-flags.yaml:/etc/multica/feature-flags.yaml:ro+```++```yaml+# feature-flags.yaml+project_workflows_v1:+ default: true+plugins_v1:+ default: true+```++An `FF_*` environment variable beats the file. The Compose stack sets+`FF_PROJECT_WORKFLOWS_V1` (default `true`) and the Helm chart sets every entry+in `backend.config.featureFlags`, so those flags never reach the file — change+them through the env/values instead. Use the file for the remaining flags and+for allowlist or percentage rules.++Restart the backend after changing the file or environment: `docker compose up -d backend`.++#### Kubernetes (Helm)++The chart renders `backend.config.featureFlags` as `FF_<FLAG_KEY>` environment entries and keeps Workflows on by default. For example, to enable Plugins on an existing release:++```bash+helm upgrade multica oci://ghcr.io/multica-ai/charts/multica \+ --reuse-values \+ --set backend.config.featureFlags.plugins_v1=true+```++Set `backend.config.featureFlags.project_workflows_v1=false` to hide Workflows, and `backend.config.featureFlagsFile` when you mount your own YAML rule file. `helm upgrade` rolls the backend pod when the ConfigMap changes.++#### Verify++`/api/config` reports the flags the running process resolved:++```bash+curl -s http://localhost:8080/api/config | jq '.feature_flags'+```++The web UI reads that response, so no frontend rebuild is needed. Enabling `plugins_v1` or `composio_mcp_apps` is not sufficient on its own: the related secrets and URLs must be configured as well.+### File Storage (Optional)Uploads and attachments are written to local disk by default. Set `S3_BUCKET` todiff --git a/apps/docs/content/docs/feature-flags.fr.mdx b/apps/docs/content/docs/feature-flags.fr.mdxnew file mode 100644index 0000000000..58a9c200b8--- /dev/null+++ b/apps/docs/content/docs/feature-flags.fr.mdx@@ -0,0 +1,99 @@+---+title: Drapeaux de fonctionnalité+description: Activez ou désactivez des fonctionnalités de Multica sur une instance auto-hébergée et vérifiez les valeurs par défaut.+---++import { Callout } from "fumadocs-ui/components/callout";++Certaines fonctionnalités de Multica sont contrôlées par des drapeaux côté serveur. Un déploiement auto-hébergé active les fonctionnalités stables, laisse les fonctionnalités expérimentales désactivées et ne peut pas utiliser celles réservées au Cloud. Le backend résout les drapeaux au démarrage ; redémarrez-le ou recréez-le après une modification. Pour les étapes de déploiement complètes, consultez le [démarrage rapide de l'auto-hébergement](/self-host-quickstart).++## Provenance d'un drapeau++Le serveur consulte trois sources dans l'ordre et retient la première valeur trouvée :++1. Les variables d'environnement `FF_<FLAG_KEY>`, par exemple `FF_PROJECT_WORKFLOWS_V1=false`. Ce sont les interrupteurs d'urgence de l'exploitant.+2. Le fichier de règles YAML indiqué par `MULTICA_FEATURE_FLAGS_FILE`, lorsqu'il est défini. Il sert aux listes d'autorisation et d'exclusion, aux variantes et aux déploiements progressifs en pourcentage.+3. La valeur par défaut intégrée.++## Valeurs par défaut de l'auto-hébergement++| Drapeau | Défaut | Contrôle |+|---|---|---|+| `project_workflows_v1` | activé | Les [Workflows](/workflows) des projets : étapes de statut, passations et **Paramètres → Workflows** |+| `plugins_v1` | désactivé | Catalogue et API de cycle de vie des plugins. Expérimental ; nécessite aussi `MULTICA_PLUGIN_SECRET_KEY` et un `MULTICA_PLUGIN_SURFACE_ORIGIN` sans cookie |+| `composio_mcp_apps` | désactivé | Connexions d'applications Composio. Nécessite aussi `COMPOSIO_API_KEY` |+| `billing_workspace_subscriptions` | désactivé | Abonnements et facturation Cloud. Nécessite un `MULTICA_CLOUD_URL` géré |+| `local_search_index` | activé | Synchronisation de l'index de recherche local pour le web et le bureau |++Workflows est devenu généralement disponible dans la v0.7.0 : les déploiements auto-hébergés l'activent donc par défaut. Quand le drapeau est désactivé, **Paramètres** affiche **Statuts des tâches** et les statuts de projet continuent de fonctionner comme avant.++## Docker Compose++Le fichier Compose transmet `MULTICA_FEATURE_FLAGS_FILE` et `FF_PROJECT_WORKFLOWS_V1` (défaut `true`). Définissez le drapeau dans `.env`, puis recréez le backend :++```dotenv+FF_PROJECT_WORKFLOWS_V1=false+```++```bash+docker compose up -d backend+```++L'environnement du backend est une liste blanche. Pour modifier un autre drapeau, ajoutez-le dans `docker-compose.override.yml` à côté du fichier Compose ; Compose fusionne automatiquement ce fichier :++```yaml+services:+ backend:+ environment:+ FF_PLUGINS_V1: "true"+```++## Kubernetes (Helm)++Le chart rend chaque clé de `backend.config.featureFlags` comme variable d'environnement `FF_<FLAG_KEY>` et active `project_workflows_v1` par défaut. Modifiez un drapeau sur une release existante :++```bash+helm upgrade multica oci://ghcr.io/multica-ai/charts/multica \+ --reuse-values \+ --set backend.config.featureFlags.plugins_v1=true+```++Définissez `backend.config.featureFlags.project_workflows_v1=false` pour masquer Workflows. `helm upgrade` redémarre le pod backend lorsque la ConfigMap rendue change.++## Règles avancées++Montez un fichier YAML et pointez `MULTICA_FEATURE_FLAGS_FILE` dessus lorsqu'un drapeau a besoin d'une liste d'autorisation ou d'un déploiement progressif :++```yaml+# feature-flags.yaml+project_workflows_v1:+ default: true+plugins_v1:+ default: false+ percent:+ percent: 25+ by: user_id+```++```yaml+services:+ backend:+ environment:+ MULTICA_FEATURE_FLAGS_FILE: /etc/multica/feature-flags.yaml+ volumes:+ - ./feature-flags.yaml:/etc/multica/feature-flags.yaml:ro+```++<Callout type="warning">+Les variables d'environnement ont priorité sur le fichier de règles. Le stack Compose définit toujours `FF_PROJECT_WORKFLOWS_V1` et le chart Helm définit chaque entrée de `backend.config.featureFlags` ; modifiez donc ces drapeaux via le fichier d'environnement ou les valeurs, pas via le fichier YAML.+</Callout>++## Vérifier une modification++`/api/config` renvoie les drapeaux résolus par le backend en cours d'exécution :++```bash+curl -s http://localhost:8080/api/config | jq '.feature_flags'+```++L'application web lit cette réponse ; aucune reconstruction du frontend n'est nécessaire. Les drapeaux expérimentaux peuvent changer ou disparaître d'une version à l'autre ; laissez-les désactivés sauf si vous testez la fonctionnalité.diff --git a/apps/docs/content/docs/feature-flags.ja.mdx b/apps/docs/content/docs/feature-flags.ja.mdxnew file mode 100644index 0000000000..1612a265f8--- /dev/null+++ b/apps/docs/content/docs/feature-flags.ja.mdx@@ -0,0 +1,99 @@+---+title: 機能フラグ+description: セルフホスト環境で Multica の機能を有効化・無効化し、デフォルト値を確認します。+---++import { Callout } from "fumadocs-ui/components/callout";++Multica の一部の機能は、サーバー側の機能フラグで制御されています。セルフホスト環境では安定した機能は有効、実験的な機能は無効、Cloud 専用の機能は利用できません。バックエンドは起動時にフラグを解決するため、変更後は再起動またはコンテナの再作成が必要です。完全なデプロイ手順は[セルフホストクイックスタート](/self-host-quickstart)を参照してください。++## フラグの取得元++サーバーは次の 3 つの取得元を順に確認し、最初に見つかった値を使います。++1. `FF_<FLAG_KEY>` 環境変数(例: `FF_PROJECT_WORKFLOWS_V1=false`)。運用者が使う非常停止スイッチです。+2. `MULTICA_FEATURE_FLAGS_FILE` で指定した YAML ルールファイル(設定時のみ)。許可リストと拒否リスト、バリアント、パーセントロールアウトに使います。+3. 組み込みのデフォルト値。++## セルフホストのデフォルト++| フラグ | デフォルト | 制御する機能 |+|---|---|---|+| `project_workflows_v1` | 有効 | プロジェクトの[ワークフロー](/workflows): ステータスの流れ、引き継ぎ、**設定 → ワークフロー** |+| `plugins_v1` | 無効 | プラグインのカタログとライフサイクル API。実験的。`MULTICA_PLUGIN_SECRET_KEY` と Cookie を使わない `MULTICA_PLUGIN_SURFACE_ORIGIN` も必要です |+| `composio_mcp_apps` | 無効 | Composio アプリの接続。`COMPOSIO_API_KEY` も必要です |+| `billing_workspace_subscriptions` | 無効 | Cloud のサブスクリプションと請求。管理された `MULTICA_CLOUD_URL` が必要です |+| `local_search_index` | 有効 | Web とデスクトップのローカル検索インデックス同期 |++ワークフローは v0.7.0 で正式提供になったため、セルフホスト環境ではデフォルトで有効です。フラグを無効にすると、**設定**には**タスクステータス**が表示され、プロジェクトのステータスは従来どおり動作します。++## Docker Compose++Compose ファイルは `MULTICA_FEATURE_FLAGS_FILE` と `FF_PROJECT_WORKFLOWS_V1`(デフォルト `true`)を転送します。`.env` でフラグを設定し、バックエンドを再作成します。++```dotenv+FF_PROJECT_WORKFLOWS_V1=false+```++```bash+docker compose up -d backend+```++バックエンドの環境変数は許可リストです。他のフラグを変更するには、Compose ファイルと同じディレクトリの `docker-compose.override.yml` に追加します。Compose はこのファイルを自動でマージします。++```yaml+services:+ backend:+ environment:+ FF_PLUGINS_V1: "true"+```++## Kubernetes(Helm)++チャートは `backend.config.featureFlags` の各キーを `FF_<FLAG_KEY>` 環境変数としてレンダリングし、`project_workflows_v1` をデフォルトで有効にします。既存のリリースでフラグを変更します。++```bash+helm upgrade multica oci://ghcr.io/multica-ai/charts/multica \+ --reuse-values \+ --set backend.config.featureFlags.plugins_v1=true+```++`backend.config.featureFlags.project_workflows_v1=false` を設定するとワークフローを非表示にできます。レンダリングされた ConfigMap が変わると、`helm upgrade` がバックエンド Pod を再起動します。++## 高度なルール++許可リストやパーセントロールアウトが必要な場合は、YAML ファイルをマウントして `MULTICA_FEATURE_FLAGS_FILE` をそのファイルに向けます。++```yaml+# feature-flags.yaml+project_workflows_v1:+ default: true+plugins_v1:+ default: false+ percent:+ percent: 25+ by: user_id+```++```yaml+services:+ backend:+ environment:+ MULTICA_FEATURE_FLAGS_FILE: /etc/multica/feature-flags.yaml+ volumes:+ - ./feature-flags.yaml:/etc/multica/feature-flags.yaml:ro+```++<Callout type="warning">+環境変数はルールファイルより優先されます。Compose スタックは常に `FF_PROJECT_WORKFLOWS_V1` を設定し、Helm チャートは `backend.config.featureFlags` の各項目を設定するため、これらのフラグは YAML ファイルではなく環境ファイルまたは values で変更してください。+</Callout>++## 変更を確認する++`/api/config` は実行中のバックエンドが解決したフラグを返します。++```bash+curl -s http://localhost:8080/api/config | jq '.feature_flags'+```++Web アプリはこのレスポンスを読むため、フロントエンドの再ビルドは不要です。実験的なフラグはリリース間で変更または削除されることがあります。機能を試す場合以外は無効のままにしてください。diff --git a/apps/docs/content/docs/feature-flags.ko.mdx b/apps/docs/content/docs/feature-flags.ko.mdxnew file mode 100644index 0000000000..97929ddedf--- /dev/null+++ b/apps/docs/content/docs/feature-flags.ko.mdx@@ -0,0 +1,99 @@+---+title: 기능 플래그+description: 셀프 호스팅 인스턴스에서 Multica 기능을 켜고 끄며 기본값을 확인합니다.+---++import { Callout } from "fumadocs-ui/components/callout";++Multica의 일부 기능은 서버 측 기능 플래그로 제어됩니다. 셀프 호스팅 배포에서는 안정적인 기능은 켜져 있고 실험적 기능은 꺼져 있으며 Cloud 전용 기능은 사용할 수 없습니다. 백엔드는 시작할 때 플래그를 결정하므로 변경 후에는 다시 시작하거나 컨테이너를 다시 만들어야 합니다. 전체 배포 단계는 [셀프 호스팅 빠른 시작](/self-host-quickstart)을 참고하세요.++## 플래그의 출처++서버는 다음 세 소스를 순서대로 확인하고 처음 찾은 값을 사용합니다.++1. `FF_<FLAG_KEY>` 환경 변수(예: `FF_PROJECT_WORKFLOWS_V1=false`). 운영자가 사용하는 비상 스위치입니다.+2. `MULTICA_FEATURE_FLAGS_FILE`에 지정한 YAML 규칙 파일(설정한 경우). 허용 목록과 차단 목록, 배리언트, 비율 롤아웃에 사용합니다.+3. 내장 기본값.++## 셀프 호스팅 기본값++| 플래그 | 기본값 | 제어 대상 |+|---|---|---|+| `project_workflows_v1` | 켜짐 | 프로젝트의 [워크플로](/workflows): 상태 흐름, 이어받기, **설정 → 워크플로** |+| `plugins_v1` | 꺼짐 | 플러그인 카탈로그와 수명 주기 API. 실험적이며 `MULTICA_PLUGIN_SECRET_KEY`와 쿠키를 쓰지 않는 `MULTICA_PLUGIN_SURFACE_ORIGIN`도 필요합니다 |+| `composio_mcp_apps` | 꺼짐 | Composio 앱 연결. `COMPOSIO_API_KEY`도 필요합니다 |+| `billing_workspace_subscriptions` | 꺼짐 | Cloud 구독과 결제. 관리되는 `MULTICA_CLOUD_URL`이 필요합니다 |+| `local_search_index` | 켜짐 | 웹과 데스크톱의 로컬 검색 인덱스 동기화 |++워크플로는 v0.7.0에서 정식 출시되었으므로 셀프 호스팅 배포에서는 기본으로 켜져 있습니다. 플래그를 끄면 **설정**에 **태스크 상태**가 표시되고 프로젝트 상태는 이전처럼 동작합니다.++## Docker Compose++Compose 파일은 `MULTICA_FEATURE_FLAGS_FILE`과 `FF_PROJECT_WORKFLOWS_V1`(기본값 `true`)을 전달합니다. `.env`에서 플래그를 설정한 뒤 백엔드를 다시 만드세요.++```dotenv+FF_PROJECT_WORKFLOWS_V1=false+```++```bash+docker compose up -d backend+```++백엔드 환경 변수는 허용 목록입니다. 다른 플래그를 바꾸려면 Compose 파일 옆의 `docker-compose.override.yml`에 추가하세요. Compose가 이 파일을 자동으로 병합합니다.++```yaml+services:+ backend:+ environment:+ FF_PLUGINS_V1: "true"+```++## Kubernetes(Helm)++차트는 `backend.config.featureFlags`의 각 키를 `FF_<FLAG_KEY>` 환경 변수로 렌더링하고 `project_workflows_v1`을 기본으로 켭니다. 기존 릴리스에서 플래그를 바꾸려면 다음과 같이 실행합니다.++```bash+helm upgrade multica oci://ghcr.io/multica-ai/charts/multica \+ --reuse-values \+ --set backend.config.featureFlags.plugins_v1=true+```++`backend.config.featureFlags.project_workflows_v1=false`를 설정하면 워크플로를 숨깁니다. 렌더링된 ConfigMap이 바뀌면 `helm upgrade`가 백엔드 Pod를 다시 시작합니다.++## 고급 규칙++허용 목록이나 비율 롤아웃이 필요하면 YAML 파일을 마운트하고 `MULTICA_FEATURE_FLAGS_FILE`을 그 파일로 지정하세요.++```yaml+# feature-flags.yaml+project_workflows_v1:+ default: true+plugins_v1:+ default: false+ percent:+ percent: 25+ by: user_id+```++```yaml+services:+ backend:+ environment:+ MULTICA_FEATURE_FLAGS_FILE: /etc/multica/feature-flags.yaml+ volumes:+ - ./feature-flags.yaml:/etc/multica/feature-flags.yaml:ro+```++<Callout type="warning">+환경 변수는 규칙 파일보다 우선합니다. Compose 스택은 항상 `FF_PROJECT_WORKFLOWS_V1`을 설정하고 Helm 차트는 `backend.config.featureFlags`의 모든 항목을 설정하므로, 이런 플래그는 YAML 파일이 아니라 env 파일이나 values에서 바꾸세요.+</Callout>++## 변경 확인++`/api/config`는 실행 중인 백엔드가 결정한 플래그를 반환합니다.++```bash+curl -s http://localhost:8080/api/config | jq '.feature_flags'+```++웹 앱은 이 응답을 읽으므로 프런트엔드를 다시 빌드할 필요가 없습니다. 실험적 플래그는 릴리스마다 바뀌거나 사라질 수 있으므로 기능을 시험할 때가 아니면 꺼 두세요.diff --git a/apps/docs/content/docs/feature-flags.mdx b/apps/docs/content/docs/feature-flags.mdxnew file mode 100644index 0000000000..aca27c2a7a--- /dev/null+++ b/apps/docs/content/docs/feature-flags.mdx@@ -0,0 +1,99 @@+---+title: Feature flags+description: Turn Multica features on or off on a self-hosted instance, and review the self-host defaults.+---++import { Callout } from "fumadocs-ui/components/callout";++Some Multica capabilities ship behind server-side feature flags. A self-hosted deployment enables the stable ones, leaves experimental ones off, and cannot use the Cloud-only ones. The backend resolves flags at startup; restart or recreate it after a change. For the complete deployment steps, see the [self-host quickstart](/self-host-quickstart).++## Where a flag comes from++The server checks three sources in order and uses the first value it finds:++1. `FF_<FLAG_KEY>` environment variables, such as `FF_PROJECT_WORKFLOWS_V1=false`. These are the operator kill switches.+2. The YAML rule file at `MULTICA_FEATURE_FLAGS_FILE`, when set. Use it for allow/deny lists, variants, and percentage rollouts.+3. The built-in default.++## Self-host defaults++| Flag | Default | Controls |+|---|---|---|+| `project_workflows_v1` | on | Project [workflows](/workflows): status flows, handoffs, and **Settings → Workflows** |+| `plugins_v1` | off | Plugin catalog and lifecycle APIs. Experimental; also needs `MULTICA_PLUGIN_SECRET_KEY` and a cookie-free `MULTICA_PLUGIN_SURFACE_ORIGIN` |+| `composio_mcp_apps` | off | Composio app connections. Also needs `COMPOSIO_API_KEY` |+| `billing_workspace_subscriptions` | off | Cloud subscriptions and billing. Requires a managed `MULTICA_CLOUD_URL` |+| `local_search_index` | on | Local search index sync for the web and desktop apps |++Workflows shipped generally available in v0.7.0, so self-hosted deployments enable them by default. With the flag off, **Settings** shows **Issue Statuses** instead, and project statuses keep working as before.++## Docker Compose++The Compose file forwards `MULTICA_FEATURE_FLAGS_FILE` and `FF_PROJECT_WORKFLOWS_V1` (default `true`). Set the flag in `.env`, then recreate the backend:++```dotenv+FF_PROJECT_WORKFLOWS_V1=false+```++```bash+docker compose up -d backend+```++The backend environment is an allowlist. To change any other flag, add it in `docker-compose.override.yml` next to the Compose file; Compose merges that file automatically:++```yaml+services:+ backend:+ environment:+ FF_PLUGINS_V1: "true"+```++## Kubernetes (Helm)++The chart renders every `backend.config.featureFlags` key as an `FF_<FLAG_KEY>` environment variable and keeps `project_workflows_v1` on. Change a flag on an existing release:++```bash+helm upgrade multica oci://ghcr.io/multica-ai/charts/multica \+ --reuse-values \+ --set backend.config.featureFlags.plugins_v1=true+```++Set `backend.config.featureFlags.project_workflows_v1=false` to hide Workflows. `helm upgrade` restarts the backend pod when the rendered ConfigMap changes.++## Advanced rules++Mount a YAML file and point `MULTICA_FEATURE_FLAGS_FILE` at it when a flag needs an allowlist or a percentage rollout:++```yaml+# feature-flags.yaml+project_workflows_v1:+ default: true+plugins_v1:+ default: false+ percent:+ percent: 25+ by: user_id+```++```yaml+services:+ backend:+ environment:+ MULTICA_FEATURE_FLAGS_FILE: /etc/multica/feature-flags.yaml+ volumes:+ - ./feature-flags.yaml:/etc/multica/feature-flags.yaml:ro+```++<Callout type="warning">+Environment variables beat the rule file. The Compose stack always sets `FF_PROJECT_WORKFLOWS_V1`, and the Helm chart sets every `backend.config.featureFlags` entry, so change those flags through the env file or values instead of the YAML file.+</Callout>++## Verify a change++`/api/config` returns the flags the running backend resolved:++```bash+curl -s http://localhost:8080/api/config | jq '.feature_flags'+```++The web app reads that response, so no frontend rebuild is needed. Experimental flags can change or disappear between releases; leave them off unless you are testing the feature.diff --git a/apps/docs/content/docs/feature-flags.zh.mdx b/apps/docs/content/docs/feature-flags.zh.mdxnew file mode 100644index 0000000000..5ebac1a221--- /dev/null+++ b/apps/docs/content/docs/feature-flags.zh.mdx@@ -0,0 +1,99 @@+---+title: 功能开关+description: 在自托管实例上开启或关闭 Multica 功能,并了解默认值。+---++import { Callout } from "fumadocs-ui/components/callout";++Multica 的部分能力由服务端功能开关控制。自托管部署默认开启稳定功能、关闭实验性功能,Cloud 专属功能不可用。后端在启动时解析开关;修改后需要重启或重建后端。完整部署步骤见[自托管快速上手](/self-host-quickstart)。++## 开关的来源++服务端按顺序检查三个来源,取第一个找到的值:++1. `FF_<FLAG_KEY>` 环境变量,例如 `FF_PROJECT_WORKFLOWS_V1=false`。这些是运维用的紧急关闭开关。+2. `MULTICA_FEATURE_FLAGS_FILE` 指向的 YAML 规则文件(设置后生效)。用于白名单、黑名单、变体和按百分比灰度。+3. 内置默认值。++## 自托管默认值++| 开关 | 默认值 | 控制的功能 |+|---|---|---|+| `project_workflows_v1` | 开启 | 项目的[工作流](/workflows):状态流转、交接,以及**设置 → 工作流** |+| `plugins_v1` | 关闭 | 插件目录和生命周期 API。实验性;还需要 `MULTICA_PLUGIN_SECRET_KEY` 和不带 cookie 的 `MULTICA_PLUGIN_SURFACE_ORIGIN` |+| `composio_mcp_apps` | 关闭 | Composio 应用连接。还需要 `COMPOSIO_API_KEY` |+| `billing_workspace_subscriptions` | 关闭 | Cloud 订阅与账单。需要配置托管的 `MULTICA_CLOUD_URL` |+| `local_search_index` | 开启 | Web 和 Desktop 的本地搜索索引同步 |++工作流在 v0.7.0 正式可用,因此自托管部署默认开启。关闭后,**设置**中显示的是**任务状态**,项目状态照常工作。++## Docker Compose++Compose 文件会转发 `MULTICA_FEATURE_FLAGS_FILE` 和 `FF_PROJECT_WORKFLOWS_V1`(默认 `true`)。在 `.env` 中设置开关,然后重建后端:++```dotenv+FF_PROJECT_WORKFLOWS_V1=false+```++```bash+docker compose up -d backend+```++后端的环境变量是白名单。要修改其他开关,请加到 Compose 文件旁的 `docker-compose.override.yml`,Compose 会自动合并该文件:++```yaml+services:+ backend:+ environment:+ FF_PLUGINS_V1: "true"+```++## Kubernetes(Helm)++Helm chart 会把 `backend.config.featureFlags` 的每一项渲染为 `FF_<FLAG_KEY>` 环境变量,并默认开启 `project_workflows_v1`。在已有 release 上修改:++```bash+helm upgrade multica oci://ghcr.io/multica-ai/charts/multica \+ --reuse-values \+ --set backend.config.featureFlags.plugins_v1=true+```++设置 `backend.config.featureFlags.project_workflows_v1=false` 可以隐藏工作流。渲染出的 ConfigMap 变化后,`helm upgrade` 会重启后端 Pod。++## 高级规则++需要白名单或按百分比灰度时,挂载一个 YAML 文件,并把 `MULTICA_FEATURE_FLAGS_FILE` 指向它:++```yaml+# feature-flags.yaml+project_workflows_v1:+ default: true+plugins_v1:+ default: false+ percent:+ percent: 25+ by: user_id+```++```yaml+services:+ backend:+ environment:+ MULTICA_FEATURE_FLAGS_FILE: /etc/multica/feature-flags.yaml+ volumes:+ - ./feature-flags.yaml:/etc/multica/feature-flags.yaml:ro+```++<Callout type="warning">+环境变量优先于规则文件。Compose 栈始终设置 `FF_PROJECT_WORKFLOWS_V1`,Helm chart 会设置 `backend.config.featureFlags` 中的每一项,因此这些开关要通过 env 文件或 values 修改,而不是 YAML 文件。+</Callout>++## 验证修改++`/api/config` 会返回运行中的后端解析出的开关:++```bash+curl -s http://localhost:8080/api/config | jq '.feature_flags'+```++Web 端读取该响应,不需要重建前端。实验性开关可能在不同版本间变化或消失;除非正在测试该功能,否则保持关闭。diff --git a/apps/docs/content/docs/meta.fr.json b/apps/docs/content/docs/meta.fr.jsonindex 9224b701a6..61093daae2 100644--- a/apps/docs/content/docs/meta.fr.json+++ b/apps/docs/content/docs/meta.fr.json@@ -50,6 +50,7 @@"---Auto-hébergement---","security-model","environment-variables",+ "feature-flags","auth-setup","troubleshooting","---Référence---",diff --git a/apps/docs/content/docs/meta.ja.json b/apps/docs/content/docs/meta.ja.jsonindex 5b15436ea3..02a5fab30d 100644--- a/apps/docs/content/docs/meta.ja.json+++ b/apps/docs/content/docs/meta.ja.json@@ -50,6 +50,7 @@"---セルフホスティング---","security-model","environment-variables",+ "feature-flags","auth-setup","troubleshooting","---リファレンス---",diff --git a/apps/docs/content/docs/meta.json b/apps/docs/content/docs/meta.jsonindex f21ac50faf..416354b985 100644--- a/apps/docs/content/docs/meta.json+++ b/apps/docs/content/docs/meta.json@@ -50,6 +50,7 @@"---Self-hosting---","security-model","environment-variables",+ "feature-flags","auth-setup","troubleshooting","---Reference---",diff --git a/apps/docs/content/docs/meta.ko.json b/apps/docs/content/docs/meta.ko.jsonindex 64ee0a452e..4964990e36 100644--- a/apps/docs/content/docs/meta.ko.json+++ b/apps/docs/content/docs/meta.ko.json@@ -50,6 +50,7 @@"---자체 호스팅---","security-model","environment-variables",+ "feature-flags","auth-setup","troubleshooting","---레퍼런스---",diff --git a/apps/docs/content/docs/meta.zh.json b/apps/docs/content/docs/meta.zh.jsonindex 545466c64f..020a720017 100644--- a/apps/docs/content/docs/meta.zh.json+++ b/apps/docs/content/docs/meta.zh.json@@ -50,6 +50,7 @@"---自托管---","security-model","environment-variables",+ "feature-flags","auth-setup","troubleshooting","---参考---",diff --git a/deploy/helm/multica/templates/configmap.yaml b/deploy/helm/multica/templates/configmap.yamlindex 9912863cb0..853463689e 100644--- a/deploy/helm/multica/templates/configmap.yaml+++ b/deploy/helm/multica/templates/configmap.yaml@@ -24,6 +24,17 @@ data:WORKSPACE_CREATION_ALLOWED_EMAILS: {{ .Values.backend.config.workspaceCreationAllowedEmails | quote }}DO_NOT_TRACK: {{ .Values.backend.config.doNotTrack | quote }}MULTICA_VCS_INTEGRATION_ENABLED: {{ .Values.backend.config.vcsIntegrationEnabled | quote }}+ MULTICA_FEATURE_FLAGS_FILE: {{ .Values.backend.config.featureFlagsFile | quote }}+ {{- $featureFlags := .Values.backend.config.featureFlags | default dict }}+ {{- if not (hasKey $featureFlags "project_workflows_v1") }}+ # Workflows are GA and enabled by default for self-hosted deployments. This+ # branch keeps the default when `helm upgrade --reuse-values` carries no+ # featureFlags map from the previous release.+ FF_PROJECT_WORKFLOWS_V1: "true"+ {{- end }}+ {{- range $flag, $state := $featureFlags }}+ {{ printf "FF_%s" (upper $flag) }}: {{ $state | quote }}+ {{- end }}MULTICA_CLOUD_URL: {{ .Values.backend.config.cloud.url | quote }}GOOGLE_CLIENT_ID: {{ .Values.backend.config.googleClientId | quote }}GOOGLE_REDIRECT_URI: {{ .Values.backend.config.googleRedirectUri | quote }}diff --git a/deploy/helm/multica/values.yaml b/deploy/helm/multica/values.yamlindex 2e6c387154..320f0f16b3 100644--- a/deploy/helm/multica/values.yaml+++ b/deploy/helm/multica/values.yaml@@ -160,6 +160,19 @@ backend:# MULTICA_VCS_SECRET_KEY through existingSecret before connections work.# Set false to hide and reject the integration for this deployment.vcsIntegrationEnabled: true+ # Self-host feature flags, rendered as FF_<FLAG_KEY> env entries on the+ # backend. Keys are flag names (snake_case); values are passed as strings,+ # so boolean switches and percentage strings such as "25%" both work.+ # Workflows are GA and enabled by default; experimental and Cloud-only+ # flags stay off unless added here. Flags absent from this map keep their+ # built-in default. These are env overrides, so they take precedence over+ # featureFlagsFile.+ featureFlags:+ project_workflows_v1: true+ # Optional path to a YAML feature-flag rule file inside the backend+ # container. Mount the file yourself and point this value at it; empty+ # disables the file provider.+ featureFlagsFile: ""# Managed multica-cloud connection. Empty keeps self-hosting independent.# Fleet, Billing, entitlement policy and strict seat capacity share it.cloud:diff --git a/docker-compose.selfhost.yml b/docker-compose.selfhost.ymlindex cedd8d6aff..d7145a4292 100644--- a/docker-compose.selfhost.yml+++ b/docker-compose.selfhost.yml@@ -164,6 +164,15 @@ services:MULTICA_LLM_DEFAULT_MODEL: ${MULTICA_LLM_DEFAULT_MODEL:-}MULTICA_LLM_MAX_RETRIES: ${MULTICA_LLM_MAX_RETRIES:-}MULTICA_LLM_DISABLE_THINKING: ${MULTICA_LLM_DISABLE_THINKING:-}+ # Feature flags. Workflows are GA and enabled by default for self-hosted+ # deployments; experimental and Cloud-only flags stay off unless an+ # operator opts in. Set MULTICA_FEATURE_FLAGS_FILE to a YAML rule file+ # mounted into the container to configure any flag (including allowlists+ # and percentage rollouts), or override a single flag with+ # FF_<FLAG_KEY>. FF_* values beat the file. Only variables listed in this+ # service reach the container; see SELF_HOSTING_ADVANCED.md#feature-flags.+ MULTICA_FEATURE_FLAGS_FILE: ${MULTICA_FEATURE_FLAGS_FILE:-}+ FF_PROJECT_WORKFLOWS_V1: ${FF_PROJECT_WORKFLOWS_V1:-true}# Lark / Feishu bot integration. MULTICA_LARK_SECRET_KEY is the# opt-in: unset = integration disabled. Mainland 飞书 and international# Lark are auto-detected per installation and served side by side, sodiff --git a/scripts/helm-config.test.sh b/scripts/helm-config.test.shindex b4f70b7702..84b51dcb23 100644--- a/scripts/helm-config.test.sh+++ b/scripts/helm-config.test.sh@@ -37,6 +37,39 @@ require_rendered_value "$default_config" 'MULTICA_CLOUD_URL: ""'require_rendered_value "$default_config" 'MULTICA_DATABASE_STARTUP_TIMEOUT: "3m"'require_rendered_value "$default_config" 'MULTICA_DATABASE_CONNECT_TIMEOUT: "5s"'+# Feature flags are part of the self-host contract: Workflows are GA and on by+# default, and operators can flip any flag through values without editing+# templates. A chart that silently drops these keys leaves the shipped default+# in place, so assert the rendered env entries themselves.+require_rendered_value "$default_config" 'MULTICA_FEATURE_FLAGS_FILE: ""'+require_rendered_value "$default_config" 'FF_PROJECT_WORKFLOWS_V1: "true"'+workflows_disabled_config="$(+ helm template multica "$CHART_DIR" \+ --show-only templates/configmap.yaml \+ --set backend.config.featureFlags.project_workflows_v1=false+)"+require_rendered_value "$workflows_disabled_config" 'FF_PROJECT_WORKFLOWS_V1: "false"'+plugins_enabled_config="$(+ helm template multica "$CHART_DIR" \+ --show-only templates/configmap.yaml \+ --set backend.config.featureFlags.plugins_v1=true+)"+require_rendered_value "$plugins_enabled_config" 'FF_PLUGINS_V1: "true"'+flags_file_config="$(+ helm template multica "$CHART_DIR" \+ --show-only templates/configmap.yaml \+ --set backend.config.featureFlagsFile=/etc/multica/feature-flags.yaml+)"+require_rendered_value "$flags_file_config" 'MULTICA_FEATURE_FLAGS_FILE: "/etc/multica/feature-flags.yaml"'+# `helm upgrade --reuse-values` from a release that predates featureFlags+# carries no map at all; the chart must still keep Workflows on.+reuse_values_config="$(+ helm template multica "$CHART_DIR" \+ --show-only templates/configmap.yaml \+ --set backend.config.featureFlags=null+)"+require_rendered_value "$reuse_values_config" 'FF_PROJECT_WORKFLOWS_V1: "true"'+require_rendered_value "$default_config" 'MAINTENANCE_PORT: ""'maintenance_config="$(helm template multica "$CHART_DIR" --show-only templates/configmap.yaml --set-string backend.config.maintenancePort=6061)"require_rendered_value "$maintenance_config" 'MAINTENANCE_PORT: "6061"'diff --git a/scripts/selfhost-config.test.sh b/scripts/selfhost-config.test.shindex ca0161f271..1d6497333f 100755--- a/scripts/selfhost-config.test.sh+++ b/scripts/selfhost-config.test.sh@@ -70,6 +70,14 @@ require_config "$config" 'DATABASE_REPLICA_URL: postgres://reader:secret@replicarequire_config "$config" 'DATABASE_REPLICA_MAX_CONNS: "12"'require_config "$config" 'DATABASE_REPLICA_MIN_CONNS: "1"'+# Feature flags are part of the self-host contract. Workflows are GA, so the+# Compose stack turns them on unless the env file says otherwise; a deployment+# that leaves the flag at the server default hides the feature silently.+require_config "$config" 'MULTICA_FEATURE_FLAGS_FILE: ""'+require_config "$config" 'FF_PROJECT_WORKFLOWS_V1: "true"'+workflows_disabled_config="$(FF_PROJECT_WORKFLOWS_V1=false docker compose --env-file "$tmp_env" -f docker-compose.selfhost.yml config)"+require_config "$workflows_disabled_config" 'FF_PROJECT_WORKFLOWS_V1: "false"'+# The backend environment is an explicit allowlist, so a variable documented in# .env.example but missing here silently never reaches the container: the# operator configures it, the server never sees it, and nothing reports the gap.@@ -88,6 +96,16 @@ while IFS= read -r llm_var; dofidone < <(grep -oE '^MULTICA_LLM_[A-Z_]+' .env.example)+# Same drift check for feature flags: every FF_* the env template advertises+# must reach the backend service, or setting it in .env is a no-op.+while IFS= read -r flag_var; do+ if ! grep -Eq "^[[:space:]]+${flag_var}: \\\$\{${flag_var}:-" docker-compose.selfhost.yml; then+ echo "$flag_var is documented in .env.example but not mapped into the backend"+ echo "service in docker-compose.selfhost.yml, so self-hosted deployments cannot set it."+ exit 1+ fi+done < <(grep -oE '^FF_[A-Z0-9_]+' .env.example)+# The same drift for integration encryption keys, keyed on the server rather# than on .env.example: each secretbox.LoadKey() gates an integration that# stays silently disabled when its key never reaches the container. Telegram's