Skip to content

Review and fix agents should reconcile finding threads #478

Todo
9 of 10 issues completed
Todo

Description

@maruiz93

Problem Statement

After review and fix runs, humans still have to compare findings across review rounds, locate the matching inline threads, decide which threads are stale, and infer whether a fix agent handled each concern. A fix run can push changes without a later review run, leaving GitHub-outdated bot threads open. The review ledger already carries stable finding IDs, but the fix handoff does not carry those IDs into its structured results or map actions back to exact threads.

The goal is for a human to review the resulting PR and merge it, while any unresolved or uncertain concern remains clearly visible with enough context to decide the next action.

Solution

Use the stable finding ID as the link between a finding, its review thread, the fix agent's result, and post-script actions. The review and fix agents account for prior open findings and communicate their dispositions in the corresponding threads. Post-scripts add an explanatory reply before resolving a thread. They leave actionable or uncertain concerns open and report cleanup failures in the PR summary without failing the run.

The implementation stays in the agents repository and uses its existing direct forge API pattern. A Fullsend runner operation may be considered later for shared or batched operations, but it is not a prerequisite.

User Stories

  1. As a PR author, I want every open review finding from earlier runs reconsidered, so that a still-valid concern is not lost when the review changes.
  2. As a reviewer, I want stable finding IDs to remain associated with their finding across runs, so that I can follow the same concern through its thread and any fix.
  3. As a PR author, I want the review agent to close a prior finding thread only after the new review has evidence that the change resolves the original concern, so that a finding is not closed merely because it disappeared from the latest report.
  4. As a PR author, I want a reclassified finding that still applies to remain open, so that the revised concern remains visible for action.
  5. As a fix agent, I want the current open finding IDs, thread links, and thread comments supplied to me, so that I can account for earlier findings and human replies without guessing from descriptions or paths.
  6. As a reviewer, I want each fix action tied to its stable finding ID, so that the post-script can target the exact stamped thread.
  7. As a reviewer, I want a fixed finding to receive a reply explaining the change and linking to its commit before the thread is resolved, so that the outcome is understandable in context.
  8. As a reviewer, I want a reasoned finding that is invalid or no longer needs action to receive an explanation and be resolved, while a valid, actionable, or uncertain finding remains open for human judgment.
  9. As a PR author, I want human replies in a finding thread considered before that thread is resolved, so that an additional request is not hidden by an automated closure.
  10. As a PR author, I want the fix post-script to close eligible GitHub threads marked outdated even if no review run follows the fix, so that obsolete bot comments do not remain unresolved.
  11. As a PR author, I want GitHub and GitLab finding threads to receive the same fixed, declined, or needs-human treatment where the forge supports it, so that the workflow is consistent across supported repositories.
  12. As a PR author, I want API failures or ambiguous thread matches listed in the PR summary with working thread links and a suggested next step, so that I can close a resolved thread manually or rerun the fix agent with instructions without inspecting logs.
  13. As a maintainer, I want reruns not to duplicate evidence replies or resolve a different thread, so that thread updates are safe to retry.
  14. As a maintainer, I want a Fullsend CLI integration to remain optional, so that agents-side improvements can ship without waiting on another repository.

Implementation Decisions

  • A shared, model-invoked skill defines the stable f_… finding ID, how to read the stamp in a review thread, how to distinguish it from local summary ordinals, and how review and fix agents use it.
  • The fix pre-script supplies a host-generated manifest for all currently open bot finding IDs, including carried-forward findings, matching thread links, and complete thread context. The fix agent must account for each finding it handles and read any human replies.
  • Each structured fix action on a review finding includes its stable finding ID and one disposition: fixed, declined, or needs_human. declined means the finding is invalid, duplicate, or no longer requires action; a valid concern that the agent cannot or will not settle is needs_human. Standalone human instructions may have no finding ID.
  • The post-fix script re-fetches current thread state before acting and matches only a unique, complete, bot-stamped finding thread. It posts an idempotent explanation before resolving fixed and declined findings. It comments on needs_human findings and leaves them open. If the explanation cannot be posted, the script does not resolve that thread.
  • The post-review script resolves a prior thread only when the review result marks that finding resolved_by_change with evidence. open and reclassified findings remain open. Absence from a new report alone is not evidence for closure.
  • Both post-review and post-fix retain the existing safe GitHub outdated-thread sweep: only eligible unresolved threads whose comments are all outdated, authored by the trusted review bot, fully fetched, and resolvable are closed. The sweep is GitHub-only.
  • GitHub and GitLab thread replies and resolution use direct APIs from the agents scripts. Missing, ambiguous, human-owned, incomplete, or changed-head matches are left open and reported.
  • API failures do not fail the agent run. The PR summary lists each affected finding with a working thread link, what succeeded, and a next action such as closing manually or rerunning with further instructions. Humans should not need to post a closing comment themselves.
  • No Fullsend change is required. A later Fullsend operation may centralize these calls or batch multiple thread actions; its performance benefit depends on the operation being batched.

