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(group): stop serving vote as a success-shaped stub (#21268)

Arvin Xud6adcfdbd088
diff --git a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/groupManagement.test.ts b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/groupManagement.test.ts
index 063e72202e5..c8e44959879 100644
--- a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/groupManagement.test.ts
+++ b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/groupManagement.test.ts
@@ -77,7 +77,10 @@ describe('groupManagementRuntime', () => {
it('keeps the opaque fallback message when the runner reports no reasons', async () => {
run.mockResolvedValue({ started: false, startedCount: 0 });
- const result = await runtime().delegate({ agentId: 'agent-a', reason: 'take over' }, makeCtx());
+ const result = await runtime().delegate(
+ { agentId: 'agent-a', reason: 'take over' },
+ makeCtx(),
+ );
expect(result.success).toBe(false);
expect(result.error?.code).toBe('AGENT_MEMBER_START_FAILED');
expect(result.content).toBe('Agent member(s) failed to start.');
@@ -170,4 +173,24 @@ describe('groupManagementRuntime', () => {
expect(result.error?.code).toBe('INVALID_ARGUMENTS');
});
});
+
+ describe('vote', () => {
+ it('returns an explicit not-implemented error (not a success-shaped stub)', async () => {
+ const result = await runtime().vote(
+ {
+ options: [
+ { id: 'a', label: 'Option A' },
+ { id: 'b', label: 'Option B' },
+ ],
+ question: 'Which design should we pick?',
+ },
+ makeCtx(),
+ );
+
+ expect(result.success).toBe(false);
+ expect(result.error?.code).toBe('VOTE_NOT_IMPLEMENTED');
+ expect(result.content).toContain('broadcast');
+ expect(run).not.toHaveBeenCalled();
+ });
+ });
});
diff --git a/apps/server/src/services/toolExecution/serverRuntimes/groupManagement.ts b/apps/server/src/services/toolExecution/serverRuntimes/groupManagement.ts
index 87aac6285d1..89907870ddb 100644
--- a/apps/server/src/services/toolExecution/serverRuntimes/groupManagement.ts
+++ b/apps/server/src/services/toolExecution/serverRuntimes/groupManagement.ts
@@ -192,8 +192,10 @@ class GroupManagementExecutionRuntime {
};
// ==================== Not yet implemented on the server ====================
- // Mirror the client stubs: return inline (non-deferred) results so the
- // supervisor LLM keeps orchestrating instead of parking.
+ // Mirror the client stubs. These actions have no server orchestration yet β€”
+ // they must surface explicit `success: false` errors (not success-shaped
+ // text) so the supervisor LLM can adapt instead of treating the stub output
+ // as a completed action.
interrupt = async (params: InterruptParams): Promise<BuiltinServerRuntimeOutput> => ({
content: `Interrupt is not yet supported in server orchestration (task ${params.taskId}).`,
@@ -210,10 +212,12 @@ class GroupManagementExecutionRuntime {
success: true,
});
- vote = async (params: VoteParams): Promise<BuiltinServerRuntimeOutput> => ({
- content: `Voting is not yet implemented (question: "${params.question}").`,
- success: true,
- });
+ vote = async (params: VoteParams): Promise<BuiltinServerRuntimeOutput> =>
+ buildError(
+ "Voting is not yet implemented. Collect members' opinions with `broadcast` instead, " +
+ 'then tally the responses yourself.',
+ 'VOTE_NOT_IMPLEMENTED',
+ );
}
const runtime = new GroupManagementExecutionRuntime();
diff --git a/packages/builtin-tool-group-management/src/executor.test.ts b/packages/builtin-tool-group-management/src/executor.test.ts
index e0210581d52..f4f214d0ee9 100644
--- a/packages/builtin-tool-group-management/src/executor.test.ts
+++ b/packages/builtin-tool-group-management/src/executor.test.ts
@@ -425,4 +425,24 @@ describe('GroupManagementExecutor', () => {
expect(result.content).toBe('Failed to interrupt task: Task not found');
});
});
+
+ describe('vote', () => {
+ it('should return an explicit failure instead of a success-shaped stub', async () => {
+ const ctx = createMockContext();
+
+ const result = await groupManagementExecutor.vote(
+ {
+ options: [
+ { id: 'a', label: 'Option A' },
+ { id: 'b', label: 'Option B' },
+ ],
+ question: 'Which design should we pick?',
+ },
+ ctx,
+ );
+
+ expect(result.success).toBe(false);
+ expect(result.content).toContain('broadcast');
+ });
+ });
});
diff --git a/packages/builtin-tool-group-management/src/executor.ts b/packages/builtin-tool-group-management/src/executor.ts
index c7195254b2f..cf8f52ef44b 100644
--- a/packages/builtin-tool-group-management/src/executor.ts
+++ b/packages/builtin-tool-group-management/src/executor.ts
@@ -255,12 +255,13 @@ class GroupManagementExecutor extends BaseExecutor<typeof GroupManagementApiName
};
};
- vote = async (params: VoteParams, _ctx: BuiltinToolContext): Promise<BuiltinToolResult> => {
+ vote = async (_params: VoteParams, _ctx: BuiltinToolContext): Promise<BuiltinToolResult> => {
// TODO: Implement voting mechanism
- const optionLabels = params.options.map((o) => o.label).join(', ');
return {
- content: `Voting not yet implemented for question: "${params.question}" with options: ${optionLabels}`,
- success: true,
+ content:
+ "Voting is not yet implemented. Collect members' opinions with `broadcast` instead, " +
+ 'then tally the responses yourself.',
+ success: false,
};
};
}
diff --git a/packages/builtin-tool-group-management/src/manifest.ts b/packages/builtin-tool-group-management/src/manifest.ts
index ec65837e7ea..24fbb246ceb 100644
--- a/packages/builtin-tool-group-management/src/manifest.ts
+++ b/packages/builtin-tool-group-management/src/manifest.ts
@@ -262,7 +262,7 @@ export const GroupManagementManifest: BuiltinToolManifest = {
// },
{
description:
- 'Initiate a vote among agents on a specific question or decision. Each agent provides their choice and reasoning.',
+ 'Initiate a vote among agents on a specific question or decision. Each agent provides their choice and reasoning. NOTE: voting is not yet implemented β€” calling this tool returns an error; use broadcast to collect opinions instead.',
name: GroupManagementApiName.vote,
parameters: {
properties: {
diff --git a/packages/builtin-tool-group-management/src/systemRole.ts b/packages/builtin-tool-group-management/src/systemRole.ts
index b1ef884c5a3..4f0c45b8ec2 100644
--- a/packages/builtin-tool-group-management/src/systemRole.ts
+++ b/packages/builtin-tool-group-management/src/systemRole.ts
@@ -209,7 +209,7 @@ When a user's request is broad or unclear, ask 1-2 focused questions to understa
- **executeAgentTasks**: Assign multiple async tasks to different agents in parallel
**Flow Control:**
-- **vote**: Initiate voting among agents
+- **vote**: Initiate voting among agents (NOT YET AVAILABLE β€” calling it returns an error; use broadcast to collect opinions and tally them yourself)
</core_capabilities>
<workflow_patterns>
@@ -338,7 +338,7 @@ The \`tasks\` parameter MUST be a proper JSON array, NOT a stringified JSON stri
\`\`\`
**Flow Control:**
-- vote: \`question\`, \`options\` (array of {id, label, description}), \`voterAgentIds\` (optional), \`requireReasoning\` (default true)
+- vote: \`question\`, \`options\` (array of {id, label, description}), \`voterAgentIds\` (optional), \`requireReasoning\` (default true) β€” NOT YET AVAILABLE; the call returns an error. Use broadcast instead.
</tool_usage_guidelines>
<best_practices>