Skip to content

Make alert_explanation optional in AlertExplanationParams#2031

Merged
arikalon1 merged 1 commit intomasterfrom
claude/optional-alert-explanation-p27Ib
Mar 19, 2026
Merged

Make alert_explanation optional in AlertExplanationParams#2031
arikalon1 merged 1 commit intomasterfrom
claude/optional-alert-explanation-p27Ib

Conversation

@arikalon1
Copy link
Contributor

Summary

Updated the alert_explanation_enricher function to handle cases where the alert explanation is not provided, making it an optional parameter instead of required.

Key Changes

  • Changed alert_explanation field type from str to Optional[str] in AlertExplanationParams
  • Modified alert_explanation_enricher to conditionally add the explanation block only when alert_explanation is provided
  • Added early return when neither explanation nor recommendation is available, preventing empty enrichments
  • Simplified the resolution block appending logic for consistency

Implementation Details

  • The function now initializes an empty blocks list and conditionally appends blocks based on parameter availability
  • Both alert_explanation and recommended_resolution are now truly optional, with the enrichment being skipped entirely if neither is provided
  • This prevents adding empty or incomplete enrichments to alerts

https://claude.ai/code/session_01NBPvBVC2yxLR27xuV5snLX

Allow users to configure the action with only recommended_resolution
by making alert_explanation an Optional field. The enricher now skips
blocks for fields that are not provided and returns early if neither
field is set.

https://claude.ai/code/session_01NBPvBVC2yxLR27xuV5snLX
@github-actions
Copy link

github-actions bot commented Mar 19, 2026

Docker image ready for ae65fc8 (built in 3m 13s)

⚠️ Warning: does not support ARM (ARM images are built on release only - not on every PR)

Use this tag to pull the image for testing.

📋 Copy commands

⚠️ Temporary images are deleted after 30 days. Copy to a permanent registry before using them:

gcloud auth configure-docker us-central1-docker.pkg.dev
docker pull us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:ae65fc8
docker tag us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:ae65fc8 me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:ae65fc8
docker push me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:ae65fc8

Patch Helm values in one line:

helm upgrade --install robusta robusta/robusta \
  --reuse-values \
  --set runner.image=me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:ae65fc8

@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

The AlertExplanationParams class now accepts an optional alert_explanation parameter instead of a required string. The alert_explanation_enricher action conditionally appends enrichment blocks only when the corresponding parameters are truthy, returning early if no blocks are generated.

Changes

Cohort / File(s) Summary
Alert Explanation Parameter
playbooks/robusta_playbooks/alerts_integration.py
Changed alert_explanation from required str to Optional[str]. Updated enricher logic to conditionally append "Alert Explanation" and recommendation blocks based on parameter truthiness, with early return if no blocks are added.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately describes the main change: making alert_explanation optional in AlertExplanationParams, which aligns with the primary modification in the changeset.
Description check ✅ Passed The description is well-related to the changeset, providing clear details about making alert_explanation optional and modifying the enricher logic to handle optional parameters, which matches the actual changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/optional-alert-explanation-p27Ib
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can customize the high-level summary generated by CodeRabbit.

Configure the reviews.high_level_summary_instructions setting to provide custom instructions for generating the high-level summary.

@arikalon1 arikalon1 enabled auto-merge (squash) March 19, 2026 08:20
@arikalon1 arikalon1 merged commit cddb7d7 into master Mar 19, 2026
5 of 6 checks passed
@arikalon1 arikalon1 deleted the claude/optional-alert-explanation-p27Ib branch March 19, 2026 08:21
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.

3 participants