NVIDIA-NeMo / NVIDIA-NeMo/Guardrails
bug: missing "global $relevant_chunks" declaration in hf_classifier retrieval flows
@Pouyanpi is already working on this.
Since Jul 15, 2026.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 843
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 25
Description
Describe the bug
In the hf classifier check retrieval flow (Colang), the masked/transformed $relevant_chunks value is reassigned locally without a global declaration, so the transformation does not propagate outside the flow's local scope. This affects:
nemoguardrails/library/hf_classifier/flows.co(lines 24-25,flow hf classifier check retrieval $classifier)nemoguardrails/library/hf_classifier/flows.v1.co(matching retrieval subflow)
This is a pre-existing bug, unrelated to the RailOutcome migration in PR #2151, surfaced during review there.
Steps To Reproduce
- Configure a rail using
hf classifier check retrievalwith a classifier that triggers a transform (is_transform=True) on$relevant_chunks. - Observe that
$relevant_chunks = $response.transform_text["relevant_chunks"]is assigned withoutglobal $relevant_chunks. - Check downstream flow/action usage of
$relevant_chunksafter this subflow returns.
Expected Behavior
The transformed $relevant_chunks value should be visible to the calling flow/context after the subflow completes, since it's meant to update the shared retrieval context.
Actual Behavior
Because global $relevant_chunks is not declared before reassignment, the transform assignment stays scoped to the local flow and does not propagate to the caller/global context, so callers may still see the pre-transform value.
References
- PR: https://github.com/NVIDIA-NeMo/Guardrails/pull/2151
- Review comment: https://github.com/NVIDIA-NeMo/Guardrails/pull/2151#discussion_r3585336499
- Reported by: @Pouyanpi
Acceptance Criteria
- Add
global $relevant_chunksbefore the reassignment inflows.coandflows.v1.coretrieval transform branches. - Add/adjust a test confirming the transformed
$relevant_chunkspropagates to the caller context.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.