Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🔥 refactor(gateway): remove the agent_gateway_mux rollout flag (#22047)

Arvin Xu37be0ccefcf0
diff --git a/docs/self-hosting/advanced/feature-flags.mdx b/docs/self-hosting/advanced/feature-flags.mdx
index f8f01037bee..824ec9a3a17 100644
--- a/docs/self-hosting/advanced/feature-flags.mdx
+++ b/docs/self-hosting/advanced/feature-flags.mdx
@@ -42,8 +42,7 @@ You can achieve various feature combinations using the above configuration synta
| `openai_proxy_url` | Allows users to customize the OpenAI proxy URL. | Enabled |
| `api_key_manage` | Controls access to API key management page (/profile/apikey). | Disabled |
| `agent_share` | Gates new or re-enabled interactive Agent shares. Requires deployment support; see the boundary below. | Disabled |
-| `agent_gateway_mux` | Routes agent runs over one multiplexed gateway socket per user. Requires a gateway that serves `/v2/ws` (`AGENT_GATEWAY_PROTOCOL=2`). | Disabled |
-| `agent_gateway_mux_mobile` | LobeHub Mobile rollout switch for the multiplexed gateway socket and protocol-v2 payloads; independent from `agent_gateway_mux`. Requires a gateway that serves `/v2/ws`. | Disabled |
+| `agent_gateway_mux_mobile` | LobeHub Mobile rollout switch for the multiplexed gateway socket and protocol-v2 payloads; Web needs no flag and follows `AGENT_GATEWAY_PROTOCOL`. Requires a gateway that serves `/v2/ws`. | Disabled |
| `agent_llm_relay` | Runs LLM calls for model providers only the user's device can reach (local Ollama / LM Studio, private-network endpoints) on the client that started the run, while the agent loop stays on the server. Requires an open LobeHub client for such runs. | Disabled |
| `dashboard` | Dashboards: the home and project dashboard pages, the widget Portal, in-chat widget previews and the `builtin-dashboard` agent tool that builds monitoring widgets. When off, these are hidden and the widget / dashboard APIs return FORBIDDEN; widgets already published keep refreshing on their schedule. | Disabled |
| `edit_agent` | Allows users to edit assistants. | Enabled |
diff --git a/docs/self-hosting/advanced/feature-flags.zh-CN.mdx b/docs/self-hosting/advanced/feature-flags.zh-CN.mdx
index c748fcc2194..2e5dfb5f413 100644
--- a/docs/self-hosting/advanced/feature-flags.zh-CN.mdx
+++ b/docs/self-hosting/advanced/feature-flags.zh-CN.mdx
@@ -40,8 +40,7 @@ tags:
| `openai_proxy_url` | 允许用户自定义 OpenAI 代理 URL。 | 开启 |
| `api_key_manage` | 控制 API 密钥管理页面 (/profile/apikey) 的访问。 | 关闭 |
| `agent_share` | 控制新建或重新启用交互式助理分享;还需部署支持,详见下文边界。 | 关闭 |
-| `agent_gateway_mux` | 让助理运行共用一条按用户复用的网关连接;需要网关提供 `/v2/ws`(`AGENT_GATEWAY_PROTOCOL=2`)。 | 关闭 |
-| `agent_gateway_mux_mobile` | LobeHub Mobile 使用多路复用网关连接与 v2 协议载荷的灰度开关,独立于 `agent_gateway_mux`;需要网关提供 `/v2/ws`。 | 关闭 |
+| `agent_gateway_mux_mobile` | LobeHub Mobile 使用多路复用网关连接与 v2 协议载荷的灰度开关;Web 无需开关,跟随 `AGENT_GATEWAY_PROTOCOL`;需要网关提供 `/v2/ws`。 | 关闭 |
| `agent_llm_relay` | 对只有用户设备能访问的模型服务商(本地 Ollama / LM Studio、私网地址),由发起运行的客户端执行单次模型调用,助理循环仍在服务端运行;这类运行需要有打开的 LobeHub 客户端。 | 关闭 |
| `dashboard` | 看板:首页与项目看板页面、监控组件侧边栏、对话内的组件预览,以及用于搭建监控组件的 `builtin-dashboard` 助理工具。关闭时以上入口均隐藏,组件与看板相关接口返回 FORBIDDEN;已发布的组件仍按计划刷新。 | 关闭 |
| `edit_agent` | 允许用户编辑助手。 | 开启 |
diff --git a/packages/agent-gateway-client/PROTOCOL_V2.md b/packages/agent-gateway-client/PROTOCOL_V2.md
index e00416a56b1..7b252f53d58 100644
--- a/packages/agent-gateway-client/PROTOCOL_V2.md
+++ b/packages/agent-gateway-client/PROTOCOL_V2.md
@@ -363,6 +363,8 @@ Behavior:
- Labs flag `enableGatewayMux` (labPrefer selector + `LAB_FEATURES` entry `gatewayMux`,
stage `alpha`, i18n `labs` namespace en-US + zh-CN).
+ _Update: the rollout gate (later the `agent_gateway_mux` feature flag) has been
+ removed. Web takes v2 wherever `serverConfig.agentGatewayProtocol === 2`._
- `GatewayActionImpl.createClient(options, ctx)` — when the flag is on, return
`createOperationClient(getMux(identity), operationId, {...})` where `identity` is
`'owner'` (getToken = `aiAgentService.issueGatewayUserToken`) or `share:${agentShareId}`
diff --git a/packages/agent-gateway-client/src/protocol.ts b/packages/agent-gateway-client/src/protocol.ts
index 7bcb498eb5e..ed74773e5ad 100644
--- a/packages/agent-gateway-client/src/protocol.ts
+++ b/packages/agent-gateway-client/src/protocol.ts
@@ -1,9 +1,10 @@
/**
* Highest wire protocol this bundle speaks to the Agent Gateway and to the run
- * that feeds it. Sent when a run starts (`clientProtocol`) — subject to the
- * rollout gate, see `canUseGatewayProtocolV2` — so the run may deliver message
- * revisions (`message_patch`) instead of whole `uiMessages` snapshots. A client
- * that sends nothing is treated as protocol 1 and keeps the snapshots.
+ * that feeds it. Sent when a run starts (`clientProtocol`) — only when the
+ * deployment's gateway serves v2, see `canUseGatewayProtocolV2` — so the run
+ * may deliver message revisions (`message_patch`) instead of whole
+ * `uiMessages` snapshots. A client that sends nothing is treated as protocol 1
+ * and keeps the snapshots.
*
* Bump this only together with the client-side handling of whatever the new
* version lets the server omit — a desktop build lags the server by weeks, and
diff --git a/packages/app-config/src/featureFlags/schema.test.ts b/packages/app-config/src/featureFlags/schema.test.ts
index 0ef5805a2e8..07b426a09fc 100644
--- a/packages/app-config/src/featureFlags/schema.test.ts
+++ b/packages/app-config/src/featureFlags/schema.test.ts
@@ -205,7 +205,7 @@ describe('mapFeatureFlagsEnvToState', () => {
expect(mapFeatureFlagsEnvToState(config, 'user-456').enableTopicPreview).toBe(false);
});
- it('should gate the mobile gateway mux independently from the Web flag', () => {
+ it('should gate the mobile gateway mux behind its own flag', () => {
expect(DEFAULT_FEATURE_FLAGS.agent_gateway_mux_mobile).toBe(false);
expect(mapFeatureFlagsEnvToState(DEFAULT_FEATURE_FLAGS, 'user-1').enableGatewayMuxMobile).toBe(
false,
@@ -213,16 +213,11 @@ describe('mapFeatureFlagsEnvToState', () => {
const everyone = mapFeatureFlagsEnvToState({ agent_gateway_mux_mobile: true }, 'user-1');
expect(everyone.enableGatewayMuxMobile).toBe(true);
- expect(everyone.enableGatewayMux).toBeFalsy();
const config = { agent_gateway_mux_mobile: ['user-123'] };
expect(mapFeatureFlagsEnvToState(config, 'user-123').enableGatewayMuxMobile).toBe(true);
expect(mapFeatureFlagsEnvToState(config, 'user-456').enableGatewayMuxMobile).toBe(false);
expect(mapFeatureFlagsEnvToState(config).enableGatewayMuxMobile).toBe(false);
-
- const webOnly = mapFeatureFlagsEnvToState({ agent_gateway_mux: true }, 'user-1');
- expect(webOnly.enableGatewayMux).toBe(true);
- expect(webOnly.enableGatewayMuxMobile).toBeFalsy();
});
it('should keep dashboards off by default and enable them per user or globally', () => {
diff --git a/packages/app-config/src/featureFlags/schema.ts b/packages/app-config/src/featureFlags/schema.ts
index cfc3d501fd5..acce4f3072e 100644
--- a/packages/app-config/src/featureFlags/schema.ts
+++ b/packages/app-config/src/featureFlags/schema.ts
@@ -39,21 +39,10 @@ export const FeatureFlagsSchema = z.object({
rag_eval: FeatureFlagValue.optional(),
- /**
- * Rollout gate for the multiplexed Agent Gateway socket (protocol v2: one
- * `/v2/ws` connection per user instead of one per run). Array values are user
- * ids, so the rollout can go allowlist → everyone without a deploy.
- *
- * Deployment support is independent and enforced separately: the client also
- * requires `serverConfig.agentGatewayProtocol === 2`, because a gateway
- * without `/v2/ws` cannot serve this no matter what the flag says.
- */
- agent_gateway_mux: FeatureFlagValue.optional(),
-
/**
* LobeHub Mobile rollout switch for the multiplexed gateway socket and
- * protocol-v2 payloads. Independent from `agent_gateway_mux`: flipping one
- * never changes the other client. Array values are user ids.
+ * protocol-v2 payloads. Web needs no flag: it takes v2 wherever
+ * `serverConfig.agentGatewayProtocol === 2`. Array values are user ids.
*/
agent_gateway_mux_mobile: FeatureFlagValue.optional(),
@@ -146,9 +135,8 @@ export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
knowledge_base: true,
rag_eval: false,
- // Off until an admin publishes a user allowlist or flips it to true; the
- // v1 socket stays the default everywhere until then.
- agent_gateway_mux: false,
+ // Off until an admin publishes a user allowlist or flips it to true; Mobile
+ // stays on the v1 socket until then.
agent_gateway_mux_mobile: false,
// Off until the client executor ships everywhere; allowlist first.
@@ -194,7 +182,6 @@ export const mapFeatureFlagsEnvToState = (
isAgentEditable: evaluateFeatureFlag(config.edit_agent, userId),
enableAgentShare: evaluateFeatureFlag(config.agent_share, userId),
- enableGatewayMux: evaluateFeatureFlag(config.agent_gateway_mux, userId),
enableGatewayMuxMobile: evaluateFeatureFlag(config.agent_gateway_mux_mobile, userId),
enableLlmRelay: evaluateFeatureFlag(config.agent_llm_relay, userId),
enableDashboard: evaluateFeatureFlag(config.dashboard, userId),
diff --git a/packages/types/src/serverConfig.ts b/packages/types/src/serverConfig.ts
index 304fdf665c9..3e74aa17bb9 100644
--- a/packages/types/src/serverConfig.ts
+++ b/packages/types/src/serverConfig.ts
@@ -38,15 +38,9 @@ export type IFeatureFlagsState = {
*/
enableDashboard: boolean | undefined;
enableDevDock: boolean | undefined;
- /**
- * Rollout gate for the multiplexed gateway socket. Necessary but not
- * sufficient: the transport also requires
- * `GlobalServerConfig.agentGatewayProtocol === 2`.
- */
- enableGatewayMux: boolean | undefined;
/**
* LobeHub Mobile rollout gate for the multiplexed gateway socket and
- * protocol-v2 payloads; independent from `enableGatewayMux`.
+ * protocol-v2 payloads. Web follows `GlobalServerConfig.agentGatewayProtocol`.
*/
enableGatewayMuxMobile: boolean | undefined;
enableKnowledgeBase: boolean | undefined;
diff --git a/src/features/Channels/useChannelEvents.ts b/src/features/Channels/useChannelEvents.ts
index daa4590e403..1f8576bfa70 100644
--- a/src/features/Channels/useChannelEvents.ts
+++ b/src/features/Channels/useChannelEvents.ts
@@ -13,7 +13,7 @@ import { useServerConfigStore } from '@/store/serverConfig';
/** Public invalidations share the authenticated user socket, never an Agent's private stream. */
export const useChannelEvents = (params?: ChannelViewParams) => {
const gatewayUrl = useServerConfigStore((s) => s.serverConfig.agentGatewayUrl);
- const enabled = useServerConfigStore((s) => s.featureFlags.enableGatewayMux);
+ const enabled = useServerConfigStore((s) => s.serverConfig.agentGatewayProtocol === 2);
const channelId = params?.channelId;
const threadId = params?.threadId;
const before = params?.before;
diff --git a/src/helpers/conversationMessageRead.test.ts b/src/helpers/conversationMessageRead.test.ts
index 531fb0b93e9..c8f56a2de4c 100644
--- a/src/helpers/conversationMessageRead.test.ts
+++ b/src/helpers/conversationMessageRead.test.ts
@@ -19,7 +19,6 @@ const mockGatewayMode = ({
protocolV2?: boolean;
}) => {
vi.spyOn(serverConfigStore, 'getServerConfigStoreState').mockReturnValue({
- featureFlags: { enableGatewayMux: protocolV2 },
serverConfig: {
...(protocolV2 && { agentGatewayProtocol: 2 }),
...(gatewayMode && { agentGatewayUrl: 'https://gateway.test', enableGatewayMode: true }),
diff --git a/src/helpers/gatewayProtocol.test.ts b/src/helpers/gatewayProtocol.test.ts
index ffc7897066f..68e1b0c558f 100644
--- a/src/helpers/gatewayProtocol.test.ts
+++ b/src/helpers/gatewayProtocol.test.ts
@@ -4,9 +4,8 @@ import * as serverConfigStore from '@/store/serverConfig';
import { canUseGatewayProtocolV2 } from './gatewayProtocol';
-const mockConfig = (protocol?: number, rollout?: boolean) =>
+const mockConfig = (protocol?: number) =>
vi.spyOn(serverConfigStore, 'getServerConfigStoreState').mockReturnValue({
- featureFlags: { enableGatewayMux: rollout },
serverConfig: { agentGatewayProtocol: protocol },
} as unknown as ReturnType<typeof serverConfigStore.getServerConfigStoreState>);
@@ -16,32 +15,25 @@ afterEach(() => {
});
describe('canUseGatewayProtocolV2', () => {
- it('needs both the deployment capability and the rollout', () => {
- mockConfig(2, true);
+ it('follows the deployment capability', () => {
+ mockConfig(2);
expect(canUseGatewayProtocolV2()).toBe(true);
- // In the rollout, but this deployment's gateway has no `/v2/ws` at all.
- mockConfig(1, true);
- expect(canUseGatewayProtocolV2()).toBe(false);
-
- // The gateway has it; this user is not in the rollout yet.
- mockConfig(2, false);
+ // This deployment's gateway has no `/v2/ws` at all.
+ mockConfig(1);
expect(canUseGatewayProtocolV2()).toBe(false);
});
it('defaults to v1 when the server said nothing', () => {
- mockConfig(undefined, undefined);
+ mockConfig(undefined);
expect(canUseGatewayProtocolV2()).toBe(false);
});
it('prefers the global store the shell publishes before React mounts', () => {
- mockConfig(1, false);
+ mockConfig(1);
(globalThis as { window?: unknown }).window = {
global_serverConfigStore: {
- getState: () => ({
- featureFlags: { enableGatewayMux: true },
- serverConfig: { agentGatewayProtocol: 2 },
- }),
+ getState: () => ({ serverConfig: { agentGatewayProtocol: 2 } }),
},
};
diff --git a/src/helpers/gatewayProtocol.ts b/src/helpers/gatewayProtocol.ts
index e32312e75db..ef40e586102 100644
--- a/src/helpers/gatewayProtocol.ts
+++ b/src/helpers/gatewayProtocol.ts
@@ -1,9 +1,9 @@
import { getServerConfigStoreState } from '@/store/serverConfig';
/**
- * `serverConfig` / `featureFlags`, read the same way the gateway transport does:
- * the global store first (the SPA and the desktop shell publish it on `window`
- * before the React store exists), then the module-level state.
+ * `serverConfig`, read the same way the gateway transport does: the global
+ * store first (the SPA and the desktop shell publish it on `window` before the
+ * React store exists), then the module-level state.
*/
const getConfigState = () =>
(typeof window !== 'undefined' ? window.global_serverConfigStore?.getState() : undefined) ??
@@ -14,20 +14,13 @@ const getConfigState = () =>
* socket per user, message revisions instead of pushed message snapshots, and
* projected tool payloads on the conversation read.
*
- * Two independent halves, both required:
+ * Decided by `agentGatewayProtocol === 2` alone — the deployment's gateway
+ * actually exposes `/v2/ws`. A capability, not a choice: there is no
+ * negotiation on the socket, and a self-hosted gateway that only has `/ws`
+ * cannot serve any of this.
*
- * - `agentGatewayProtocol === 2` — the deployment's gateway actually exposes
- * `/v2/ws`. A capability, not a choice: there is no negotiation on the socket,
- * and a self-hosted gateway that only has `/ws` cannot serve any of this.
- * - `enableGatewayMux` — this user is inside the rollout. Server-published, so
- * it moves without a deploy and takes everything protocol v2 changes with it,
- * in one step and in one direction.
- *
- * Read non-reactively: a run keeps the protocol it started with even if either
- * half changes underneath it.
+ * Read non-reactively: a run keeps the protocol it started with even if the
+ * server config changes underneath it.
*/
-export const canUseGatewayProtocolV2 = (): boolean => {
- const state = getConfigState();
-
- return state?.serverConfig?.agentGatewayProtocol === 2 && !!state.featureFlags?.enableGatewayMux;
-};
+export const canUseGatewayProtocolV2 = (): boolean =>
+ getConfigState()?.serverConfig?.agentGatewayProtocol === 2;
diff --git a/src/hooks/useGatewayMuxWarmup.ts b/src/hooks/useGatewayMuxWarmup.ts
index fb689358c2f..e5dd42cd98e 100644
--- a/src/hooks/useGatewayMuxWarmup.ts
+++ b/src/hooks/useGatewayMuxWarmup.ts
@@ -8,14 +8,14 @@ import { useUserStore } from '@/store/user';
* Open the per-user gateway socket on app entry instead of on the first send,
* so the session's first run never pays the WebSocket handshake on its critical
* path. Waits for the signed-in user state so the mux can mint its token, and
- * re-runs when the rollout flag arrives with the server config.
+ * re-runs when the gateway protocol arrives with the server config.
*
- * `warmupGatewayMux` re-checks the deployment capability and the flag itself —
- * this only decides when to ask.
+ * `warmupGatewayMux` re-checks the deployment capability itself — this only
+ * decides when to ask.
*/
export const useGatewayMuxWarmup = (): void => {
const isReady = useUserStore((s) => s.isUserStateInit && !!s.isSignedIn);
- const enabled = useServerConfigStore((s) => !!s.featureFlags.enableGatewayMux);
+ const enabled = useServerConfigStore((s) => s.serverConfig.agentGatewayProtocol === 2);
const warmupGatewayMux = useChatStore((s) => s.warmupGatewayMux);
useEffect(() => {
diff --git a/src/store/chat/slices/agentRun/actions/__tests__/gateway.externalProducerSettle.test.ts b/src/store/chat/slices/agentRun/actions/__tests__/gateway.externalProducerSettle.test.ts
index e26cb6464bd..2a0584008b8 100644
--- a/src/store/chat/slices/agentRun/actions/__tests__/gateway.externalProducerSettle.test.ts
+++ b/src/store/chat/slices/agentRun/actions/__tests__/gateway.externalProducerSettle.test.ts
@@ -71,8 +71,6 @@ vi.mock('@/store/user', () => ({
}));
vi.mock('@/store/user/selectors', () => ({
- // Lab flag off: this suite pins the v1 per-operation socket path.
- labPreferSelectors: { enableGatewayMux: () => false },
settingsSelectors: {
defaultAgentConfig: () => ({
chatConfig: { disableGatewayMode: mockUserDefaultConfig.disableGatewayMode },
diff --git a/src/store/chat/slices/agentRun/actions/__tests__/gateway.mux.test.ts b/src/store/chat/slices/agentRun/actions/__tests__/gateway.mux.test.ts
index 5c46b2661e6..14e371c71ca 100644
--- a/src/store/chat/slices/agentRun/actions/__tests__/gateway.mux.test.ts
+++ b/src/store/chat/slices/agentRun/actions/__tests__/gateway.mux.test.ts
@@ -43,8 +43,8 @@ vi.mock('@/store/file/store', () => ({
getFileStoreState: () => ({ moveChatContextSelections: vi.fn() }),
}));
-/** The two server-side halves the transport requires: capability + rollout. */
-const mockServer = vi.hoisted(() => ({ agentGatewayProtocol: 2 as 1 | 2, enableGatewayMux: true }));
+/** The deployment capability the transport requires. */
+const mockServer = vi.hoisted(() => ({ agentGatewayProtocol: 2 as 1 | 2 }));
const mockUserState = vi.hoisted(() => ({
profile: { id: 'user-1' },
workspaceUserPreference: { agentDeviceOverrides: {} as Record<string, any> },
@@ -190,11 +190,9 @@ const flushMicrotasks = () => new Promise<void>((resolve) => setTimeout(resolve,
describe('GatewayActionImpl (multiplexed gateway transport)', () => {
beforeEach(() => {
mockServer.agentGatewayProtocol = 2;
- mockServer.enableGatewayMux = true;
(globalThis as any).window = {
global_serverConfigStore: {
getState: () => ({
- featureFlags: { enableGatewayMux: mockServer.enableGatewayMux },
serverConfig: {
agentGatewayProtocol: mockServer.agentGatewayProtocol,
agentGatewayUrl: GATEWAY_URL,
@@ -205,7 +203,6 @@ describe('GatewayActionImpl (multiplexed gateway transport)', () => {
};
// The conversation read resolves Gateway mode from this store too.
vi.spyOn(serverConfigStore, 'getServerConfigStoreState').mockReturnValue({
- featureFlags: { enableGatewayMux: mockServer.enableGatewayMux },
serverConfig: {
agentGatewayProtocol: mockServer.agentGatewayProtocol,
agentGatewayUrl: GATEWAY_URL,
@@ -252,8 +249,8 @@ describe('GatewayActionImpl (multiplexed gateway transport)', () => {
});
});
- it('keeps the v1 per-operation socket byte-for-byte outside the rollout', () => {
- mockServer.enableGatewayMux = false;
+ it('keeps the v1 per-operation socket byte-for-byte on a v1 deployment', () => {
+ mockServer.agentGatewayProtocol = 1;
const { action, state, v1Client } = createTestAction();
action.connectToGateway({
@@ -277,36 +274,6 @@ describe('GatewayActionImpl (multiplexed gateway transport)', () => {
expect(state.gatewayConnections['op-1'].client).toBe(v1Client);
});
- it('uses the share-scoped mux even outside the rollout', () => {
- mockServer.enableGatewayMux = false;
- const { action, mux, muxClient, state, v1Client } = createTestAction();
-
- action.connectToGateway({
- agentShareId: 'share-1',
- executor: true,
- gatewayUrl: GATEWAY_URL,
- operationId: 'op-1',
- token: 'unused-in-mux',
- topicId: 'topic-1',
- });
-
- expect(action.resolveGatewayMux).toHaveBeenCalledWith({
- agentShareId: 'share-1',
- gatewayUrl: GATEWAY_URL,
- });
- expect(action.createMuxClient).toHaveBeenCalledWith(mux, 'op-1', {
- executor: true,
- resumeOnConnect: undefined,
- });
- expect(action.createClient).not.toHaveBeenCalled();
- expect(muxClient.connect).toHaveBeenCalled();
- expect(v1Client.connect).not.toHaveBeenCalled();
- expect(state.gatewayConnections['op-1']).toMatchObject({
- client: muxClient,
- status: 'connecting',
- });
- });
-
it('resolves the page-wide registry mux by default', () => {
const { action } = createTestAction();
action.resolveGatewayMux = getGatewayMux;
@@ -561,7 +528,6 @@ describe('GatewayActionImpl (multiplexed gateway transport)', () => {
(globalThis as any).window = {
global_serverConfigStore: {
getState: () => ({
- featureFlags: { enableGatewayMux: mockServer.enableGatewayMux },
serverConfig: {
agentGatewayProtocol: mockServer.agentGatewayProtocol,
...serverConfig,
@@ -595,7 +561,6 @@ describe('GatewayActionImpl (multiplexed gateway transport)', () => {
const { action, mux } = createTestAction();
Reflect.deleteProperty(globalThis, 'window');
vi.spyOn(serverConfigStore, 'getServerConfigStoreState').mockReturnValue({
- featureFlags: { enableGatewayMux: true },
serverConfig: {
agentGatewayProtocol: 2,
agentGatewayUrl: GATEWAY_URL,
@@ -615,14 +580,7 @@ describe('GatewayActionImpl (multiplexed gateway transport)', () => {
},
);
- it('is a no-op outside the rollout, without gateway mode, or on a v1 deployment', () => {
- mockServer.enableGatewayMux = false;
- withServerConfig({ agentGatewayUrl: GATEWAY_URL, enableGatewayMode: true });
- const off = createTestAction();
- off.action.warmupGatewayMux();
- expect(off.mux.connect).not.toHaveBeenCalled();
-
- mockServer.enableGatewayMux = true;
+ it('is a no-op without gateway mode or on a v1 deployment', () => {
withServerConfig({ agentGatewayUrl: GATEWAY_URL, enableGatewayMode: false });
const noGateway = createTestAction();
noGateway.action.warmupGatewayMux();
@@ -658,7 +616,6 @@ describe('GatewayActionImpl (multiplexed gateway transport)', () => {
(globalThis as any).window = {
global_serverConfigStore: {
getState: () => ({
- featureFlags: { enableGatewayMux: mockServer.enableGatewayMux },
serverConfig: {
agentGatewayProtocol: mockServer.agentGatewayProtocol,
agentGatewayUrl: GATEWAY_URL,
diff --git a/src/store/chat/slices/agentRun/actions/__tests__/gateway.mux.unownedRuns.test.ts b/src/store/chat/slices/agentRun/actions/__tests__/gateway.mux.unownedRuns.test.ts
index 228b50fe440..880d2fd8b4e 100644
--- a/src/store/chat/slices/agentRun/actions/__tests__/gateway.mux.unownedRuns.test.ts
+++ b/src/store/chat/slices/agentRun/actions/__tests__/gateway.mux.unownedRuns.test.ts
@@ -42,8 +42,8 @@ vi.mock('@/store/file/store', () => ({
getFileStoreState: () => ({ moveChatContextSelections: vi.fn() }),
}));
-/** The two server-side halves the transport requires: capability + rollout. */
-const mockServer = vi.hoisted(() => ({ agentGatewayProtocol: 2 as 1 | 2, enableGatewayMux: true }));
+/** The deployment capability the transport requires. */
+const mockServer = vi.hoisted(() => ({ agentGatewayProtocol: 2 as 1 | 2 }));
const mockUserState = vi.hoisted(() => ({
profile: { id: 'user-1' },
workspaceUserPreference: { agentDeviceOverrides: {} as Record<string, any> },
@@ -187,11 +187,9 @@ function createTestAction(overrides: Record<string, any> = {}) {
describe('GatewayActionImpl (multiplexed gateway transport)', () => {
beforeEach(() => {
mockServer.agentGatewayProtocol = 2;
- mockServer.enableGatewayMux = true;
(globalThis as any).window = {
global_serverConfigStore: {
getState: () => ({
- featureFlags: { enableGatewayMux: mockServer.enableGatewayMux },
serverConfig: {
agentGatewayProtocol: mockServer.agentGatewayProtocol,
agentGatewayUrl: GATEWAY_URL,
@@ -202,7 +200,6 @@ describe('GatewayActionImpl (multiplexed gateway transport)', () => {
};
// The conversation read resolves Gateway mode from this store too.
vi.spyOn(serverConfigStore, 'getServerConfigStoreState').mockReturnValue({
- featureFlags: { enableGatewayMux: mockServer.enableGatewayMux },
serverConfig: {
agentGatewayProtocol: mockServer.agentGatewayProtocol,
agentGatewayUrl: GATEWAY_URL,
diff --git a/src/store/chat/slices/agentRun/actions/__tests__/gateway.reconnectTeammateRun.test.ts b/src/store/chat/slices/agentRun/actions/__tests__/gateway.reconnectTeammateRun.test.ts
index c021aca0184..ba96196dd03 100644
--- a/src/store/chat/slices/agentRun/actions/__tests__/gateway.reconnectTeammateRun.test.ts
+++ b/src/store/chat/slices/agentRun/actions/__tests__/gateway.reconnectTeammateRun.test.ts
@@ -44,7 +44,6 @@ const mockUserState = vi.hoisted(() => ({
vi.mock('@/store/user', () => ({ useUserStore: { getState: vi.fn(() => mockUserState) } }));
vi.mock('@/store/user/selectors', () => ({
- labPreferSelectors: { enableGatewayMux: () => false },
settingsSelectors: { defaultAgentConfig: () => ({ chatConfig: {} }) },
toolInterventionSelectors: { allowList: () => [], approvalMode: () => 'manual' },
userProfileSelectors: { userId: (state: typeof mockUserState) => state.profile.id },
diff --git a/src/store/chat/slices/agentRun/actions/__tests__/gateway.stopReclaim.test.ts b/src/store/chat/slices/agentRun/actions/__tests__/gateway.stopReclaim.test.ts
index 713c8cdf66d..77fd1dc2b93 100644
--- a/src/store/chat/slices/agentRun/actions/__tests__/gateway.stopReclaim.test.ts
+++ b/src/store/chat/slices/agentRun/actions/__tests__/gateway.stopReclaim.test.ts
@@ -71,8 +71,6 @@ vi.mock('@/store/user', () => ({
}));
vi.mock('@/store/user/selectors', () => ({
- // Lab flag off: this suite pins the v1 per-operation socket path.
- labPreferSelectors: { enableGatewayMux: () => false },
settingsSelectors: {
defaultAgentConfig: () => ({
chatConfig: { disableGatewayMode: mockUserDefaultConfig.disableGatewayMode },
diff --git a/src/store/chat/slices/agentRun/actions/__tests__/gateway.test.ts b/src/store/chat/slices/agentRun/actions/__tests__/gateway.test.ts
index 6103210783e..2763176200c 100644
--- a/src/store/chat/slices/agentRun/actions/__tests__/gateway.test.ts
+++ b/src/store/chat/slices/agentRun/actions/__tests__/gateway.test.ts
@@ -78,8 +78,6 @@ vi.mock('@/store/user', () => ({
}));
vi.mock('@/store/user/selectors', () => ({
- // Lab flag off: this suite pins the v1 per-operation socket path.
- labPreferSelectors: { enableGatewayMux: () => false },
settingsSelectors: {
defaultAgentConfig: () => ({
chatConfig: { disableGatewayMode: mockUserDefaultConfig.disableGatewayMode },
diff --git a/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts b/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts
index 2830db88ede..c19f28b68b4 100644
--- a/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts
+++ b/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts
@@ -512,14 +512,8 @@ export class GatewayActionImpl {
let superseded = false;
- // Share visitors take protocol v2 wherever the deployment has it: the
- // public surface has no user to carry a rollout flag. Owner runs wait for
- // the rollout to reach them.
const muxIdentity: GatewayMuxIdentity = { agentShareId, gatewayUrl };
- const useGatewayMux =
- (agentShareId
- ? getGatewayServerConfig()?.agentGatewayProtocol === 2
- : canUseGatewayProtocolV2()) && !isGatewayMuxUnavailable(muxIdentity);
+ const useGatewayMux = canUseGatewayProtocolV2() && !isGatewayMuxUnavailable(muxIdentity);
let muxClient: OperationClient | undefined;
if (useGatewayMux) {
const mux = this.resolveGatewayMux(muxIdentity);