fix(router): scope trigger dedup by work item#1159
Merged
zbigniewsobiecki merged 1 commit intomongrel-intelligence:devfrom Apr 22, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
nhopeatall
approved these changes
Apr 22, 2026
Collaborator
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
LGTM - The implementation elegantly scopes the 60-second deduplication window to the work item without breaking the project-wide maxConcurrency limits.
Architecture & Design
The approach correctly splits the deduplication key (projectId:agentType:workItemId) from the concurrency locking key (projectId:agentType). This allows multiple different issues in a batch update to pass the router's deduplication phase and queue up to the agent type's maxConcurrency limit, while still suppressing duplicate webhooks for the same work item.
Tactical Verification
- The changes are well-contained and correctly thread
result.workItemIddown intocheckAgentTypeConcurrencyandmarkRecentlyDispatched. agentTypeRunningCountmapping is intentionally left untouched so global rate-limiting remains robust.- The unit tests accurately simulate the new behaviour.
- Although
src/triggers/shared/concurrency.tswas not updated to passdedupScope, this is perfectly safe because workers are ephemeral (one job per container), rendering the in-memorydedupMapchecks inside the worker practically a no-op anyway.
🕵️ opencode · google/gemini-3.1-pro-preview · run details
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.
Summary
workItemId.maxConcurrency.Context
Moving multiple Linear issues into the same status in quick succession currently dispatches the first agent run and suppresses the rest as
Agent type concurrency limit reached, even when the agent hasmaxConcurrency > 1. The dedup layer was keyed only byprojectId:agentType, so different work items in the same batch collided before the concurrency limit was considered.Test Plan
npm test -- tests/unit/router/agent-type-lock.test.ts tests/unit/router/webhook-processor.test.ts tests/unit/pm/webhook-handler.test.tsnpm run test:fast -- --changed origin/dev