MasterZRC d59738649f
fix(frontend): isolate background task cancellation reads (#7903)
* fix(frontend): fence background task cancellation cache

Cancel the exact list and target-detail reads before publishing confirmed cancellation state. Forward AbortSignals and refresh only the list, preserving sibling detail loads.

Cover delayed reads after panel close, initial detail loads, cancellation failures, and request isolation with real QueryClient/HTTP regressions.

Fixes #7177

AI-assisted with OpenAI Codex.

* test(frontend): cover cancellation before initial task list loads

Address PR #7903 review by covering the uncached-list case through cancellation, stale-response settlement, and the next enabled refresh. Document the single-argument fetch contract and capitalize the polling guidance.

* chore: remove background task screenshots from PR
2026-11-17 10:10:29 +08:00

802 B

Background-task queries (core/background-tasks/)

On a successful cancel, await cancellation of the exact thread list and target detail queries before writing the confirmed result to either cache. Then invalidate only the exact list. Other task details keep loading. Both GETs pass TanStack Query's AbortSignal to fetch. Callers that omit the signal keep the single-argument fetch call. core/memory follows the same cache update order.

frontend/tests/unit/core/background-tasks/hooks.dom.test.tsx exercises the cache updates with a real QueryClient. The sibling cancellation-http.dom.test.tsx covers closed panels, HTTP aborts, cached and initial reads, isolation between tasks and threads, and failed cancellations. An uncached list stays undefined until a fresh list GET succeeds.