fix(server): delegated tasks without a target use the configured fallback model #34861
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- @@ -1322,10 +1340,19 @@1340+ input.orchestrationCapableInstanceIds.has(selection.instanceId)1341+ ? selection1342+ : null;1343+ };1344+13221345 const resolveTarget = Effect.fn("OrchestratorMcpService.resolveTarget")(function* (input: {13231346 readonly parent: Pick<OrchestrationV2ThreadProjection, "thread">;13241347 readonly target: OrchestratorMcpTarget | undefined;13251348 readonly providers: ReadonlyArray<ServerProvider>;13261349 /** Receipt replays bypass current settings because they start no work. Dispatch must reuse the checked command ID. */13271350 readonly skipProjectEnablementFilter?: boolean;13281351 }): Effect.fn.Return<ResolvedTarget, OrchestratorMcpFailure> {1329- const requestedInstanceId = input.target?.providerInstanceId;1330- const requestedDriver = input.target?.driverKind;13311352 const orchestrationCapableInstanceIds = yield* loadOrchestrationCapableInstanceIds();1353+ let target = input.target;1354+ if (1355+ target?.providerInstanceId === undefined &&1356+ target?.driverKind === undefined &&1357+ target?.model === undefined &&1358+ input.skipProjectEnablementFilter !== true
- @@ -1321 +1322,21 @@132113221323+ const implicitFallbackSelection = (input: {1324+ readonly parent: Pick<OrchestrationV2ThreadProjection, "thread">;1325+ readonly providers: ReadonlyArray<ServerProvider>;1326+ readonly settings: Effect.Success<typeof serverSettings.getSettings>;1327+ readonly orchestrationCapableInstanceIds: ReadonlySet<string>;1328+ readonly now: number;1329+ }) => {1330+ const { selection, fallback } = resolveNewThreadModelSelection({1331+ defaultSelection: input.parent.thread.modelSelection,1332+ fallbackSelection: input.settings.fallbackModelSelection,1333+ providers: input.providers,1334+ settings: input.settings,1335+ projectId: input.parent.thread.projectId,1336+ now: input.now,1337+ });1338+ return fallback !== null &&1339+ selection !== null &&1340+ input.orchestrationCapableInstanceIds.has(selection.instanceId)1341+ ? selection1342+ : null;@@ -1321 +1322,21 @@132113221323+ const implicitFallbackSelection = (input: {1324+ readonly parent: Pick<OrchestrationV2ThreadProjection, "thread">;1325+ readonly providers: ReadonlyArray<ServerProvider>;1326+ readonly settings: Effect.Success<typeof serverSettings.getSettings>;1327+ readonly orchestrationCapableInstanceIds: ReadonlySet<string>;1328+ readonly now: number;1329+ }) => {1330+ const { selection, fallback } = resolveNewThreadModelSelection({1331+ defaultSelection: input.parent.thread.modelSelection,1332+ fallbackSelection: input.settings.fallbackModelSelection,1333+ providers: input.providers,1334+ settings: input.settings,1335+ projectId: input.parent.thread.projectId,1336+ now: input.now,1337+ });1338+ return fallback !== null &&1339+ selection !== null &&1340+ input.orchestrationCapableInstanceIds.has(selection.instanceId)1341+ ? selection1342+ : null;@@ -1322,10 +1340,19 @@1340+ input.orchestrationCapableInstanceIds.has(selection.instanceId)1341+ ? selection1342+ : null;1343+ };1344+13221345 const resolveTarget = Effect.fn("OrchestratorMcpService.resolveTarget")(function* (input: {13231346 readonly parent: Pick<OrchestrationV2ThreadProjection, "thread">;13241347 readonly target: OrchestratorMcpTarget | undefined;13251348 readonly providers: ReadonlyArray<ServerProvider>;13261349 /** Receipt replays bypass current settings because they start no work. Dispatch must reuse the checked command ID. */13271350 readonly skipProjectEnablementFilter?: boolean;13281351 }): Effect.fn.Return<ResolvedTarget, OrchestratorMcpFailure> {1329- const requestedInstanceId = input.target?.providerInstanceId;1330- const requestedDriver = input.target?.driverKind;13311352 const orchestrationCapableInstanceIds = yield* loadOrchestrationCapableInstanceIds();1353+ let target = input.target;1354+ if (1355+ target?.providerInstanceId === undefined &&1356+ target?.driverKind === undefined &&1357+ target?.model === undefined &&1358+ input.skipProjectEnablementFilter !== true@@ -1331,0 +1354,21 @@1354+ if (1355+ target?.providerInstanceId === undefined &&1356+ target?.driverKind === undefined &&1357+ target?.model === undefined &&1358+ input.skipProjectEnablementFilter !== true1359+ ) {1360+ const settings = yield* serverSettings.getSettings.pipe(1361+ Effect.mapError(() => failure("orchestration_error", "Unable to read server settings.")),1362+ );1363+ const selection = implicitFallbackSelection({1364+ parent: input.parent,1365+ providers: input.providers,1366+ settings,1367+ orchestrationCapableInstanceIds,1368+ now: yield* Clock.currentTimeMillis,1369+ });1370+ if (selection !== null) {1371+ target = {1372+ ...target,1373+ providerInstanceId: selection.instanceId,1374+ model: selection.model,
tanstack-source added labelsbug
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed