Review fix signoff loop

From gabrielmoreira/agent-skills-mirror · View interactive version

Review fix signoff loop is an AI agent skill from the GitHub repository gabrielmoreira/agent-skills-mirror. Use when writing Agent Relay or Ricky workflows that must loop review, fix, and validation with fresh agent context until independent signoff agents, typically Claude and Codex, both agree the work is comprehensively complete. Covers fresh-context iterations, repairable gates, dual reviewer verdict

How to use this skill

Skill file

Review Fix Signoff Loop

Purpose

Use this pattern for high-stakes implementation workflows where a normal "implement, test, review once" flow is not enough. The workflow must keep repairing and re-reviewing until independent signoff agents agree the spec is fully wired end to end.

Pair this with writing-agent-relay-workflows for SDK syntax and relay-80-100-workflow for deterministic validation gates.

Required Shape

  1. Run deterministic preflight before agents start.
  1. Implement with scoped owners.
  1. Reconcile before validation.
  1. Run repairable validation.
  1. Run fresh-context signoff reviews.
  1. Break only on dual signoff.
  1. Report final signoff.

Verdict Contract

Use a strict text contract so deterministic gates can parse the result:

VERDICT: COMPREHENSIVELY_SATISFIED | FINDINGS | BLOCKED
why_passed: required when VERDICT is COMPREHENSIVELY_SATISFIED
end_to_end_wiring_verified: required when VERDICT is COMPREHENSIVELY_SATISFIED
deterministic_evidence: required when VERDICT is COMPREHENSIVELY_SATISFIED
scope_matrix_verified: required when VERDICT is COMPREHENSIVELY_SATISFIED for cross-repo/provider/package work
remaining_risks: required when VERDICT is COMPREHENSIVELY_SATISFIED
finding_id: stable-id when VERDICT is FINDINGS
severity: blocker | high | medium | low
file: path
issue: concrete gap
fix_required: exact change needed
test_required: deterministic proof needed
evidence: commands, files, or spec clause

A deterministic dual-signoff gate should require:

Scope Matrix

Create a machine-readable and human-readable matrix before the first fix pass for work that spans repositories, packages, providers, or CI gates. Keep it updated every iteration.

Recommended columns:

repo | branch | PR | package/provider/surface | expected change | producer version | consumer version | files expected | gates required | status | evidence | owner

Use the matrix to prevent "last-mile" omissions:

Example package-consumption evidence:

npm view @scope/pkg version
rg -n '"@scope/pkg"' package.json package-lock.json packages -g package.json -g package-lock.json
npm ls @scope/pkg --workspace <consumer-workspace>
node -e 'const lock=require("./package-lock.json"); console.log(lock.packages["node_modules/@scope/pkg"].version)'

Fresh Context Implementation

Prefer an outer loop that starts a new Agent Relay workflow run per iteration:

for (let iteration = 1; ; iteration += 1) {
  await runIteration(iteration, runStamp); // new workflow name, channel, and agent names
  clearStartFromAfterResumedIteration();
  if (hasDualSignoff(iteration)) {
    writeAndPostSignoffReport(iteration);
    break;
  }
}

Within runIteration, suffix workflow name, channel, and agent names with runStamp-iteration:

const suffix = `${runStamp}-${iteration}`;
workflow(`my-feature-completion-${suffix}`)
  .channel(`wf-my-feature-${suffix}`)
  .agent(`claude-reviewer-${suffix}`, { cli: 'claude', preset: 'reviewer', role: 'Fresh signoff reviewer' })
  .agent(`codex-reviewer-${suffix}`, { cli: 'codex', preset: 'reviewer', role: 'Fresh signoff reviewer' });

This prevents reviewer memory from a previous loop from becoming the reason the loop exits.

If the outer loop supports --start-from, consume it for only the resumed iteration. START_FROM=fix-review-findings must not leak into the next fresh-context iteration, or the next iteration will skip review/validation and fail on missing artifacts. After a completed resumed iteration, delete process.env.START_FROM and process.env.PREVIOUS_RUN_ID before continuing the loop.

Codex Fixer Reliability

For review-fix loop steps, prefer this shape:

.agent(`codex-review-fixer-${suffix}`, {
  cli: 'codex',
  model: CodexModels.GPT_5_4,
  preset: 'worker',
  role: 'Review-finding fixer. Repairs valid findings and hardens tests/proofs.',
  retries: 2,
})
.step('fix-review-findings', {
  agent: `codex-review-fixer-${suffix}`,
  dependsOn: ['dual-signoff-gate'],
  task: `Read iteration artifacts. Fix every valid finding, rerun relevant checks, and write ${dir}/review-fix-report.md.`,
  verification: { type: 'file_exists', value: `${ROOT}/${dir}/review-fix-report.md` },
})

Use interactive PTY Codex only when the step genuinely needs live channel coordination. For bounded artifact-producing fix/review steps, preset: 'worker' exits through the subprocess lifecycle, and file_exists proves the required artifact exists.

PR Signoff Comment

Final signoff should be both a durable artifact and a PR comment.

Resolution order:

  1. explicit env var such as SIGNOFF_PR_NUMBER, PR_NUMBER, or GITHUB_PR_NUMBER
  2. gh pr view --json number --jq .number
  3. if no PR is available, write PR_COMMENT_FAILED.md and fail unless the workflow has an explicit skip env var

Use a deterministic shell or Node step:

gh pr comment "$PR_NUMBER" --body-file .workflow-artifacts/my-workflow/pr-comment.md

The comment body should include:

Blocked State

Do not spin forever when progress is impossible. If agents identify a true external blocker, write:

.workflow-artifacts/<workflow>/iteration-N/BLOCKED_NO_COMMIT.md

Include exact evidence, missing credentials or services, commands that failed, and the safest retry command. Do not commit, push, or post a success comment from a blocked run.

Common Mistakes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.