fix(task): scope user exit preparation to the requesting owner - #2741
Open
HandSonic wants to merge 1 commit into
Open
fix(task): scope user exit preparation to the requesting owner#2741HandSonic wants to merge 1 commit into
HandSonic wants to merge 1 commit into
Conversation
A single global preparingForExit flag rejected task submissions from every user once one user hit prepare-user-exit. Keep the global flag for app-level shutdown (owner == null) and track per-owner exit keys in a set so only the exiting owner is blocked; abort-user-exit now removes that owner's key under the same lifecycle lock.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related issue
N/A — server-contract defect found by reviewing the #2712 task-system rebuild; described below.
Summary
LocalTaskManager's preparingForExit flag was global: the user-scoped prepareForUserExit path (triggered today by the desktop close flow via /api/tasks/prepare-user-exit) set a flag that rejected EVERY owner's task submissions with "The application is preparing to exit". Today only the desktop client drives this flow (web never calls it), so the practical blast radius is the same user — but the endpoint is a server/web API, and any API client (or future web adoption) hitting it locks out all other owners with no timeout reset. The flag is now split correctly:
Everything stays under the existing lifecycleLock; terminateActiveTasks keeps the original guard semantics; the public TaskService/REST surface is unchanged.
Affected surfaces
Verification
Risk and compatibility
Reviewer map
Contributor declaration
AI assistance: substantial — fix and tests drafted with AI assistance, verified locally and by adversarial review (including a client-flow audit of who actually calls these endpoints).