Skip to content

Fix IndexError in pipeline registry when allowed_prompts is empty#28

Merged
MOLYHECI merged 1 commit intoOpenDCAI:backendfrom
duanchy3:backend
Dec 28, 2025
Merged

Fix IndexError in pipeline registry when allowed_prompts is empty#28
MOLYHECI merged 1 commit intoOpenDCAI:backendfrom
duanchy3:backend

Conversation

@duanchy3
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings December 28, 2025 11:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an IndexError that occurs in the pipeline registry when the allowed_prompts list is empty or None. The fix adds a conditional check before accessing the first element of the list.

Key Changes:

  • Added a guard condition to check if allowed_prompts exists and is non-empty before accessing index 0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +804 to +805
if op_details.get("allowed_prompts"):
p_val = op_details["allowed_prompts"][0]
Copy link

Copilot AI Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix to prevent IndexError when allowed_prompts is empty is correct, but there's no test coverage for this edge case. Consider adding a test that verifies the behavior when an operator has an empty allowed_prompts list to ensure this IndexError scenario is properly covered and won't regress in the future.

Copilot uses AI. Check for mistakes.
@MOLYHECI MOLYHECI merged commit 271b5f7 into OpenDCAI:backend Dec 28, 2025
6 checks passed
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