Skip to content

refactor(library): migrate vendor actions to canonical HTTP clients - #2212

Merged
Pouyanpi merged 35 commits into
developfrom
pouyanpi/rail-library-stack-13-http-action-migrations
Jul 30, 2026
Merged

refactor(library): migrate vendor actions to canonical HTTP clients#2212
Pouyanpi merged 35 commits into
developfrom
pouyanpi/rail-library-stack-13-http-action-migrations

Conversation

@Pouyanpi

@Pouyanpi Pouyanpi commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Description

Migrate built-in library integrations to the canonical outbound HTTP client.
This combines the former vendor-action and specialized-client stack layers.

The migrated vendor actions cover AI Defense, AutoAlign, CrowdStrike AIDR,
Fiddler, Pangea, Patronus AI, PolicyAI, Prompt Security, Trend Micro, and F5.
They receive the managed client through action-parameter injection and use
http_call for request execution.

The Hugging Face classifier and Clavata integrations retain their specialized
retry and TLS requirements. A transport-neutral HTTPTLSConfig supports custom
CA bundles and paired client certificate and key paths without leaking HTTPX
types into integrations.

Integration-owned POST retry policies remain explicit. Injected clients remain
caller-owned, while fallback factories return fully composed clients that
http_call closes deterministically.

F5 preserves its bounded Retry-After behavior. Shared recorded-response tests
verify registered endpoints in both directions, and an AST-based conformance
test prevents library integrations from importing HTTPX, aiohttp, Requests, or
urllib3 directly.

Impact

  • Built-in library integrations stop creating transport-specific sessions.
  • Runtime injection, retries, errors, ownership, and telemetry follow one HTTP
    boundary.
  • TLS-sensitive integrations retain custom CA and mTLS support.
  • F5, Hugging Face, and Clavata preserve their integration-specific retries.
  • Recorded HTTP tests reject incorrect and unused endpoint registrations.
  • New library integrations cannot bypass the canonical transport boundary.
  • Unit tests make no live vendor calls.

Stack

Layer Branch Base PR
HTTP foundation pouyanpi/rail-library-stack-9-http-contract develop #2209
HTTP instrumentation pouyanpi/rail-library-stack-10-http-instrumentation Stack 9 #2219
Request lifecycle pouyanpi/rail-library-stack-11-http-observability Stack 9 #2210
Request migrations pouyanpi/rail-library-stack-12-http-request-migrations Stack 11 #2211
Action and specialized migrations pouyanpi/rail-library-stack-13-http-action-migrations Stack 12 #2212

Related Issue(s)

  • Fixes #
  • Internal tracking: NGUARD-862
  • Issue assignee: @

Verification

  • make test TEST="tests/http tests/test_ai_defense.py tests/test_f5_guardrails.py tests/test_fiddler_rails.py tests/test_pangea_ai_guard.py tests/test_patronus_evaluate_api.py tests/test_policyai_rail.py" — 197 passed, 4 skipped.
  • Pre-commit passed across the complete cascaded HTTP stack.
  • All tests were local and made no live provider calls.

AI Assistance

  • No AI tools were used.
  • AI tools were used; a human reviewed and can explain every change (tool: Codex).

Codex assisted with implementation analysis, validation, stack restructuring,
and this draft. Check the disclosure box after human review.

Checklist

  • I've read the CONTRIBUTING guidelines.
  • This PR links to a triaged issue assigned to me.
  • My PR title follows the project commit convention.
  • I've updated the documentation if applicable.
  • I've added tests if applicable.
  • I've noted any verification beyond CI and any checks I couldn't run.
  • I did not update generated changelog files manually.
  • I addressed all CodeRabbit, Greptile, and other review comments, or replied with why no change is needed.
  • @mentions of the person or team responsible for reviewing proposed changes.

Summary by CodeRabbit

  • New Features
    • Added configurable TLS support, including certificate verification, custom CA bundles, and mutual TLS.
    • Added optional HTTP client injection across external guardrail and classifier integrations.
  • Bug Fixes
    • Improved handling of network failures, invalid responses, timeouts, and rate limits with consistent outcomes and logging.
    • Standardized retry behavior for supported external service requests.
  • Tests
    • Expanded coverage for TLS configuration, HTTP failures, retries, request validation, and recorded responses.

@github-actions github-actions Bot added status: needs triage New issues that have not yet been reviewed or categorized. size: XL labels Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Pouyanpi
Pouyanpi force-pushed the pouyanpi/rail-library-stack-13-http-action-migrations branch 2 times, most recently from 1f8c466 to 9852187 Compare July 23, 2026 16:21
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/rail-library-stack-13-http-action-migrations branch from 9852187 to 736a206 Compare July 23, 2026 16:28
@Pouyanpi Pouyanpi added status: triaged Triaged by a maintainer; eligible for automated review (CodeRabbit/Greptile). and removed status: needs triage New issues that have not yet been reviewed or categorized. labels Jul 23, 2026
@Pouyanpi Pouyanpi self-assigned this Jul 23, 2026
@Pouyanpi Pouyanpi added this to the v0.24.0 milestone Jul 23, 2026
@Pouyanpi
Pouyanpi marked this pull request as ready for review July 23, 2026 17:16
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR migrates 10 vendor guard integrations (AI Defense, AutoAlign, CrowdStrike AIDR, Fiddler, Pangea, Patronus AI, PolicyAI, Prompt Security, Trend Micro, F5) from per-integration HTTP sessions (aiohttp, httpx) to the canonical http_call boundary, and adds HTTPTLSConfig to surface TLS options without leaking HTTPX types. HF Classifier and Clavata retain integration-specific retry and TLS wiring while consuming the same transport abstraction.

  • Canonical transport boundary: All migrated actions accept an optional injected HTTPClient, fall back to a per-call factory, and propagate retry, telemetry, and ownership rules through the shared http_call helper; an AST conformance test in tests/http/test_library_boundary.py prevents future regressions.
  • TLS abstraction: HTTPTLSConfig (new frozen dataclass) carries verify, ca_bundle, and mTLS cert/key paths; HttpxHTTPClient derives verify/cert arguments from it, and HF Classifier backends use it for per-config SSL caching.
  • Test infrastructure: tests/http_utils.py extracts a shared RecordedHTTPResponses class with bidirectional URL assertion, replacing the previously fragmented per-file copies flagged in prior reviews.

Confidence Score: 5/5

The refactor is safe to merge; all vendor actions continue to produce correct outcomes and the ownership/retry invariants are preserved across the migrated integrations.

The transport replacement is mechanical and consistent across all 10 integrations: injected clients are caller-owned, fallback factories are auto-closed by http_call, and integration-specific retry policies are forwarded correctly to RetryingHTTPClient. Error hierarchies are respected. The new AST conformance test closes the boundary permanently. The only issues found are a minor inconsistency in empty-line guarding between two AutoAlign helpers and a silent-ignore path in HTTPTLSConfig that is already documented.

Files Needing Attention: nemoguardrails/library/autoalign/actions.py — autoalign_groundedness_infer is missing the empty-line guard present in its sibling autoalign_infer. nemoguardrails/http/types.py — HTTPTLSConfig silently drops ca_bundle when verify=False.

Important Files Changed

