diff --git a/src/codegate/pipeline/extract_snippets/output.py b/src/codegate/pipeline/extract_snippets/output.py index f385b71d..a9b7adae 100644 --- a/src/codegate/pipeline/extract_snippets/output.py +++ b/src/codegate/pipeline/extract_snippets/output.py @@ -5,7 +5,7 @@ from litellm import ModelResponse from litellm.types.utils import Delta, StreamingChoices -from codegate.pipeline.base import CodeSnippet, PipelineContext +from codegate.pipeline.base import AlertSeverity, CodeSnippet, PipelineContext from codegate.pipeline.extract_snippets.extract_snippets import extract_snippets from codegate.pipeline.output import OutputPipelineContext, OutputPipelineStep from codegate.storage import StorageEngine @@ -85,6 +85,11 @@ async def _snippet_comment(self, snippet: CodeSnippet, context: PipelineContext) archived packages: {libobjects_text}\n" comment += "\n### 🚨 Warnings\n" + "\n".join(warnings) + "\n" + # Add an alert to the context + context.add_alert( + self.name, trigger_string=comment, severity_category=AlertSeverity.CRITICAL + ) + return comment def _split_chunk_at_code_end(self, content: str) -> tuple[str, str]: @@ -147,9 +152,6 @@ async def process_chunk( chunks.append(self._create_chunk(chunk, after)) complete_comment += after - # Add an alert to the context - input_context.add_alert(self.name, trigger_string=complete_comment) - return chunks # Pass through all other content that does not create a new snippet