Merge Queue Ready
This agent loop automates the process of preparing a feature branch for submission to a merge queue. It iteratively validates the branch against the merge queue's criteria, identifies required changes, and applies them until the branch is accepted.
Goal
Prepare branch for merge queue
How to Run
Run this loop in your preferred CLI tool (Cursor, Claude Code, Codex, OpenCode, Gemini CLI) to automatically prepare your branch for the merge queue. The agent will validate, diagnose issues, and fix them iteratively.
- 01
Step 1: Navigate to Repository
Ensure you're in the root directory of the repository containing the branch you want to prepare for merge.
- 02
Step 2: Start Loop Execution
Initiate the loop by providing the kickoff prompt. The agent will begin validating the branch against merge queue requirements.
- 03
Step 3: Monitor Progress
Observe the agent's actions and validation results. It will automatically address issues until the branch meets all criteria or reaches the maximum iterations.
- 04
Step 4: Confirm Acceptance
Once the merge queue accepts the PR (exit condition met), verify the changes and proceed with merging.
Workflow Steps
- 01
Check Merge Queue Status
Run initial validation to determine if the branch is already ready or what specific issues need to be addressed.
- 02
Analyze Validation Output
Parse the validation result to identify missing requirements such as test coverage, linting errors, or documentation gaps.
- 03
Apply Required Changes
Make targeted modifications to the branch to meet the identified merge queue criteria.
- 04
Re-validate Changes
Re-run the merge queue validation command to check if the applied changes have resolved the issues.
- 05
Iterate Until Acceptance
Repeat the process of analyzing and applying changes until the branch passes validation or the maximum iterations are reached.
Kickoff Prompt
Start the "Merge Queue Ready" loop. Goal: Prepare branch for merge queue Max iterations: 10 Between iterations run: merge queue validation Exit when: Queue accepts PR Prepare this branch for the merge queue. Start by running the merge queue validation command to identify any issues preventing acceptance, then apply necessary fixes until the branch is ready. Self-pace this loop. After each iteration, run `merge queue validation` and evaluate the output, and only continue if the exit condition is not met (Queue accepts PR). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Do not modify code beyond what is necessary to satisfy merge queue requirements.
- ·Avoid introducing new dependencies or making unrelated changes.
- ·Ensure all changes are reversible if needed.
- ·Stop immediately if validation commands fail unexpectedly or return ambiguous results.
- ·Prioritize stability and correctness over speed.
Flow Diagram
Related loops — CI
CI
Dependency Cache Optimizer
Automatically analyzes cache metrics, identifies dependency-related bottlenecks, and optimizes caching strategy to improve cache hit rates in CI environments.
CI
Flaky Test Hunter
This loop automatically identifies and removes flaky tests in your Node.js project. A flaky test is one that passes and fails intermittently without any code changes. The agent will run your test suite multiple times, detect inconsistent test results, and attempt to fix or remove the flaky tests to stabilize your CI pipeline.
CI
Parallelize CI Jobs
This loop optimizes CI pipeline efficiency by identifying and parallelizing independent jobs to reduce overall runtime. The agent iteratively analyzes the current pipeline structure, implements parallelization strategies, and validates improvements through metrics.