fix(guardrails): treat both Text and Prompts as the text-only attachment scope - #1112
Open
apetraru-uipath wants to merge 1 commit into
Open
apetraru-uipath wants to merge 1 commit into
apetraru-uipath wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Updates guardrail attachment scoping to recognize both Text and legacy Prompts values as text-only scopes.
Changes:
- Added case-insensitive support for both scope values.
- Expanded tests across both attachment-resolution entry points.
- Bumped version to
0.18.15.
| File | Description |
|---|---|
uv.lock |
Synchronizes the locked package version. |
tests/agent/guardrails/test_attachment_refs.py |
Adds comprehensive scope behavior tests. |
src/uipath_langchain/agent/guardrails/attachment_refs.py |
Handles both text-only scope values. |
pyproject.toml |
Updates the package version. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
apetraru-uipath
force-pushed
the
fix/guardrail-applies-to-text
branch
from
September 23, 2026 21:29
8a2be51 to
cad34af
Compare
|
The backend renamed the text-only appliesTo value from Prompts to Text. The scope check here was a deny-list -- anything that was not the text-only spelling included files -- so the rename alone would have made a guardrail saved as "Prompts" start forwarding the run's files to a validator its author scoped to text. Matching a deny-list also puts the fail-open direction on the widening side: any value this version does not recognise resolves to "files apply". Match an allow-list of the scopes that include files instead. Only Files and Both forward references; every other present value resolves to text only. That covers the pre-rename Prompts spelling without naming it as a supported value, and covers any scope a newer backend introduces. An absent parameter is deliberately left alone: it carries no choice to respect, so the backend's per-validator default still decides. An empty or whitespace-only value is treated as absent, matching the backend, so both sides agree on which guardrails forward references. appliesTo has only ever been offered on alpha -- EnableGuardrailAttachments and EnableGuardrailLlmAsJudgeAttachments both default to false and have a flag file in the alpha ring only, and the definitions endpoint strips the parameter wherever file support is off -- so Prompts needs no compatibility guarantee, only a non-widening resolution. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apetraru-uipath
force-pushed
the
fix/guardrail-applies-to-text
branch
from
September 24, 2026 07:52
cad34af to
1dad60b
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What changed
_scope_includes_filesinsrc/uipath_langchain/agent/guardrails/attachment_refs.pydecides whether a built-in guardrail gets attachment references forwarded with its evaluation, by reading the guardrail'sappliesToparameter.It was a deny-list: anything that was not the text-only spelling included files. It is now an allow-list of the scopes that include files —
{"files", "both"}— so every other present value resolves to text only.Why an allow-list
The backend is renaming the text-only
appliesTovalue fromPromptstoText(UiPath/Agents#6385). A deny-list makes the rename itself a regression: a guardrail saved asPromptsstops matching, falls through to "files apply", and starts forwarding the run's files to a validator its author scoped to text.It also puts the fail-open direction on the widening side. Any value this version does not recognise — an older spelling, or a scope a newer backend introduces — resolved to "files apply". For a guardrail, a value we cannot interpret should narrow, not widen.
The allow-list covers the pre-rename
Promptsspelling without naming it as a supported value, and covers whatever comes next.What is deliberately not changed
An absent parameter still keeps files in scope. Absence carries no author choice to respect, so the backend's per-validator default decides —
Bothfor LLM-as-Judge, which shipped together with file support,Textfor the other five. An empty or whitespace-only value is treated as absence for the same reason, matching the backend so both sides agree on which guardrails forward references.The broad
exceptstill keeps files in scope too: the guardrail node re-raises, so a malformed parameter must not end the run, and an unreadable config is closer to absence than to an explicit narrow choice.The case-insensitive parameter-id match is untouched.
Why
Promptsneeds no compatibility guaranteeappliesTohas only ever been reachable on alpha.EnableGuardrailAttachmentsandEnableGuardrailLlmAsJudgeAttachmentsboth haveDefaultValue => falseand a flag file in the alpha ring only — none of the other eight rings has one — and where file support is off,GuardrailsRegistry.WithoutFileSupportWhenDisabledstripsappliesTofrom the definitions endpoint, so no designer outside alpha could ever have written the value. There are no customers to stay compatible with; what the value needs is a resolution that does not widen, which this gives it.Behaviour today
Neutral in every currently reachable configuration. Nothing outside alpha stores
appliesToat all, and helix independently drops references for a text-only guardrail, so no evaluation has ever been mis-judged. What changes is that the runtime stops forwarding references an author scoped out — wasted resolution and payload on every evaluation — and stops treating an uninterpretable scope as permission to read files.Tests
tests/agent/guardrails/test_attachment_refs.pykeeps the shared_SCOPE_CASESlist, exercised against both public entry points (resolve_guardrail_attachmentsandresolve_referenced_attachments):"Text","text"," TEXT ","Prompts","prompts"," PROMPTS ","something-we-never-shipped""Files","files"," FILES ","Both","both",""," ", and a guardrail carrying noappliesToparameter at allThe
Promptsrows are the regression guard: not a supported value any more, but it must still resolve to text only rather than to the files-included default.Gates:
pytest tests/agent/guardrails/377 passed;ruff check,ruff format --checkandmypyclean. Patch version bumped to 0.18.15.🤖 Generated with Claude Code