Testing Decisions

Tests should exercise observable behavior at the script and result-contract seams, using forge API fixtures rather than asserting private helper structure. Cover prior-finding carry-forward and evidence-based resolution; exact stable-ID matching; fixed, declined, and needs-human outcomes; human replies; missing, ambiguous, already-resolved, outdated, truncated, and changed-head threads; idempotent reruns; comment or resolution failures; and the per-thread links and next actions in the PR summary. Exercise GitHub GraphQL and GitLab discussion behavior separately. Existing pre-review, post-review, post-fix, and fix-result contract tests provide prior art.

Out of Scope

  • Automatically approving, merging, or dismissing human review decisions on a PR.
  • Resolving a valid actionable finding that the fix agent did not address, or a finding the agent cannot confidently assess.
  • Resolving human-owned or ambiguously matched threads.
  • Adding a GitLab equivalent of GitHub's isOutdated sweep.
  • Requiring a Fullsend CLI change before agents-side behavior can ship.

Further Notes

Sub-issues

Sub-issues

9 of 10 Issues completed
Loading 10 sub-issues

Activity

  1. added
    enhancement
    on Jul 27, 2026
  2. fullsend-ai-triage commented on Jul 27, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 11:48 PM UTC · Completed 11:52 PM UTC
    Commit: d72d648 · View workflow run →

  3. fullsend-ai-triage commented on Jul 27, 2026

    @fullsend-ai-triage

    Triage update

    The rewritten scope is specified well enough to implement, and it is treated as a single feature: stable finding IDs link a finding, its thread, the fix result, and the post-script actions.

    Change from the earlier triage: the earlier note marked this as blocked on fullsend PR 9446 and a new fullsend entrypoint. The updated scope drops that dependency. The agents repo already calls GitHub's thread-resolve mutation and has forge helpers for outdated-thread resolution and finding-thread links in both the GitHub and GitLab libs, so they can be reused directly. The fullsend work (9446, 956, and the CLI issue 9696) is an optional later optimisation, but the implementation should stay idempotent so it coexists with it.

    Findings kept from earlier triage: the fix result schema has no finding ID, disposition or evidence. The post-fix script currently only posts a top-level summary. The agents#3514 reference in the original text does not exist and is most likely a typo.

    Points for maintainers:

    • Open issue Fix agent should reconcile GitLab finding discussions #1946 (GitLab evidence replies) says the fix agent must never resolve a discussion. This scope has the fix post-script resolve fixed and declined threads. The scope says to align or fold Fix agent should reconcile GitLab finding discussions #1946, so decide which contract wins before implementing the GitLab side.
    • Changing the fix-result schema is a contract change: keep existing fix/disagree output working, or migrate it deliberately.
    • The work spans review and fix scripts, the schema, skills and tests. It could be landed in stages (schema and manifest, then fix-side reply/resolve, then review-side resolved_by_change, then GitLab), but it shares one ID contract, so it is not split here.

    Proposed test case:

    With forge API fixtures:
    1. fixed action + stamped bot thread at same head -> one evidence reply, then resolve; rerun -> no duplicate reply, no other thread touched
    2. declined -> explanation + resolve; needs_human -> comment only, thread stays open
    3. human reply, missing/ambiguous/truncated/changed-head/already-resolved thread -> left open, reported with reason
    4. comment or resolve API failure -> thread not resolved, run succeeds, PR summary lists thread link + next action
    5. review result: resolved_by_change with evidence resolves; open/reclassified or mere absence does not
    6. GitHub GraphQL and GitLab discussion cases run separately
    

    No workflow-file changes are needed. This is a feature, so it is not auto-promoted to ready-to-code; a maintainer can promote it when they want it implemented.


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
    Previous run

    Triage Summary

    Category: Feature · Severity: Medium

    Problem

    When the fix agent addresses review findings, process-fix-result.py posts only a top-level summary comment. The individual inline review threads are left without replies, requiring reviewers to manually cross-reference the summary against each thread.

    Root Cause

    process-fix-result.py currently only calls build_summary_body() and post_summary(). There is no logic to fetch inline PR review comments from the GitHub API or reply to individual threads. The structured data needed for matching already exists in fix-result.json — each action entry contains finding, path, description/reason, and type.

    Recommended Approach

    Extend process-fix-result.py to:

    1. Fetch inline PR review comments via GET /repos/{owner}/{repo}/pulls/{pr}/comments
    2. Match each action in fix-result.json to inline comments by finding name (pattern like **[severity]** finding-name in comment body) and file path
    3. Post a reply to matched threads — include what was changed (for fix) or reason (for disagree)
    4. Do not resolve threads (tracked separately in fullsend#956)

    Edge cases to handle: unmatched findings (log warning, don't fail), multiple comments for the same finding (match on path), API rate limits.

    Proposed Test

    # In process-fix-result-test.py:
    # 1. Mock GitHub API to return inline review comments with known
    #    finding names/paths in their bodies
    # 2. Provide fix-result.json with fix + disagree actions matching
    #    some comments, plus one unmatched action
    # 3. Run with --dry-run
    # 4. Assert reply calls generated for matched findings with correct content
    # 5. Assert unmatched findings produce warning, not failure
    # 6. Assert no resolve/dismiss calls made
    # 7. Test matching edge cases: multiple comments per finding,
    #    special characters in finding names, bot vs human comments

    Note: The issue references fullsend-ai/agents#3514 as a related concern, but that issue number does not exist — this may be a typo. This does not block implementation since it was listed as a "relates to" reference, not a dependency.

  4. fullsend-ai-prioritize commented on Aug 1, 2026

    @fullsend-ai-prioritize

    RICE Priority Score: 1.2

    Score breakdown
    Dimension Score Reasoning
    Reach 1.5 This affects all users who interact with the fix agent's PR workflow — every reviewer on a PR that goes through the fix cycle must currently cross-reference the summary comment against inline threads. The fix-agent label and the real-world observation on fullsend#5657 suggest this is a common pain point across teams, not an edge case.
    Impact 1 Medium — the current workaround (reading the top-level summary and manually matching it to inline threads) is tedious but functional. Replying directly to threads would noticeably improve the review workflow by providing contextual responses in-place, but the absence is not blocking any core functionality.
    Confidence 0.8 High — the issue is exceptionally well-described with a concrete example (fullsend#5657), a clear data model (fix-result.json actions array), a specific matching strategy (finding name + path), and the triage comment adds a detailed implementation plan and test outline. Very little ambiguity remains.
    Effort 1 Medium — requires extending process-fix-result.py with GitHub API calls to fetch inline comments, matching logic against fix-result.json actions, and reply posting. The structured data and matching strategy are already defined, scoping this to primarily one script plus tests. Edge cases (unmatched findings, multiple comments per finding) add some complexity but are well-enumerated.

    Formula: (1.5 x 1 x 0.8) / 1 = 1.2

  5. csoceanu commented on Nov 19, 2026

    @csoceanu
    Contributor

    /fs-triage Please evaluate expanding this issue beyond “reply only”

    The fix-agent post-script should also be able to resolve the exact threads it reports as fixed. This should be an additional closure path—not a replacement for the review-side resolution in fullsend-ai/fullsend#9446—because a review-agent run does not always follow a fix-agent run and we need stronger guarantees for thread closure.

    Suggested scope:

    1. Pass the stable finding ID from the review output into the fix-agent input.
    2. Require every structured fix action to report the finding ID, status, and evidence, including the implementing commit/diff and verification performed.
    3. Match each action to the exact stamped review thread rather than relying on finding descriptions and file paths.
    4. Post an idempotent evidence reply in the matching thread.
    5. After the fix is pushed and the resulting commit/head is verified, have the fix post-script resolve the matching thread when the action reports it fixed.
    6. Leave disagreed, not-fixed, unmatched, ambiguous, human-owned, or insufficiently evidenced threads open.
    7. Record whether each thread was replied to, resolved, already resolved, or skipped, including the reason.
    8. Add equivalent tests covering reruns, moved heads, invalid evidence, human replies, already-resolved threads, and API failures.

    Relevant work:

    Please also confirm the repository boundary: the structured fix output and post-fix behavior belong in agents, while the forge primitives belong in fullsend. If fullsend-ai/fullsend#9446 provides everything required, this may only need an agents PR after that dependency is available; otherwise, please identify the additional fullsend change needed.

  6. fullsend-ai-triage commented on Nov 19, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 10:06 AM UTC · Completed 10:08 AM UTC

    Commit: f6907db · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.31

  7. fullsend-ai-triage commented on Nov 19, 2026

    @fullsend-ai-triage

    Re-triage with the expanded scope. The original reply-only work is unchanged and still well-defined: extend the fix post-script to post an in-thread reply for each fix (what changed, which commit) and disagree (reason) action, without resolving threads. The new resolve-on-fix scope has a cross-repo dependency, so this issue is now marked as having prerequisites.

    Repository boundary (confirmed):

    • fullsend: the thread-resolution primitive is in the still-open fullsend PR 9446 (GitHub and GitLab backends). It is wired only into post-review, and nothing it changes gives the agents-repo fix post-script a way to call it. A fullsend follow-up exposing a runner-callable entrypoint (find matching stamped thread, report state, optionally reply, resolve) is probably needed. A tracking issue for it is proposed. Whether 9446 already covers this could not be verified, so please correct this if there is an existing mechanism.
    • agents (this repo): the structured fix output and post-fix behavior. The fix result schema currently has no finding id, status or evidence fields, and no fix skill passes stable finding ids into the fix agent. Items 1-4 and 6-8 of your list belong here. Item 5, resolution, depends on the fullsend work.

    Suggested sequencing: the reply-only portion, ideally already keyed by the stamped finding id with a path fallback, does not need 9446 and could ship first. It could be carved out into its own issue if maintainers prefer to unblock it. Resolution would follow once 9446 and the fullsend entrypoint exist. The GitLab reply counterpart is tracked separately as agents#1946, and fullsend#8749 covers the GitLab thread lifecycle.

    Other notes:

    • The prior note stands: agents#3514 in the issue body does not exist and is probably a typo.
    • Safeguards worth keeping in the design: only reply or resolve on threads stamped with a finding id and authored by the review bot; verify the pushed head before resolving; make replies idempotent across reruns; record a per-thread outcome (replied, resolved, already resolved, skipped, with reason).

    Proposed tests (conceptual): reruns do not double-reply; moved head or invalid evidence skips resolve; human-authored or ambiguous threads stay open; already-resolved threads are reported rather than failed; API failures on one thread do not abort others; disagree actions reply but never resolve.

    Blocked by:

    Could not create automatically (file manually or update tracker.github.allowed_targets in config.yaml):

    Prerequisite: fullsend-ai/fullsend — Expose review-thread resolution primitive to fix post-scripts (CLI entrypoint)

    The shared forge.Client.ResolvePullRequestReviewThread primitive (GitHub GraphQL resolveReviewThread, GitLab discussion resolved: true) is being added in #9446 and is currently wired only into the post-review lifecycle.

    The fix agent's post-script (maintained in fullsend-ai/agents: scripts/process-fix-result.py / post-fix.src.sh) needs to reply to and then resolve the exact review thread for each finding it reports as fixed, after the fix commit is pushed and the new head is verified. That script is not Go code and cannot call forge.Client directly.

    Please provide a way for runner-side scripts to use the forge primitives, e.g. a CLI subcommand that, given a PR/MR, a stamped finding id (<!-- finding:f_xxx -->) and an expected head SHA:

    • finds the matching bot-authored thread (fail closed on human-authored, missing, or ambiguous matches);
    • returns the thread's current state (open/resolved) and reply status so that replies are idempotent;
    • optionally posts an evidence reply;
    • resolves the thread, honoring --dry-run;
    • reports a machine-readable per-thread outcome (replied, resolved, already resolved, skipped + reason).

    If an existing command already covers this, document it. This depends on #9446 landing first.

  8. 1 remaining item

  9. changed the title [-]Post-fix script should reply to review inline threads it addressed[/-] [+]Review and fix agents should reconcile finding threads[/+] on Nov 26, 2026
  10. fullsend-ai-triage commented on Nov 26, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 1:11 PM UTC · Completed 1:14 PM UTC

    Commit: 95c8650 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.37

  11. self-assigned this
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions