project: Re-resolve recent tasks against current editor context (#57380)

## Summary

Closes #55879.

When a task is run, its fully-resolved form (`ResolvedTask`, with
`$ZED_FILE`/`$ZED_STEM`/`$ZED_COLUMN`/etc. already substituted) is
cached in `Inventory::last_scheduled_tasks`. The next time the task
picker is opened, `used_and_current_resolved_tasks` returns those cached
entries as-is for the "recent" section. The "current" section *is*
re-resolved against the active editor, but the label-based dedup keeps
the stale recent entry.

The result is that `$ZED_FILE` keeps pointing at the file that was
active the first time the task ran, even after switching editors and
re-running from the picker.

This fix re-resolves each entry in the recent-tasks list against the
current `TaskContexts` using the same context-pick chain the "current"
branch already uses (item context → active worktree → other worktree →
default). If re-resolution fails for any reason, we fall back to the
cached `ResolvedTask` so behavior never regresses.

The change is localized to `previously_spawned_tasks` inside
`used_and_current_resolved_tasks`. List order, dedup, and LRU scoring
are unchanged — only the variable substitutions inside each
`ResolvedTask` are refreshed.

## Test plan

- [x] Open a project with two source files (e.g. `1.cpp`, `2.cpp`) and a
task that uses `$ZED_FILE` (e.g. `g++ $ZED_FILE -o $ZED_STEM &&
./$ZED_STEM`).
- [x] Open `1.cpp`, run the task from the picker, confirm it compiles
`1.cpp`.
- [x] Click `2.cpp`, open the task picker, pick the same task from the
"recent" section, confirm it now compiles `2.cpp` (previously: still
`1.cpp`).
- [x] Confirm the recent-task ordering and divider in the picker are
unchanged.

Release Notes:

- Fixed task variables like `$ZED_FILE` not updating when re-running a
recently used task after switching the active editor (#55879).
7266ab6904Ayush Patil committed on 6/9/2026, 4:01:30 PM· committed by GitHubparent9fe1643
1 file changedLine totals unavailable