History

Remove dead code in preferredProvider fallback chain

The middle operand `options?.provider` in the nullish coalescing chain `currentProvider ?? options?.provider ?? threadProvider` is dead code. The validation guard at lines 215-221 already ensures options.provider equals threadProvider when defined, so it can never produce a different value. Simplified to `currentProvider ?? threadProvider`.

Cursor Agent committed 8 months ago

Commit a98a9391 parent fc9660f1 file · +1 −1Browse files

Unified · Split

apps/server/src/orchestration/Layers/ProviderCommandReactor.ts+1−1
@@ -229,7 +229,7 @@ const make = Effect.gen(function* () { · 228 unmodified lines
229 detail: `Model '${options.model}' does not belong to provider '${threadProvider}' for thread '${threadId}'.`,229 detail: `Model '${options.model}' does not belong to provider '${threadProvider}' for thread '${threadId}'.`,
230 });230 });
231 }231 }
232 const preferredProvider: ProviderKind = currentProvider ?? options?.provider ?? threadProvider;232 const preferredProvider: ProviderKind = currentProvider ?? threadProvider;
233 const desiredModel = options?.model ?? thread.model;233 const desiredModel = options?.model ?? thread.model;
234 const effectiveCwd = resolveThreadWorkspaceCwd({234 const effectiveCwd = resolveThreadWorkspaceCwd({
235 thread,235 thread,