Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 16, 2025

The summarizer was iterating over the LLM response stream without checking errors, causing API failures to silently result in nil content.

Changes:

  • Check err in response stream iteration (line 62-65)
  • Fix Parts type from []genai.Part to []*genai.Part for genai API compatibility
  • Fix Part initialization from genai.Text(prompt) to {Text: prompt}

Before:

for resp := range responseStream {
    if resp == nil {
        continue
    }
    if resp.Content != nil {
        summaryContent = resp.Content
        break
    }
}

After:

for resp, err := range responseStream {
    if err != nil {
        return nil, fmt.Errorf("LLM generation error: %w", err)
    }
    if resp == nil {
        continue
    }
    if resp.Content != nil {
        summaryContent = resp.Content
        break
    }
}

LLM API failures now surface immediately with context instead of returning nil summary content.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 16, 2025
- Check err in response stream iteration to catch LLM API failures
- Fix Parts type to []*genai.Part as per genai API
- Return descriptive error when LLM generation fails

Co-authored-by: raphaelmansuy <1003084+raphaelmansuy@users.noreply.github.com>
Copilot AI changed the title [WIP] Update compaction feature based on feedback from PR #20 Fix missing error handling in LLM response stream iteration Nov 16, 2025
Copilot AI requested a review from raphaelmansuy November 16, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants