Skip to content

Conversation

@dittops
Copy link
Contributor

@dittops dittops commented Nov 2, 2025

Summary

Converts hard error into warning when encountering unsupported provider types
in guardrail configuration, enabling graceful degradation instead of complete
failure.

Changes

  • Replace error return with warning log when unsupported provider types are
    detected
  • Skip validation for unsupported providers using continue statement
  • Improve error messaging to indicate skipped providers during execution

Motivation

This change improves forward compatibility and system resilience:

  • Allows the system to continue operating when new provider types are added
    externally
  • Prevents complete guardrail configuration failure due to unknown providers
  • Provides clear visibility through warning logs about skipped providers

Impact

  • Before: System would fail to start if any guardrail had an unsupported
    provider type
  • After: System logs a warning and skips unsupported providers, continuing
    with supported ones

Test Plan

  • Verify system starts successfully with unsupported provider types in
    guardrail config
  • Confirm warning logs are generated for unsupported providers
  • Test that supported providers in the same guardrail continue to work
  • Validate that execution skips unsupported providers gracefully

🤖 Generated with Claude Code

…l providers

Convert hard error into warning when encountering unsupported provider types
in guardrail configuration. This allows the system to continue operation by
skipping unsupported providers instead of failing completely.

Changes:
- Replace error return with warning log for unsupported provider types
- Add continue statement to skip validation for unsupported providers
- Improve error message to indicate provider will be skipped during execution

This enables better forward compatibility when new provider types are added
externally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dittops, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the budgateway's resilience and forward compatibility by modifying how it handles unsupported guardrail provider types. Previously, encountering such a provider would cause a complete system failure, halting operations. Now, the system will log a warning, gracefully skip the unsupported provider, and continue processing supported configurations. This ensures continuous operation and better adaptability to future provider additions without requiring immediate system updates for new types.

Highlights

  • Error Handling: Changed the system's behavior from returning a hard error to logging a warning when an unsupported guardrail provider type is encountered during configuration loading.
  • Graceful Degradation: Enabled graceful degradation, allowing the system to continue operating with supported guardrail configurations even if some providers are unsupported, preventing complete system failure.
  • Provider Skipping: Implemented a mechanism to skip validation and execution for unsupported guardrail providers, ensuring that only valid configurations are processed while providing clear visibility through warning logs.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to make the guardrail configuration more resilient by allowing unsupported provider types without causing a hard failure. Instead of erroring out, it now logs a warning and skips validation for such providers. The change in guardrail_table.rs correctly handles this during configuration validation, preventing startup failures. However, I've pointed out a potential issue at runtime where an unsupported provider could still cause a failure if the guardrail is configured with FailFast failure mode. My review comment includes a suggestion to make the graceful degradation more robust by filtering out unsupported providers earlier in the execution flow.

Comment on lines 165 to 173
if !SUPPORTED_PROVIDERS.contains(&provider.provider_type.as_str()) {
return Err(crate::error::Error::new(
crate::error::ErrorDetails::Config {
message: format!(
"Unsupported provider type '{}' in guardrail '{}'",
provider.provider_type, self.id
),
},
));
// Log warning instead of returning error for unknown providers
tracing::warn!(
"Unsupported provider type '{}' in guardrail '{}' - this provider will be skipped during execution",
provider.provider_type,
self.id
);
continue; // Skip validation for unsupported providers
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This change correctly prevents the application from failing at startup due to an unsupported guardrail provider by logging a warning instead of returning an error.

However, the graceful degradation at runtime appears incomplete. The execution logic in execute_single_probe (in guardrail.rs) will still attempt to process the unsupported provider, which results in an error. If the guardrail's failure_mode is set to FailFast, this will cause the entire guardrail execution to fail, which contradicts the goal of this PR. With BestEffort mode, it will result in redundant warning logs.

To fully implement graceful degradation, consider filtering out unsupported providers before they are executed, for example, within create_probe_tasks in guardrail.rs. This would ensure they are truly skipped during execution regardless of the failure_mode.

To implement this, you might need to move the SUPPORTED_PROVIDERS constant to the module level to make it accessible from guardrail.rs.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 164 to +172
for provider in &self.providers {
if !SUPPORTED_PROVIDERS.contains(&provider.provider_type.as_str()) {
return Err(crate::error::Error::new(
crate::error::ErrorDetails::Config {
message: format!(
"Unsupported provider type '{}' in guardrail '{}'",
provider.provider_type, self.id
),
},
));
// Log warning instead of returning error for unknown providers
tracing::warn!(
"Unsupported provider type '{}' in guardrail '{}' - this provider will be skipped during execution",
provider.provider_type,
self.id
);
continue; // Skip validation for unsupported providers

Choose a reason for hiding this comment

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

P1 Badge Unsupported providers still trigger fail-fast errors

The new validate implementation only logs and continues for unknown providers, but the providers remain in self.providers. Downstream code (create_probe_tasksexecute_single_probe) still builds probe tasks for every provider and returns ErrorDetails::Config { message: "Unsupported provider type" } when the type is not matched. With FailureMode::FailFast (the default when executing guardrails), any request that reaches execute_guardrail with an unsupported provider will still error at runtime rather than being skipped, so the intended “graceful degradation” never happens and failures merely move from startup to request handling.

Useful? React with 👍 / 👎.

@dittops dittops assigned dittops and unassigned dittops Nov 3, 2025
@dittops dittops requested a review from lostnull November 3, 2025 05:57
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.

2 participants