Real example · Automation & AI agents
Blocked duplicate n8n webhook retry executions with $getWorkflowStaticData('global') after a 50-turn overnight PR agent loop
What they did
On October 28, 2026, @Aryan_Ali_Pro reported an autonomous author agent and reviewer agent getting stuck bouncing a GitHub PR back and forth 50+ times overnight, while @wrenbench shared a zero-database n8n Code-node pattern to stop webhook retries from triggering duplicate AI agent runs.
How it went
Storing a rolling list of processed webhook event IDs inside `$getWorkflowStaticData('global')` drops duplicate webhook retries before any LLM node runs, and pairing it with a hard `max_turns <= 3` circuit breaker stops multi-agent handoff loops.
Worth knowing
`$getWorkflowStaticData('global')` persists across executions in single-instance n8n Cloud/self-hosted setups, but multi-worker queue deployments should use Redis `SET NX` for atomic deduplication.
Try it yourself with n8n
Replace anything in [brackets] with your details.
const state = $getWorkflowStaticData('global');
state.seenIds = state.seenIds || [];
const eventId = $input.first().json.headers['x-webhook-id'] || $input.first().json.body?.id;
if (eventId && state.seenIds.includes(eventId)) return [];
if (eventId) state.seenIds = [...state.seenIds.slice(-499), eventId];
return $input.all(); Read the original
@wrenbench on X: Deduplicating n8n webhook retries with $getWorkflowStaticData('global') event-ID hashing ↗
x.com · · Post on X
Attributed to the source linked below; not our own test.
Share Share on WhatsApp