Skip to content

Fix agent should self-check new code for same-defect-class regressions #759

Description

@fullsend-ai-retro

What happened

On PR #708, the fix agent addressed a review finding about static metadata fields by adding dynamic truncation detection in fix iteration 1 (commit 9007375, 2026-08-09). The new code used gh pr list --limit 100 to count open PRs for the truncation calculation. However, --limit 100 silently caps results at 100 — the exact same defect class as the original issue #705, which was about gh issue list --limit 1000 truncating backlog results. The review agent caught this in review iteration 2, identifying that repos with >100 open PRs would get false-positive backlog_truncated=true. This required fix iteration 2 to restructure the approach, and fix iteration 3 to add tolerance for API timing races — two additional review-fix cycles that could have been avoided if the fix agent had verified its new code against the defect class it was addressing.

What could go better

The fix agent introduced a bug of the same class as the bug being fixed. The original issue was about using a capped API call (--limit 1000) as if it returned complete data. The fix agent's new code used another capped API call (--limit 100) as if it returned complete data. This pattern — where the fix introduces a new instance of the same defect class — is distinct from existing proposals: #665 covers verifying that fixes resolve findings (backward-looking), #549 covers adversarial verification for security findings specifically, and #129 covers checking for parallel instances of existing bugs in the codebase. None address the fix agent checking its own new code for the same defect class as the finding being addressed (forward-looking). Confidence is high that this is a genuine gap — the defect-class recurrence is clearly documented in the review comments, and the pattern cost 2 additional review-fix cycles (~4 agent runs). The risk is that defect-class identification is subjective and hard to operationalize generically, but the fix-review skill's step 4 (planning) already includes validity checking, making this a natural extension.

Proposed change

Add defect-class awareness to the fix-review skill (skills/fix-review/SKILL.md) in two locations:

  1. Step 4 (Plan fixes): After the existing validity checking, add guidance: "Before implementing, identify the defect class of the original issue and each review finding being addressed (e.g., truncated/capped API results, unescaped user input, race conditions, hardcoded limits). When planning new code to address a finding, verify that your approach does not rely on the same flawed assumption. For example, if the finding is about an API call that silently truncates results, verify that any new API calls you introduce return complete results."

  2. Step 7d (Self-review): After the existing checks for untraced changes, debug prints, and secrets, add: "Re-read the defect class of the original issue and the finding you addressed. Scan your diff for any new code that could exhibit the same class of defect — particularly new API calls, limit parameters, or assumptions about completeness that mirror the original bug."

Validation criteria

On the next 5 fix agent runs where the original issue or review finding involves a capped/truncated/limited data source, the fix agent should not introduce new code that uses capped API calls as complete counts. More broadly: the fix agent's self-review step should produce a log line or structured output field indicating it checked for same-class defect recurrence, and the rework rate for same-class bugs should decrease (baseline from this PR: 1 same-class bug in 3 iterations). A functional eval case could be constructed from this PR's scenario: given a finding about --limit 100 truncation, verify the fix agent does not introduce another --limit N call for counting.


Generated by retro agent from #708

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions