Skip to content

Conversation

@monshri
Copy link
Collaborator

@monshri monshri commented Dec 1, 2025

📝 Error Handling and Synchronization with Plugin Framework Updates

OPA Plugin Error Handling

Added standardized error constants for OPA plugin failures, including server communication issues, configuration errors, and unsupported parameters or modalities. The OPA plugin now raises a PluginError for these conditions:

OPA_SERVER_NONE_RESPONSE = "OPA server returned an empty response"
OPA_SERVER_ERROR = "Error while communicating with the OPA server"
OPA_SERVER_UNCONFIGURED_ENDPOINT = "Policy endpoint not configured on the OPA server"
UNSPECIFIED_REQUIRED_PARAMS = "Required parameters missing: policy config, payload, or hook type"
UNSUPPORTED_HOOK_TYPE = "Unsupported hook type (only tool, prompt, and resource are supported)"
INVALID_POLICY_ENDPOINT = "Policy endpoint must be curated with the supported hooktypes"
UNSPECIFIED_POLICY_MODALITY = "Unspecified policy modality. Picking up default modality: text"
UNSUPPORTED_POLICY_MODALITY = "Unsupported policy modality (Supports text, image and resource)"

Testing
Included test_errors.py with unit tests verifying these errors raise correctly under respective conditions. Run tests via make test.​

OPA Plugin test cases updated with the new refactoring changes

The test cases were failing before, since the way we invoke hooks from plugin manager changed with the new changes in the plugin framework. Now, with the updates, all test cases are passing

@monshri monshri requested a review from araujof December 1, 2025 20:13
@monshri monshri self-assigned this Dec 1, 2025
@monshri monshri requested a review from crivetimihai as a code owner December 1, 2025 20:13
@monshri monshri added the enhancement New feature or request label Dec 1, 2025
@monshri monshri marked this pull request as draft December 1, 2025 21:14
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
@monshri monshri marked this pull request as ready for review December 2, 2025 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant