Repository navigation
fix: release target approvals when the task gate is disabled - #808
Open
jwalith4418-Mj wants to merge 18 commits into
Open
jwalith4418-Mj wants to merge 18 commits into
jwalith4418-Mj wants to merge 18 commits into
Conversation
BaaRai
reviewed
Dec 2, 2026
BaaRai
left a comment
Owner
There was a problem hiding this comment.
The DB-level lock here is the right fix for the late-click race, and the TargetScope.ref() validation is useful. The rest duplicates #807, which is the base we want for #804: it releases simple calls without a denial, closes requests from UpdateTaskMetadata, covers all waiters/retry/merged, and re-reads the gate on dial/UDP.
Please rebase on #807 and keep only:
- the task-row lock and
target_gatecheck inResolveTargetRequest(tasks ... FOR UPDATE, thenintercept_pending ... FOR UPDATE, same order as task deletion); TargetScope.ref()validation and its tests.
Also fix the Decide path: a late click converted to a system denial must not return nil/success, must not wake with allowed=true, and must not write approver/approver_addr. An already-decided error is fine.
If you prefer, say so and we will fold the lock into #807 with credit to you.
leninworld
added a commit
to leninworld/ARTEX
that referenced
this pull request
Dec 2, 2026
Switching the gate off and closing the task's open requests are two operations, so an approval landing between them (or while the close fails, or on another instance) could still pin the target. ResolveTargetRequest now locks the task row before the pending row (the order task deletion uses), reads target_gate under that lock and turns an approval on a gate-off or deleted task into a system denial: no pin, no approver fields, the same row shape CloseTargetRequests writes. Decide reports it as already decided and wakes local waiters with false, and a waiter seeing that system close releases the call even if its local gate flag lags. Tests that approve target requests now create gate-on tasks. The task-row lock and its test come from BaaRai#808. Co-authored-by: Jwalith <jwalith4418@gmail.com>
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.
The changes prevent pending target approvals from surviving gate disable and prevent late approvals from creating pins. Includes regression tests for both cases.