Skip to content

Pre-agent for comment screening, dedup, and context curation #2336

Closed as duplicate

Description

@redhat-chai-bot

What happened

In a team discussion, we identified that as the fix agent's input expands to include more PR comments and CI output, there's a risk of context overload. A PR with active discussion could have 100+ comments where 90% are outdated or superseded by later changes.

What could go better

Implement a pre-processing agent (or sub-agent step) that runs before the fix/code agent and curates the comment context:

  1. Security screening: Flag comments that appear to contain prompt injection attempts or other adversarial content
  2. Relevance filtering: Identify which comments are still relevant to the current state of the PR (vs. addressing code that has since been changed)
  3. Deduplication: Collapse redundant comments that say the same thing
  4. Chronological context: Optionally preserve a compressed narrative of how the PR evolved, without including every intermediate comment
  5. Priority ranking: Surface the most actionable comments first

The pre-agent would produce a curated, compact context package for the downstream fix/code agent, protecting its context window while ensuring it has the right information.

Design considerations

  • This aligns with the existing sub-agent pattern used by the retro agent (dispatch sub-agents for read-heavy operations to protect the main context window)
  • The v0.13.0 review agent refactoring shows precedent for fan-out to specialized sub-agents
  • An alternative to a dedicated pre-agent is a sub-agent dispatched by the fix agent itself
  • Once production evals are running, use that data to optimize context selection rather than guessing at what works
  • Consider whether telling a story of how we got to the current state could be good context vs. just showing the latest state

Activity

  1. fullsend-ai-triage commented on Jun 16, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 3:23 PM UTC · Completed 3:25 PM UTC
    Commit: 4e21a60 · View workflow run →

  2. added
    feature
    triaged
    new-agent-proposal
    agent/fix
    priority/medium
    on Jun 16, 2026
  3. fullsend-ai-triage commented on Jun 16, 2026

    @fullsend-ai-triage

    Triage Summary

    Category: Feature — new pre-processing agent for comment context curation
    Severity: Medium — becomes more urgent as fix agent input expands per #2335

    Problem

    As the fix agent's input grows to include PR comments and CI output, the context window risks being overwhelmed. A PR with active discussion could have 100+ comments where most are outdated, redundant, or superseded. No filtering layer currently exists between raw comment data and the agent's context.

    Recommended Approach

    Implement a curation sub-agent (or pre-agent step) with five capabilities:

    1. Security screening — flag potential prompt injection in comments
    2. Relevance filtering — identify comments still relevant to the current PR state
    3. Deduplication — collapse redundant comments
    4. Chronological compression — preserve a compressed narrative of PR evolution
    5. Priority ranking — surface most actionable comments first

    The review agent's sub-agent fan-out pattern (v0.13.0) provides architectural precedent. A key design decision is whether this runs as a standalone pre-agent in the dispatch pipeline or as a sub-agent dispatched by the fix agent itself.

    Related Issues

    This is part of a feature cluster from the same team discussion:

    Proposed Test Case

    Scenario: Curation agent filters and ranks PR comments
    Given a synthetic PR with:
      - 10 outdated comments on since-changed lines
      - 5 current relevant comments  
      - 3 duplicate comments saying the same thing
      - 1 comment with prompt injection markers
      - A chronological discussion thread
    When the curation agent processes the raw comments
    Then outdated comments are excluded or summarized
      And duplicates are collapsed into single entries
      And the injection attempt is flagged
      And relevant comments are preserved and ranked by actionability
      And a compressed narrative captures the PR's evolution
      And the output is significantly smaller than raw input
    

    Labels: New agent proposal for fix agent context curation, touching agent/fix, dispatch, and harness components with medium priority.

  4. fullsend-ai-prioritize commented on Jun 16, 2026

    @fullsend-ai-prioritize

    RICE Priority Score: 0.38

    Score breakdown
    Dimension Score Reasoning
    Reach 1.5 This affects all users of the fix agent once PR comment ingestion (#2335) is implemented. Filed by Red Hat team (redhat-chai-bot), suggesting a strategic customer need. Multiple orgs running the fix agent on comment-heavy PRs would benefit, warranting 1.5.
    Impact 1 Medium impact — it's a quality-of-life optimization that prevents context window overload and improves fix agent output quality on busy PRs. The security screening (prompt injection) adds defensive value, but this is not currently blocking any workflow since comment ingestion (#2335) isn't shipped yet.
    Confidence 0.5 Medium-low confidence because this is forward-looking — it depends on #2335 (comment ingestion) being implemented first, so the actual impact is speculative. The issue is well-described with clear design considerations, but real-world data on context overload frequency is lacking.
    Effort 2 Complex — requires designing and implementing a new agent with five distinct capabilities (security screening, relevance filtering, dedup, chronological compression, priority ranking), plus integration into the dispatch pipeline. Architectural decisions needed on pre-agent vs sub-agent pattern.

    Formula: (1.5 x 1 x 0.5) / 2 = 0.38

  5. maruiz93 commented on Sep 8, 2026

    @maruiz93
    Contributor

    /fs-triage is this still relevant?

  6. fullsend-ai-triage commented on Sep 8, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 9:33 AM UTC · Completed 9:38 AM UTC

    Commit: 2e04354 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $0.82

  7. added
    blocked
    and removed
    feature
    triaged
    on Sep 8, 2026
  8. fullsend-ai-triage commented on Sep 8, 2026

    @fullsend-ai-triage

    This issue is still relevant but remains blocked on #2335 (fix agent expanding input to include human PR comments). Since #2335 is still open with no PRs in flight, the fix agent does not yet ingest PR comments so there is nothing for a curation pre-agent to curate.

    Once #2335 lands, this issue becomes immediately actionable: a PR with 100+ comments will need the screening, dedup, and relevance filtering described here to protect the fix agent context window.

    What changed since last triage: Nothing material. #2335, #2337, #2338, and #114 are all still open. The original design considerations and five proposed capabilities remain valid. The dependency structure is unchanged.

    Recommend keeping this open and revisiting once #2335 progresses.

    Blocked by:

  9. ifireball commented on Sep 8, 2026

    @ifireball
    Member

    /fs-triage this seems like a duplicate of #6407 that is worded in a misleading way - consider and close as such if that is the case

  10. fullsend-ai-triage commented on Sep 8, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 10:54 AM UTC · Completed 10:58 AM UTC

    Commit: 5056cb6 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $0.78

  11. added
    duplicate
    and removed
    blocked
    on Sep 8, 2026
  12. fullsend-ai-triage commented on Sep 8, 2026

    @fullsend-ai-triage

    After reviewing #6407 ("Implement deterministic binary for collecting and structuring PR data as agent input") as suggested, this issue does appear to be a duplicate. Both issues address the same root problem: agents need curated, structured context rather than raw, unfiltered PR data.

    #6407 has broader scope — covering PR diffs, comments, reviews, CI status, and metadata — and would subsume the five comment curation capabilities described here (security screening, relevance filtering, deduplication, chronological compression, priority ranking). The active ADR in PR #7080 (deterministic entity context staging) establishes the architectural direction for this work.

    The specific comment curation requirements from this issue should be captured as acceptance criteria or sub-tasks within #6407 to ensure they are not lost — particularly the security screening for prompt injection in comments, which is a distinct concern from data collection.

    Closing as duplicate of #6407.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/fixduplicatenew-agent-proposalpriority/medium

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions