Skip to content

Guardrails: migrate guardrails to the v1/checks endpoint - #1161

Merged
leseb merged 1 commit into
praxis-proxy:mainfrom
liavweiss:guardrails/v1-checks-migration
Sep 17, 2026
Merged

leseb merged 1 commit into
praxis-proxy:mainfrom
liavweiss:guardrails/v1-checks-migration

Conversation

@liavweiss

@liavweiss liavweiss commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Migrate the ai_guardrails NeMo provider from /v1/guardrail/checks to /v1/checks
  • Parse the new response shape (passed / blocked / modified + content + rail)
  • Evaluate each user/assistant message with cumulative context (one NeMo call per message)
  • Map provider HTTP errors to fail-closed behavior (replaces in-body "error" status)

Breaking change

NeMo endpoint URLs in proxy config must use /v1/checks instead of /v1/guardrail/checks.

Out of scope

Test plan

  • cargo test -p praxis-ai-filters guardrails (70 tests)
  • cargo test -p praxis-tests-integration guardrails (35 tests)
  • A real nemo test with a real v1/chat/completion passing forward the ai_guardrails filter.

close: #1044

@liavweiss
liavweiss requested review from a team, asaadbalum and christinaexyou September 14, 2026 12:02
@liavweiss
liavweiss force-pushed the guardrails/v1-checks-migration branch from 6d04d43 to 18b9204 Compare September 14, 2026 12:40

@praxis-bot praxis-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PR Review

Migrates the NeMo guardrails provider from /v1/guardrail/checks to /v1/checks, parsing the new response shape and issuing cumulative per-message evaluations.

Assessment

Clean migration with solid test coverage for the new response mapping and cumulative evaluation logic. Two findings.

Severity Count
Large 1
Medium 1

Comment thread filters/src/guardrails/providers/nemo.rs Outdated
Comment thread filters/src/guardrails/providers/nemo.rs

@leseb leseb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

P1 – modified short-circuits evaluation. A modified earlier message causes later blocked messages to go unchecked and pass through.

P1 – wrong NeMo rail direction. Mixed user/assistant history auto-runs both rail types; request-phase modifications can be reported as passed. Send phase-specific rail_types.

P1 – unbounded callout amplification. One request can trigger arbitrarily many sequential NeMo calls, each with its own timeout. Add a call limit or overall deadline.

Comment thread filters/src/guardrails/providers/mod.rs
@liavweiss
liavweiss force-pushed the guardrails/v1-checks-migration branch 2 times, most recently from 10a2db9 to ef1bb3b Compare September 15, 2026 13:48
@liavweiss

Copy link
Copy Markdown
Contributor Author

P1 – modified short-circuits evaluation. A modified earlier message causes later blocked messages to go unchecked and pass through.

Addressed - modified no longer short-circuits the loop; only blocked fails fast. See apply_slice_result.

P1 – wrong NeMo rail direction. Mixed user/assistant history auto-runs both rail types; request-phase modifications can be reported as passed. Send phase-specific rail_types.

Addressed - we now send explicit rail_types (["input"] for request phase, ["output"] for response phase) to prevent NeMo from auto-running both rail families on mixed-role slices.

P1 – unbounded callout amplification. One request can trigger arbitrarily many sequential NeMo calls, each with its own timeout. Add a call limit or overall deadline.

Addressed - same max_message_checks limit as item 1.

@liavweiss
liavweiss force-pushed the guardrails/v1-checks-migration branch from ef1bb3b to f9c80bf Compare September 15, 2026 14:29
@leseb

leseb commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

@liavweiss

P1: timeout_ms restarts for each of up to 32 sequential calls, permitting roughly 320 seconds total by default. Use one overall evaluation deadline.
P2: Valid NeMo modified responses with empty content are rejected. Empty-string redaction must be accepted; only a missing field should fail.
P2 docs: Document the NeMo v0.24+ requirement and the new max_message_checks: 32 fail-closed limit.
P3: Example and PR description still reference #579; the correct redaction issue is #49.

@liavweiss
liavweiss force-pushed the guardrails/v1-checks-migration branch from f9c80bf to c619c09 Compare September 16, 2026 11:38
@liavweiss

Copy link
Copy Markdown
Contributor Author

@liavweiss

P1: timeout_ms restarts for each of up to 32 sequential calls, permitting roughly 320 seconds total by default. Use one overall evaluation deadline.
P2: Valid NeMo modified responses with empty content are rejected. Empty-string redaction must be accepted; only a missing field should fail.
P2 docs: Document the NeMo v0.24+ requirement and the new max_message_checks: 32 fail-closed limit.
P3: Example and PR description still reference #579; the correct redaction issue is #49.

Done.
Regarding the "only a missing field should fail." - nemo will always return the content field.

@liavweiss
liavweiss force-pushed the guardrails/v1-checks-migration branch from c619c09 to a94d2ee Compare September 16, 2026 12:04
@leseb

leseb commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

@liavweiss lint is failing

@leseb
leseb enabled auto-merge September 16, 2026 12:50
Signed-off-by: Liav Weiss <lweiss@redhat.com>
auto-merge was automatically disabled September 17, 2026 07:06

Head branch was pushed to by a user without write access

@liavweiss
liavweiss force-pushed the guardrails/v1-checks-migration branch from a94d2ee to 26a6a9a Compare September 17, 2026 07:06
@leseb
leseb enabled auto-merge September 17, 2026 09:14
@leseb
leseb added this pull request to the merge queue Sep 17, 2026
Merged via the queue into praxis-proxy:main with commit c9983b9 Sep 17, 2026
26 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.

feat(ai_guardrails) - Migrate NeMo provider to /v1/checks

4 participants