Filename Overview
nemoguardrails/http/types.py Adds HTTPTLSConfig frozen dataclass with verify, ca_bundle, client_certificate, and client_key fields; post_init validates cert/key pairing but silently allows ca_bundle with verify=False.
nemoguardrails/http/transport.py Wires HTTPTLSConfig into HttpxHTTPClient; validates TLS cannot be combined with an injected client and correctly derives verify/cert from the config dataclass.
nemoguardrails/library/f5/actions.py Removes bespoke aiohttp retry loop; delegates retry and Retry-After handling to RetryPolicy with clamp_retry_after=True; fail-open paths and 429 detection preserved correctly.
nemoguardrails/library/clavata/request.py Migrates ClavataClient._make_request from aiohttp to http_call; RetryingHTTPClient wraps injected or factory clients; except ClavataPluginError: raise correctly preserves the ClavataPluginAPIRateLimitError type.
nemoguardrails/library/autoalign/actions.py Extracts _autoalign_post helper; autoalign_infer guards against empty NDJSON lines but autoalign_groundedness_infer does not, creating an inconsistency that could surface a JSONDecodeError on interior blank lines.
nemoguardrails/library/hf_classifier/backends.py Replaces custom aiohttp/httpx sessions with _RemoteBackend._post backed by http_call and HTTPTLSConfig; _build_ssl_config duplicates the cert/key pairing check already in HTTPTLSConfig.post_init.
nemoguardrails/library/pangea/actions.py Migrates pangea_ai_guard from a managed httpx context to http_call with raise_for_status=False; broad except Exception preserves original fail-open semantics; text_guard_response is always defined before use.
nemoguardrails/library/crowdstrike_aidr/actions.py Uses try/except HTTPStatusError/else pattern cleanly; fallback is pre-built before the request so the function always returns a valid outcome; guard_response is only accessed in the else branch where it is guaranteed to be assigned.
tests/http/test_library_boundary.py New AST-based conformance test enforces that no file under nemoguardrails/library/ imports aiohttp, httpx, requests, or urllib3 directly; effective guard against future regressions.
tests/http_utils.py Extracts shared RecordedHTTPResponses into a single utility that asserts bidirectional URL matching, replacing the previously fragmented per-file copies.

Sequence Diagram

sequenceDiagram
    participant Action as Vendor Action
    participant http_call as http_call()
    participant Resolve as _resolve_http_client()
    participant Injected as Injected HTTPClient
    participant Factory as factory()
    participant Retrying as RetryingHTTPClient
    participant Transport as HttpxHTTPClient

    Action->>http_call: http_call(client?, method, url, factory)
    http_call->>Resolve: _resolve_http_client(client, factory)
    alt client provided
        Resolve-->>Injected: yield injected (not closed)
    else client is None
        Resolve->>Factory: factory()
        Factory->>Transport: "HttpxHTTPClient(tls=HTTPTLSConfig)"
        Factory->>Retrying: RetryingHTTPClient(transport, RetryPolicy)
        Resolve-->>Retrying: yield owned (closed on exit)
    end
    http_call->>Retrying: request(method, url)
    Retrying->>Transport: POST with retry on 429
    Transport-->>Retrying: HTTPResponse
    Retrying-->>http_call: HTTPResponse
    http_call-->>Action: HTTPResponse
Loading

Reviews (9): Last reviewed commit: "docs(library): document provider action ..." | Re-trigger Greptile

Comment thread nemoguardrails/library/autoalign/actions.py Outdated
Comment thread tests/test_f5_guardrails.py Outdated
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/rail-library-stack-13-http-action-migrations branch 3 times, most recently from bf8c358 to 9c0ae71 Compare July 24, 2026 15:53
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/rail-library-stack-13-http-action-migrations branch from 9c0ae71 to 60b4af2 Compare July 29, 2026 08:13
Comment thread nemoguardrails/library/clavata/request.py
Pouyanpi added 17 commits July 30, 2026 09:53
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/rail-library-stack-13-http-action-migrations branch from 73a2977 to b02780f Compare July 30, 2026 07:56
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds shared TLS configuration and injectable HTTP clients, migrates library integrations from direct HTTP libraries to the canonical HTTP abstraction, centralizes retry and failure handling, and expands recording-based tests for transport behavior and request contracts.

Changes

HTTP foundation

Layer / File(s) Summary
TLS configuration and transport wiring
nemoguardrails/http/*, tests/http/test_runtime.py, tests/http/test_transport.py
Adds HTTPTLSConfig, public exports, TLS-aware client construction, and validation for CA bundles and mutual TLS credentials.

Guardrail integrations

Layer / File(s) Summary
Shared HTTP calls and injected clients
nemoguardrails/library/ai_defense/*, autoalign/*, crowdstrike_aidr/*, f5/*, related tests
Migrates four integrations to http_call, adds client injection, and updates retry, status, decoding, and fail-open behavior.

Clavata and Fiddler

Layer / File(s) Summary
Client injection and retry handling
nemoguardrails/library/clavata/*, fiddler/*, related tests
Replaces direct HTTP sessions with shared clients, adds Clavata retry/error mapping, and updates Fiddler request handling and tests.

Remote classifiers and vendor actions

Layer / File(s) Summary
Shared transport across integrations
nemoguardrails/library/hf_classifier/*, pangea/*, patronusai/*, policyai/*, prompt_security/*, trend_micro/*, related tests
Threads optional clients through action and backend APIs and replaces direct HTTP usage with shared request handling.

Testing infrastructure

Layer / File(s) Summary
Recorded request assertions
nemoguardrails/testing/http.py, tests/http_utils.py, tests/http/*
Adds dynamic response queuing, strict request recording helpers, and AST-based enforcement against direct HTTP imports in library code.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.91% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: migrating vendor library actions to the canonical HTTP client path.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Test Results For Major Changes ✅ Passed PR description includes a Verification section with test results: make test ran with 197 passed, 4 skipped, plus pre-commit passed.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pouyanpi/rail-library-stack-13-http-action-migrations

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (5)
nemoguardrails/library/crowdstrike_aidr/actions.py (1)

137-163: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Collapse the two identical fallback branches.

Both handlers build the same GuardChatCompletionsResult and return the same outcome; only the log message differs. Merging them removes the duplication and also lets you narrow the blind except Exception that Ruff flags (BLE001) to the decode/validation errors you actually expect (HTTPClientError, ValidationError).

♻️ Suggested shape
-    except HTTPStatusError as e:
-        log.error("HTTP status error from CrowdStrike AIDR API: %s", e)
-        return _crowdstrike_aidr_outcome(
-            GuardChatCompletionsResult(
-                guard_output={"messages": messages},
-                blocked=False,
-                transformed=False,
-                bot_message=bot_message,
-                user_message=user_message,
-            ),
-            mode,
-        )
-    except Exception as e:
-        log.error("Error calling CrowdStrike AIDR API: %s", e)
+    except (HTTPStatusError, HTTPClientError, ValidationError) as e:
+        log.error("CrowdStrike AIDR API call failed (%s): %s", type(e).__name__, e)
         return _crowdstrike_aidr_outcome(
             GuardChatCompletionsResult(
                 guard_output={"messages": messages},
                 blocked=False,
                 transformed=False,
                 bot_message=bot_message,
                 user_message=user_message,
             ),
             mode,
         )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nemoguardrails/library/crowdstrike_aidr/actions.py` around lines 137 - 163,
Consolidate the duplicate fallback returns in the response handling around
GuardChatCompletionsResponse into one shared branch, while retaining distinct
logging as needed. Replace the broad `except Exception` with handlers for the
expected `HTTPClientError` and `ValidationError` cases, alongside
`HTTPStatusError`, and ensure all these failures return the same
`_crowdstrike_aidr_outcome` built from `GuardChatCompletionsResult`.

Source: Linters/SAST tools

nemoguardrails/library/autoalign/actions.py (1)

171-180: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract the repeated POST + status-check into one helper.

The same http_call(..., raise_for_status=False) plus if response.status_code != 200: raise ValueError(...) block is duplicated three times; a small _autoalign_post(http_client, request_url, headers, request_body) returning the response keeps the failure message in one place.

Also applies to: 206-215, 249-258

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nemoguardrails/library/autoalign/actions.py` around lines 171 - 180, Extract
the duplicated POST request and non-200 status validation from the AutoAlign
action flows into a shared _autoalign_post(http_client, request_url, headers,
request_body) helper. Have the helper call http_call with the existing
arguments, raise the same ValueError including status code and response text,
and return the successful response; replace all three duplicated blocks,
including those around the referenced ranges, with calls to this helper.
nemoguardrails/library/f5/actions.py (1)

92-96: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Document the new http_client parameter.

The Args section still lists only text and config, so the injectable-client contract (caller-owned, wrapped with the F5 retry policy) is undocumented.

📝 Proposed docstring addition
     Args:
         text: The text to scan.
         config: The active RailsConfig; used to resolve ``rails.config.f5``.
+        http_client: Optional caller-owned client; it is wrapped with the F5
+            retry policy and is not closed by this action.
As per coding guidelines: "Update documentation when changing user-visible behavior, public APIs, configuration syntax, examples, or installation requirements."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nemoguardrails/library/f5/actions.py` around lines 92 - 96, Update the
docstring for f5_guardrails_scan to document the http_client parameter in its
Args section, including that callers may provide an owned HTTP client and that
it is used with the F5 retry policy; retain the existing text and config
documentation.

Source: Coding guidelines

tests/test_clavata_models.py (1)

278-320: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider moving the transport/retry tests out of TestCreateJobResponse and sharing the retry-patch setup.

These new tests exercise ClavataClient transport behavior, not CreateJobResponse parsing, and the _retrying_http_client zero-sleep monkeypatch is duplicated verbatim in two tests. A dedicated class plus a fixture for the patched retry client would keep intent clear.

Also applies to: 385-397

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_clavata_models.py` around lines 278 - 320, Move the
transport/retry tests, including test_clavata_client_uses_shared_retry_policy
and the related test at the indicated later section, out of
TestCreateJobResponse into a dedicated ClavataClient transport/retry test class.
Add a shared fixture for the zero-sleep ClavataClient._retrying_http_client
monkeypatch and reuse it in both tests, preserving their existing assertions and
behavior.
nemoguardrails/library/clavata/request.py (1)

173-197: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Return ClosableHTTPClient from the retry helpers.
http_call(..., factory=...) requires Callable[[], ClosableHTTPClient], but both _retrying_http_client and _create_http_client are typed as HTTPClient. Narrow those return types here, or inline the RetryingHTTPClient construction, so the factory signature matches.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nemoguardrails/library/clavata/request.py` around lines 173 - 197, Update
_retrying_http_client and _create_http_client to return ClosableHTTPClient,
ensuring RetryingHTTPClient satisfies that type and the factory passed to
http_call matches Callable[[], ClosableHTTPClient]. Preserve the existing retry
policy and client construction behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@nemoguardrails/library/ai_defense/actions.py`:
- Around line 124-137: Validate that the value returned by response.json() is a
mapping before the existing "is_safe" handling in the AI Defense action. Treat
lists, strings, numbers, and other non-object JSON bodies as malformed, log the
appropriate fail_open/fail_closed warning, and set is_blocked according to that
policy; continue using the existing field validation for object responses.

In `@nemoguardrails/library/trend_micro/actions.py`:
- Around line 135-156: The fail-open handling does not cover outbound request
failures in both integrations. In nemoguardrails/library/trend_micro/actions.py
lines 135-156, move http_call into the try block and widen the exception
handling to cover transport, response decoding, and GuardResult validation
failures while preserving the allow fallback. In
nemoguardrails/library/pangea/actions.py lines 124-151, move http_call into the
existing try block so transport failures reach the current _pangea_outcome
fallback.

In `@tests/http/test_runtime.py`:
- Around line 35-38: Update the test around the factory.call_args assertions to
first verify that the factory was invoked exactly once, then inspect its kwargs
and retain the existing timeout, limits, and follow_redirects assertions.

---

Nitpick comments:
In `@nemoguardrails/library/autoalign/actions.py`:
- Around line 171-180: Extract the duplicated POST request and non-200 status
validation from the AutoAlign action flows into a shared
_autoalign_post(http_client, request_url, headers, request_body) helper. Have
the helper call http_call with the existing arguments, raise the same ValueError
including status code and response text, and return the successful response;
replace all three duplicated blocks, including those around the referenced
ranges, with calls to this helper.

In `@nemoguardrails/library/clavata/request.py`:
- Around line 173-197: Update _retrying_http_client and _create_http_client to
return ClosableHTTPClient, ensuring RetryingHTTPClient satisfies that type and
the factory passed to http_call matches Callable[[], ClosableHTTPClient].
Preserve the existing retry policy and client construction behavior.

In `@nemoguardrails/library/crowdstrike_aidr/actions.py`:
- Around line 137-163: Consolidate the duplicate fallback returns in the
response handling around GuardChatCompletionsResponse into one shared branch,
while retaining distinct logging as needed. Replace the broad `except Exception`
with handlers for the expected `HTTPClientError` and `ValidationError` cases,
alongside `HTTPStatusError`, and ensure all these failures return the same
`_crowdstrike_aidr_outcome` built from `GuardChatCompletionsResult`.

In `@nemoguardrails/library/f5/actions.py`:
- Around line 92-96: Update the docstring for f5_guardrails_scan to document the
http_client parameter in its Args section, including that callers may provide an
owned HTTP client and that it is used with the F5 retry policy; retain the
existing text and config documentation.

In `@tests/test_clavata_models.py`:
- Around line 278-320: Move the transport/retry tests, including
test_clavata_client_uses_shared_retry_policy and the related test at the
indicated later section, out of TestCreateJobResponse into a dedicated
ClavataClient transport/retry test class. Add a shared fixture for the
zero-sleep ClavataClient._retrying_http_client monkeypatch and reuse it in both
tests, preserving their existing assertions and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0cd009ab-0ab9-424e-8547-b32de9443b83

📥 Commits

Reviewing files that changed from the base of the PR and between 9b07054 and b02780f.

📒 Files selected for processing (39)
  • nemoguardrails/http/__init__.py
  • nemoguardrails/http/runtime.py
  • nemoguardrails/http/transport.py
  • nemoguardrails/http/types.py
  • nemoguardrails/library/ai_defense/actions.py
  • nemoguardrails/library/autoalign/actions.py
  • nemoguardrails/library/clavata/actions.py
  • nemoguardrails/library/clavata/errs.py
  • nemoguardrails/library/clavata/request.py
  • nemoguardrails/library/clavata/utils.py
  • nemoguardrails/library/crowdstrike_aidr/actions.py
  • nemoguardrails/library/f5/actions.py
  • nemoguardrails/library/fiddler/actions.py
  • nemoguardrails/library/hf_classifier/actions.py
  • nemoguardrails/library/hf_classifier/backends.py
  • nemoguardrails/library/pangea/actions.py
  • nemoguardrails/library/patronusai/actions.py
  • nemoguardrails/library/policyai/actions.py
  • nemoguardrails/library/prompt_security/actions.py
  • nemoguardrails/library/trend_micro/actions.py
  • nemoguardrails/testing/http.py
  • tests/http/test_contract.py
  • tests/http/test_library_boundary.py
  • tests/http/test_runtime.py
  • tests/http/test_testing.py
  • tests/http/test_transport.py
  • tests/http_utils.py
  • tests/test_ai_defense.py
  • tests/test_autoalign.py
  • tests/test_clavata.py
  • tests/test_clavata_models.py
  • tests/test_clavata_utils.py
  • tests/test_f5_guardrails.py
  • tests/test_fiddler_rails.py
  • tests/test_hf_classifier.py
  • tests/test_pangea_ai_guard.py
  • tests/test_patronus_evaluate_api.py
  • tests/test_policyai_rail.py
  • tests/test_prompt_security.py
💤 Files with no reviewable changes (3)
  • nemoguardrails/library/clavata/errs.py
  • nemoguardrails/library/clavata/utils.py
  • tests/test_clavata_utils.py

Comment thread nemoguardrails/library/ai_defense/actions.py
Comment thread nemoguardrails/library/trend_micro/actions.py Outdated
Comment thread tests/http/test_runtime.py
@Pouyanpi

Pouyanpi commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

Thank you @tgasser-nv for the review. Improved patch coverage to 100% and fixed those kwargs slops.

Pouyanpi added 7 commits July 30, 2026 10:14
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
@Pouyanpi
Pouyanpi merged commit d7b264f into develop Jul 30, 2026
15 checks passed
@Pouyanpi
Pouyanpi deleted the pouyanpi/rail-library-stack-13-http-action-migrations branch July 30, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XL status: triaged Triaged by a maintainer; eligible for automated review (CodeRabbit/Greptile).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants