Change:
const entries: QuickPickInput<TaskQuickPickEntryType>[] = []; let selectedTask: Task | undefined; let selectedEntry: TaskQuickPickEntryType | undefined; <del> this._showIgnoredFoldersMessage().then(() => { </del> <ins> this._showIgnoredFoldersMessage().then(async () => { const { globGroupTasks } = await this._getGlobTasks(TaskGroup.Build._id); let defaultTasks = globGroupTasks; if (!defaultTasks?.length) { defaultTasks = this._getDefaultTasks(tasks, false); } let defaultBuildTask; if (defaultTasks.length === 1) { const group: string | TaskGroup | undefined = defaultTasks[0].configurationProperties.group; if (group) { if (typeof group === 'string' && group === TaskGroup.Build._id) { defaultBuildTask = defaultTasks[0]; } else { defaultBuildTask = defaultTasks[0]; } } } </ins> for (const task of tasks) { <del> const taskGroup: TaskGroup | undefined = TaskGroup.from(task.configurationProperties.group); if (taskGroup && taskGroup.isDefault && taskGroup._id === TaskGroup.Build._id) { </del> <ins> if (task === defaultBuildTask) { </ins> const label = nls.localize('TaskService.defaultBuildTaskExists', '{0} is already marked as the default build task', TaskQuickPick.getTaskLabelWithIcon(task, task.getQualifiedLabel())); selectedTask = task; selectedEntry = { label, task, description: this.getTaskDescription(task), detail: this._showDetail() ? task.configurationProperties.detail : undefined };

Discussion:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --This was raised before in but closed for not providing enough detail. I'll try to do better. Possibly historically related, but I really don't know: . This buggy behaviour was raised to my attention on Stack Overflow in <!-- Test using the latest Insiders build to see if your issue has already been fixed: --I have tested on Insiders with no non-builtin extensions installed, and on top of that with extensions disabled: <!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes. I also tested with a default profile. <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: 1.81.1, 1.82.0-insider OS Version: Ubuntu 22.04.2. The Stack Overflow user seems to be on windows judging by the backslash path separators, and was Windows and WSL. Steps to Reproduce: a new workspace folder. put anything. Ex. "hello world!" put anything. Ex. "hello world!" and run in the command palette, and observe that it shows the task (unexpected). and run in the command palette, and observe that it shows the task (expected). swap the order the task definitions in and run in the command palette, and observe that it shows the task (expected). and run in the command palette, and observe that it shows the task (unexpected).
maybe related to this change
I can reproduce, doesn't work at all. To that I would add that it isn't documented in
Marking as feature so it gets tested/verified and because this never worked before
Thanks! Do you want me to file a reminder to document this useful feature or is it unnecessary?
that's unnecessary, but it would be great if you'd verify the fix when it's released in insider's. When that happens, you'll see the label applied.