Skip to content

feat(channels): put the feature behind a flag (env var + UI switch) - #6651

Draft
mmabrouk wants to merge 3 commits into
channels/fix-approvals-seamfrom
channels/feature-flag
Draft

feat(channels): put the feature behind a flag (env var + UI switch)#6651
mmabrouk wants to merge 3 commits into
channels/fix-approvals-seamfrom
channels/feature-flag

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Sep 8, 2026

Copy link
Copy Markdown
Member

Context

Stacked on #6650. The channels feature must ship dark, so a release can carry it without exposing it, and so we can turn it on only where we test.

Changes

Two independent gates:

  • Deployment flag. AGENTA_CHANNELS_ENABLED (default false) decides whether the ingress and the configuration routes mount and whether the inbox broker starts. Off, the whole surface 404s and the worker stays idle. NEXT_PUBLIC_AGENTA_CHANNELS_ENABLED is the same flag for the web; the web entrypoint maps the deployment variable into the public one, exactly as it does for the tools flag.
  • Per-user switch. A "Channels" toggle in Settings, Preferences (BETA). Even with the deployment flag on, a person opts in before the Channels settings tab appears. The tab gates on both.

Both env examples document the flag. The flag is on for the QA stack.

Tests

  • OSS web typecheck and the shared package typecheck pass.
  • The stack runs with the flag on: the channels catalog route answers 200, and the backend reports channels.enabled=true. With the flag off, the routes are absent.

https://claude.ai/code/session_01HXt8WBUK9MrWKNTYbUKpaT

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 8, 2026 2:54pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
📝 Summary

Summary by CodeRabbit

  • New Features

    • Added a Channels feature toggle for deployments, with support for enabling it through environment configuration.
    • Added access controls for the Channels settings tab, requiring both deployment enablement and a per-user preference.
    • Added runtime configuration support for the Channels feature across the web application.
  • Behavior Changes

    • When Channels are disabled, related ingress and configuration routes return 404 responses, and inbox processing remains inactive.
    • Added documented configuration options for development environments, disabled by default.

Walkthrough

The PR gates channel broker activity and channel routes with AGENTA_CHANNELS_ENABLED. It exposes the deployment flag to the frontend and adds a per-user Channels settings switch that controls tab visibility.

Changes

Channels Feature Gating

Layer / File(s) Summary
Backend channels gating
api/oss/src/utils/env.py, api/entrypoints/routers.py, hosting/docker-compose/*
ChannelsConfig.enabled reads AGENTA_CHANNELS_ENABLED. Broker startup, shutdown, and channel route registration now require this flag. Development environment templates document both channel variables.
Frontend deployment flag wiring
web/entrypoint.sh, web/oss/src/lib/helpers/dynamicEnv.ts, web/packages/agenta-shared/src/api/*
The deployment flag is added to runtime configuration and exposed through isChannelsEnabled.
Settings visibility and user opt-in
web/packages/agenta-shared/src/state/*, web/oss/src/components/pages/settings/*, web/packages/agenta-settings/src/*
A per-user channelsSettingsEnabledAtom controls the Channels preference. The settings tab is visible only when both the deployment flag and user switch are enabled.

Priority: ⬇️ Low — Defer the Channels feature-gating change because it is an opt-in deployment and per-user control with routes and the inbox worker disabled by default.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to 8c1bd

Channels remains disabled unless the deployment flag enables it, but the environment examples can mislead operators into setting a frontend flag that the runtime configuration overrides. Clarifying the documented source of truth is advisable before deployment.

Sequence Diagram(s)

sequenceDiagram
  participant Environment
  participant ChannelsConfig
  participant BackendRouters
  participant RuntimeConfig
  participant SettingsAccess
  participant SettingsNavigation
  Environment->>ChannelsConfig: Read AGENTA_CHANNELS_ENABLED
  ChannelsConfig->>BackendRouters: Provide channels enabled state
  BackendRouters->>BackendRouters: Start broker and mount routes when enabled
  RuntimeConfig->>SettingsAccess: Provide NEXT_PUBLIC_AGENTA_CHANNELS_ENABLED
  SettingsAccess->>SettingsAccess: Combine deployment flag with user opt-in
  SettingsAccess->>SettingsNavigation: Provide canShowChannels
  SettingsNavigation->>SettingsNavigation: Show or hide Channels tab
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: placing the Channels feature behind deployment and UI feature flags.
Description check ✅ Passed The description directly explains the deployment flag, per-user switch, environment configuration, and reported tests for the Channels feature.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 12 files. (2 skipped: 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch channels/feature-flag

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mmabrouk

mmabrouk commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
api/oss/src/utils/env.py (1)

814-817: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten the feature-gate comments. Keep one short line that explains only the non-obvious reason for the deployment gate.

  • api/oss/src/utils/env.py#L814-L817: replace the four-line comment with one short line.
  • api/entrypoints/routers.py#L1665-L1667: replace the three-line comment with one short line.

As per coding guidelines, comments must be minimal, explain only the non-obvious why, and contain at most one short line.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 248a0ac8-be25-45d9-bfbd-bfb1b5f74db5

📥 Commits

Reviewing files that changed from the base of the PR and between a6e8a40 and 8c1bdeb.

📒 Files selected for processing (14)
  • api/entrypoints/routers.py
  • api/oss/src/utils/env.py
  • hosting/docker-compose/ee/env.ee.dev.example
  • hosting/docker-compose/oss/env.oss.dev.example
  • web/entrypoint.sh
  • web/oss/src/components/pages/settings/Preferences/Preferences.tsx
  • web/oss/src/components/pages/settings/hooks/useSettingsAccess.ts
  • web/oss/src/lib/helpers/dynamicEnv.ts
  • web/packages/agenta-settings/src/access.tsx
  • web/packages/agenta-settings/src/navigation.ts
  • web/packages/agenta-shared/src/api/env.ts
  • web/packages/agenta-shared/src/api/index.ts
  • web/packages/agenta-shared/src/state/featureFlags.ts
  • web/packages/agenta-shared/src/state/index.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread web/entrypoint.sh
…I switch

The channels feature ships dark. Two independent gates:

- AGENTA_CHANNELS_ENABLED (backend, default false): the ingress and the
  configuration routes do not mount and the inbox broker does not start,
  so a deployment carries the code without exposing the feature.
  NEXT_PUBLIC_AGENTA_CHANNELS_ENABLED is the same flag for the web.
- A per-user switch in Settings > Preferences ("Channels", BETA): even
  with the deployment flag on, a person opts in before the Channels
  settings tab appears. The tab's visibility is gated on both.

Both env examples document the flag; the web entrypoint maps the
deployment variable into the public one, as it does for the tools flag.

Claude-Session: https://claude.ai/code/session_01HXt8WBUK9MrWKNTYbUKpaT
…nput (CodeRabbit)

entrypoint.sh writes NEXT_PUBLIC_AGENTA_CHANNELS_ENABLED from
AGENTA_CHANNELS_ENABLED, so the examples list only the deployment variable
and say the public one is derived.

Claude-Session: https://claude.ai/code/session_01HXt8WBUK9MrWKNTYbUKpaT
… per-user switch

The per-user Preferences toggle gated the tab a second time and defaulted
off, so the tab was invisible even with the feature enabled. The tab now
shows whenever AGENTA_CHANNELS_ENABLED is on, like the other edition-gated
tabs. The dead per-user switch and its atom are removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant