Skip to content

Commit fcd44a4

Browse files
fix: align all executors for consistent webhook dispatch
- Collaboration executor: now fetches team name + output_route_ids (was using hardcoded string and missing route filtering) - Orchestrator executor: augment lazy final_answer with full worker delegation outputs when brain provides < 20% of total content - Webhook dispatcher: DB fallback to fetch output if not passed inline - All 3 executors now follow the same pattern: * SELECT name, config, mode, output_route_ids from teams * Hoist teamData above try block for catch access * Pass output, team name, and output_route_ids to dispatcher * Fallback team name in catch block
1 parent 68e4202 commit fcd44a4

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

task-runner/src/collaborationExecutor.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,21 @@ export async function processCollaborationRun(run: TeamRun): Promise<void> {
2828
let totalTokens = 0;
2929
let totalCost = 0;
3030

31+
let teamData: { name: string; config: CollaborationConfig; mode: string; output_route_ids: string[] | null } | null = null;
32+
3133
try {
3234
// 1. Fetch team config
3335
const teamResponse = await supabase
3436
.from('teams')
35-
.select('config, mode')
37+
.select('name, config, mode, output_route_ids')
3638
.eq('id', run.team_id)
3739
.single();
3840

3941
if (teamResponse.error || !teamResponse.data) {
4042
throw new Error(`Failed to load team: ${teamResponse.error?.message ?? 'not found'}`);
4143
}
4244

43-
const teamData = teamResponse.data as { config: CollaborationConfig; mode: string };
45+
teamData = teamResponse.data as { name: string; config: CollaborationConfig; mode: string; output_route_ids: string[] | null };
4446
const config = teamData.config;
4547

4648
if (!config.agent_ids?.length || config.agent_ids.length < 2) {
@@ -193,8 +195,9 @@ export async function processCollaborationRun(run: TeamRun): Promise<void> {
193195
// Fire webhook (fire-and-forget)
194196
void dispatchTeamRunWebhooks(
195197
{ id: run.id, team_id: run.team_id, workspace_id: run.workspace_id, status: 'completed', input_task: run.input_task, output: finalOutput },
196-
`Collaboration Team ${run.team_id}`,
198+
teamData.name,
197199
'team_run.completed',
200+
teamData.output_route_ids,
198201
);
199202

200203
} catch (error: unknown) {
@@ -214,8 +217,9 @@ export async function processCollaborationRun(run: TeamRun): Promise<void> {
214217

215218
void dispatchTeamRunWebhooks(
216219
{ id: run.id, team_id: run.team_id, workspace_id: run.workspace_id, status: 'failed', input_task: run.input_task, error_message: errMsg },
217-
`Collaboration Team ${run.team_id}`,
220+
teamData?.name ?? `Collaboration Team ${run.team_id}`,
218221
'team_run.failed',
222+
teamData?.output_route_ids ?? null,
219223
);
220224
}
221225
}

0 commit comments

Comments
 (0)