Skip to content

fix: release target approvals when the task gate is disabled - #808

Open
jwalith4418-Mj wants to merge 18 commits into
BaaRai:mainfrom
jwalith4418-Mj:fix/target-gate-disable-release-804
Open

jwalith4418-Mj wants to merge 18 commits into
BaaRai:mainfrom
jwalith4418-Mj:fix/target-gate-disable-release-804

Conversation

@jwalith4418-Mj

Copy link
Copy Markdown

The changes prevent pending target approvals from surviving gate disable and prevent late approvals from creating pins. Includes regression tests for both cases.

@BaaRai BaaRai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_gate check in ResolveTargetRequest (tasks ... FOR UPDATE, then intercept_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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants