refactor(self-check): name the rail selector variant end-to-end#2182
Conversation
The self-check flow passed its $variant value into the action as task=, so the action signature read self_check_input(task=...) while the config-facing selector is $variant=. Rename the carrier to variant across the flow-to-action boundary: both flows.co calls (variant=$variant), both action signatures (task -> variant), and resolve_self_check_task input parameter. The resolved value stays task from resolve_self_check_task return onward, since it keys the prompt template and model routing. The action parameter is unreleased (added with the multiple-self-check feature), so no compatibility path is needed.
Greptile SummaryThis PR renames the parameter that carries the rail selector value from
|
| Filename | Overview |
|---|---|
| nemoguardrails/library/self_check/input_check/flows.co | Renames the action kwarg from task=$variant to variant=$variant to align the call-site with the config-facing selector name. |
| nemoguardrails/library/self_check/output_check/flows.co | Same rename as input flows: task=$variant → variant=$variant in the SelfCheckOutputAction call. |
| nemoguardrails/library/self_check/input_check/actions.py | Action parameter renamed from task to variant; resolved value is still stored as task before being forwarded to prompt/model routing — semantics unchanged. |
| nemoguardrails/library/self_check/output_check/actions.py | Mirrors input action: parameter renamed from task to variant, downstream task local variable and routing logic untouched. |
| nemoguardrails/library/self_check/utils.py | First positional parameter of resolve_self_check_task renamed from task to variant; early-return guard and all internal logic carry through correctly. |
| tests/test_multiple_self_check_rails.py | Test helper _resolve_input_task and all call sites updated from task= to variant= keyword argument; no test logic changed. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Flow as flows.co
participant Action as self_check_input/output
participant Resolve as resolve_self_check_task
participant Run as run_self_check_task
Flow->>Action: "SelfCheckInputAction(variant=$variant)"
Note over Flow,Action: renamed from task= to variant=
Action->>Resolve: resolve_self_check_task(variant, context, events, ...)
Note over Action,Resolve: first param renamed task→variant
Resolve-->>Action: task (resolved string)
Note over Resolve,Action: return value still called "task"
Action->>Run: "run_self_check_task(task=task, ...)"
Run-->>Action: (is_safe, response)
Action-->>Flow: RailOutcome.allow() / .block()
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Flow as flows.co
participant Action as self_check_input/output
participant Resolve as resolve_self_check_task
participant Run as run_self_check_task
Flow->>Action: "SelfCheckInputAction(variant=$variant)"
Note over Flow,Action: renamed from task= to variant=
Action->>Resolve: resolve_self_check_task(variant, context, events, ...)
Note over Action,Resolve: first param renamed task→variant
Resolve-->>Action: task (resolved string)
Note over Resolve,Action: return value still called "task"
Action->>Run: "run_self_check_task(task=task, ...)"
Run-->>Action: (is_safe, response)
Action-->>Flow: RailOutcome.allow() / .block()
Reviews (1): Last reviewed commit: "refactor(self-check): name the rail sele..." | Re-trigger Greptile
📝 WalkthroughWalkthroughSelf-check input and output actions and flows now use ChangesSelf-check variant handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Description
The self-check flow passed its $variant value into the action as task=, so the action signature read self_check_input(task=...) while the config-facing selector is $variant=. Rename the carrier to variant across the flow-to-action boundary: both flows.co calls (variant=$variant), both action signatures (task -> variant), and resolve_self_check_task input parameter. The resolved value stays task from resolve_self_check_task return onward, since it keys the prompt template and model routing. The action parameter is unreleased (added with the multiple-self-check feature), so no compatibility path is needed.
follow-up on #2175
Related Issue(s)
#2175
Verification
AI Assistance
Checklist
Summary by CodeRabbit