You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tasks: fall back to untyped lookup for task handles - #346950
Retry task-handle resolution without activating unrelated providers when the typed lookup misses. A task definition's type can differ from its provider registration type, so the fallback resolves the handle from tasks already known to the task service. The known-task lookup preserves workspace and user-task matching, and the fallback remains skipped when workspace trust was denied. Task matching consistently ranks extension tasks last and preserves order among equal ranks.
Testing
pnpm run build-fast --client-only — passed.
scripts\test.bat --run src/vs/workbench/api/test/browser/mainThreadTask.test.ts --run src/vs/workbench/contrib/tasks/test/browser/abstractTaskService.test.ts — passed (23 tests), covering typed lookup/fallback behavior, denied trust, workspace/user precedence in both getTask lookup phases, and stable equal-rank ordering.
pnpm run typecheck-client — passed.
pnpm run eslint -- src/vs/workbench/contrib/tasks/test/browser/abstractTaskService.test.ts — passed.
pnpm run compile — passed before these follow-up changes.
Code OSS runtime check — earlier change verified typed task execution and a mismatched definition-type fallback; the later known-only fallback and ordering refinements were validated with focused unit tests.
A task definition's type can differ from its provider registration type, so retry an unfiltered lookup only when the typed lookup misses. Cover both task execution API paths.
Co-authored-by: Copilot <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The task-resolution fallback can immediately reopen the workspace trust prompt after the user cancels it because it treats a trust-denied lookup as a missing task.
This follow-up to #336159 restores task-handle resolution when a task’s definition type differs from its provider registration type, while keeping typed lookup as the first attempt.
Changes:
Add a shared untyped fallback for $getTaskExecution and $executeTask when typed lookup misses.
Add focused regression tests for both entry points.
Task lookup returns undefined when workspace trust is denied. Avoid the untyped retry unless the workspace is trusted, preventing a second trust prompt.
Co-authored-by: Copilot <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The new cases lack successful typed-lookup assertions for both operations, so they would miss a regression that unnecessarily activates every task provider.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The untyped task-resolution retry can activate unrelated task-provider extensions for mismatched provider types or stale handles, reintroducing the reported activation overhead.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Avoid activating unrelated providers during task lookup fallback
When a provider task's definition type differs from its registered type, this untyped retry activates unrelated task-provider extensions, restoring the activation cost reported in #336152. Stale handles can incur the same cost before failing with "Task not found". Resolve the fallback against already-registered providers, for example through getKnownTasks(), while preserving the existing ID, workspace, and user-task matching.
Resolve typed task-handle misses from tasks already known to the service, preserving workspace and user-task matching without activating unrelated providers.
Co-authored-by: Copilot <[email protected]>
Use a consistent two-argument comparator to rank extension tasks last while preserving order among equal ranks. Strengthen denied-trust tests to ensure known-task fallback is not called.
Co-authored-by: Copilot <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The changed getTask ordering lacks tests for equal-rank workspace/user matches in both lookup phases, leaving command-selection precedence unverified for callers such as debug task execution.
Exercise workspace-versus-user task selection in both getTask lookup phases and use matching non-extension tasks in the known-task precedence test.
Co-authored-by: Copilot <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human judgment is needed to assess whether the changed workspace-versus-user task precedence, which can alter debug preLaunchTask selection, is intentional.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #336152
Follow-up to #336159
Retry task-handle resolution without activating unrelated providers when the typed lookup misses. A task definition's type can differ from its provider registration type, so the fallback resolves the handle from tasks already known to the task service. The known-task lookup preserves workspace and user-task matching, and the fallback remains skipped when workspace trust was denied. Task matching consistently ranks extension tasks last and preserves order among equal ranks.
Testing
pnpm run build-fast --client-only— passed.scripts\test.bat --run src/vs/workbench/api/test/browser/mainThreadTask.test.ts --run src/vs/workbench/contrib/tasks/test/browser/abstractTaskService.test.ts— passed (23 tests), covering typed lookup/fallback behavior, denied trust, workspace/user precedence in bothgetTasklookup phases, and stable equal-rank ordering.pnpm run typecheck-client— passed.pnpm run eslint -- src/vs/workbench/contrib/tasks/test/browser/abstractTaskService.test.ts— passed.pnpm run compile— passed before these follow-up changes.