@@ -217,17 +217,11 @@ public void processTurnEvent(ChatProgressValue value) {
217217 errMsg = Messages .chat_model_unsupported_message ;
218218 }
219219 if (StringUtils .isNotEmpty (errMsg )) {
220- // Check once whether we're already on the fallback model
221- CopilotModel fallback = this .serviceManager .getModelService ().getFallbackModel ();
222- CopilotModel current = this .serviceManager .getModelService ().getActiveModel ();
223- boolean alreadyOnFallback = fallback != null && current != null
224- && fallback .getModelName ().equals (current .getModelName ());
225-
226- // Only replace the error message with "switched to fallback" when we're NOT already
227- // on the fallback model. When already on fallback, show the original CLS message.
228- if (value .getCode () == 402 && !alreadyOnFallback ) {
220+ // TODO: remove this error message replacement if statement when the CLS side warn message is aligned.
221+ if (value .getCode () == 402 ) {
229222 CopilotPlan userPlan = this .serviceManager .getAuthStatusManager ().getQuotaStatus ().copilotPlan ();
230- String fallbackModelName = fallback != null ? fallback .getModelName ()
223+ CopilotModel fallbackModel = this .serviceManager .getModelService ().getFallbackModel ();
224+ String fallbackModelName = fallbackModel != null ? fallbackModel .getModelName ()
231225 : Messages .chat_noQuotaView_fallbackModel ;
232226
233227 if (MenuUtils .isCfiPlan (userPlan )) {
@@ -241,19 +235,15 @@ public void processTurnEvent(ChatProgressValue value) {
241235
242236 renderWarnMessageWithUpgradePlanButton (errMsg , value .getCode ());
243237
244- // Switch to fallback model and auto-retry, but only if not already on the fallback model
245- // to avoid an infinite loop of 402 → switch → resend → 402 → ...
246- if (value .getCode () == 402 && !alreadyOnFallback
238+ if (value .getCode () == 402
247239 && this .serviceManager .getAuthStatusManager ().getQuotaStatus ().copilotPlan () != CopilotPlan .free ) {
248240 this .serviceManager .getModelService ().setFallBackModelAsActiveModel ();
249241 this .serviceManager .getAuthStatusManager ().checkQuota ();
250242
251- String previousInput =
252- this .serviceManager .getUserPreferenceService ().getPreviousInput (StringUtils .EMPTY );
243+ String previousInput = this .serviceManager .getUserPreferenceService ().getPreviousInput (StringUtils .EMPTY );
253244 if (StringUtils .isNotEmpty (previousInput )) {
254245 IEventBroker eventBroker = PlatformUI .getWorkbench ().getService (IEventBroker .class );
255- Map <String , Object > properties =
256- Map .of ("previousInput" , previousInput , "needCreateUserTurn" , false );
246+ Map <String , Object > properties = Map .of ("previousInput" , previousInput , "needCreateUserTurn" , false );
257247 eventBroker .post (CopilotEventConstants .TOPIC_CHAT_ON_SEND , properties );
258248 }
259249 }
0 commit comments