Skip to content

Skip task add hooks for forwarded sync-matched tasks#10016

Open
rkannan82 wants to merge 4 commits intomainfrom
kannan/fix-forwarded-task-hook-double-fire
Open

Skip task add hooks for forwarded sync-matched tasks#10016
rkannan82 wants to merge 4 commits intomainfrom
kannan/fix-forwarded-task-hook-double-fire

Conversation

@rkannan82
Copy link
Copy Markdown
Contributor

@rkannan82 rkannan82 commented Apr 22, 2026

What

Skip processTaskAddHooks on the parent partition when a forwarded task is sync-matched.

The async path is not affected — forwarded tasks that fail to sync-match return errRemoteSyncMatchFailed before reaching the hooks call, so the child partition handles both spooling and hook invocation.

Why

When a child partition forwards a task to the parent for sync matching, hooks fire on both partitions — the child fires hooks when the forwarder successfully delivers the task (priTaskMatcher.Offer returns true), and the parent fires hooks again when TrySyncMatch succeeds. This causes double-counting for any hook-based metrics or tracking.

How did you test it?

Unit tests across all three partition manager suites (Classic, Pri, Fair):

  • Forwarded task that sync-matches on parent → hooks not invoked on parent
  • Forwarded task that fails to sync-match on parent → hooks not invoked on parent (documents existing behavior)

rkannan82 and others added 2 commits April 21, 2026 20:05
When a task is forwarded from a child partition to the parent for sync
matching, processTaskAddHooks was called on both partitions. The child
fires hooks when its forwarder successfully delivers the task, and the
parent fires hooks again when TrySyncMatch succeeds. This causes
double-counting for any hook-based metrics or tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82 rkannan82 changed the title fix: Skip task add hooks for forwarded tasks Skip calling the hooks for forwarded tasks Apr 22, 2026
@rkannan82 rkannan82 changed the title Skip calling the hooks for forwarded tasks fix: Skip task add hooks for forwarded sync-matched tasks Apr 22, 2026
@rkannan82 rkannan82 changed the title fix: Skip task add hooks for forwarded sync-matched tasks Skip task add hooks for forwarded sync-matched tasks Apr 22, 2026
rkannan82 and others added 2 commits April 23, 2026 15:07
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82 rkannan82 requested a review from dnr April 23, 2026 22:10
@rkannan82 rkannan82 marked this pull request as ready for review April 23, 2026 22:10
@rkannan82 rkannan82 requested a review from a team as a code owner April 23, 2026 22:10
@rkannan82 rkannan82 requested a review from ShahabT April 24, 2026 20:50
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.

1 participant