Prevent duplicate actions by Flow: Implement idempotency detection for Fix Pipeline flow
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem
Without idempotency awareness, the Fix Pipeline flow may repeatedly open issues or MRs for the same underlying failure, creating duplicate actions that:
- Increase review debt and confusion
- Waste LLM credits on redundant analysis
- Make signal-to-noise ratio worse, not better
- Violate safeguards that depend on deduplication
Solution
Implement idempotency detection that checks whether an equivalent action has already been taken for the same failure before proceeding.
Scope
Core Functionality
- Detect if a fix MR already exists for the same failure on the same branch
- Detect if an issue already exists for the same recurring infrastructure failure
- Query existing MRs/issues before taking action
- Store and track flow session IDs to maintain history
- Link new flow runs to previous attempts for same failure
Implementation Details
For MR Context:
- Check if fix MR already open on same branch for same failure type
- If exists: add comment to existing MR instead of creating new one
- Track session ID chain to show flow history
For Branch/Issue Context:
- Check if issue already exists for same infrastructure problem
- If exists: add comment with new findings instead of creating duplicate
- Implement failure categorization to match similar issues
Failure Categorization
Define categories for matching failures:
- Code bug (file + line number)
- Flaky test (test name + frequency)
- Infrastructure issue (service + error type)
- Configuration error (config file + setting)
Acceptance Criteria
- Idempotency detection implemented before any action is taken
- Existing MRs/issues queried efficiently (no N+1 queries)
- Session ID tracking implemented and stored
- Failure categorization logic defined and tested
- Tests cover: duplicate MR prevention, duplicate issue prevention, session tracking
- Documentation updated with idempotency behavior
- Performance validated (query time < 500ms)
Dependencies
- #589268 (closed) - MR context vs. branch pipeline distinction (prerequisite)
Related
- Parent Epic: #21180 - Automatically trigger Fix a Failing Pipeline Flow
- Related: Cost optimization (prevents wasted LLM calls)
- Related: Safeguards & controls (prevents runaway actions)
Notes
- This is a blocking issue for MVC Phase 2
- Idempotency is foundational for both cost control and safeguards
- Must be completed before enabling auto-triggering at scale
Edited by 🤖 GitLab Bot 🤖