Skip to content

Fix alert type code-comment #759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/codegate/pipeline/extract_snippets/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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
Expand Down
Loading