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.

🐛 fix(gateway): tell the gateway which runs are heterogeneous (#19952)

Arvin Xuce5183823294
diff --git a/apps/server/src/modules/AgentRuntime/GatewayStreamNotifier.ts b/apps/server/src/modules/AgentRuntime/GatewayStreamNotifier.ts
index 386f327968f..e4597a3904e 100644
--- a/apps/server/src/modules/AgentRuntime/GatewayStreamNotifier.ts
+++ b/apps/server/src/modules/AgentRuntime/GatewayStreamNotifier.ts
@@ -93,6 +93,9 @@ const GATEWAY_INIT_META_KEYS = [
'parentOperationId',
'mirrorToOperationId',
'rootOperationId',
+ // A heterogeneous CLI run can go silent through a long shell command; the
+ // gateway's inactivity watchdog gives it a longer window.
+ 'heteroType',
] as const;
export type GatewayInitMeta = Partial<Record<(typeof GATEWAY_INIT_META_KEYS)[number], string>>;
diff --git a/apps/server/src/modules/AgentRuntime/__tests__/GatewayStreamNotifier.test.ts b/apps/server/src/modules/AgentRuntime/__tests__/GatewayStreamNotifier.test.ts
index 7c3fec4fceb..5905fd42bbc 100644
--- a/apps/server/src/modules/AgentRuntime/__tests__/GatewayStreamNotifier.test.ts
+++ b/apps/server/src/modules/AgentRuntime/__tests__/GatewayStreamNotifier.test.ts
@@ -387,6 +387,25 @@ describe('GatewayStreamNotifier', () => {
expect(bodies[1]).not.toHaveProperty('meta');
});
+ it('tells the gateway a run is heterogeneous so its watchdog allows long silence', async () => {
+ await notifier.publishAgentRuntimeInit('op-cc', {
+ agentId: 'agt_1',
+ assistantMessageId: 'msg_1',
+ heteroType: 'claude-code',
+ topicId: 'tpc_1',
+ userId: 'user-1',
+ });
+
+ const initCall = mockFetch.mock.calls.find(
+ (call: any[]) => call[0] === `${gatewayUrl}/api/operations/init`,
+ )!;
+ expect(JSON.parse(initCall[1].body)).toEqual({
+ meta: { agentId: 'agt_1', heteroType: 'claude-code', topicId: 'tpc_1' },
+ operationId: 'op-cc',
+ userId: 'user-1',
+ });
+ });
+
it('registers the visitor as gateway owner while still sending meta', async () => {
await notifier.publishAgentRuntimeInit('op-share', {
streamOwnerUserId: 'visitor-1',