Skip to content

fix(ra1): keep double negatives from exempting the action - #957

Merged
rng1995 merged 1 commit into
NVIDIA:mainfrom
udsy19:fix/ra1-negating-gerund
Oct 31, 2026
Merged

rng1995 merged 1 commit into
NVIDIA:mainfrom
udsy19:fix/ra1-negating-gerund

Conversation

@udsy19

@udsy19 udsy19 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #956.

Impact: silent-wrong-result

Who reaches this: any skillspector scan (CLI or MCP scan_skill) through the static_patterns_rogue_agent analyzer, on a skill whose text puts a negating gerund between a negated recommendation verb and an RA1 phrase.

Triggered when: a line like Never recommend skipping `self-update` after an executable failure. appears in SKILL.md. The sentence instructs the self-update, but the _gerund branch of #929's object gap (src/skillspector/nodes/analyzers/static_patterns_rogue_agent.py:635) matches skipping and the whole line is treated as a prohibition.

What the user observes: on current main the scan reports no issues, score 0, SAFE, and --fail-on-findings exits 0. Before #929, and with this change, it reports RA1 HIGH Self-Modification, score 22, exit 1. The regression is not in a release yet.

Fix

The gerund branch now takes a closed list of verbs that perform the action (running, using, executing, invoking, ...) instead of [a-z]+ing, which matches how the classifier branch already works. #929's case Do not advise running `self-update` stays exempt. Any other gerund gets no exemption, which is the direction the existing comment asks for.

Tests

Three cases are added to test_affirmative_or_ungoverned_recommendation_still_flags in tests/nodes/analyzers/test_rogue_agent_negated_recommendation.py: skipping, delaying and avoiding.

Negative control: fix reverted, new tests kept:

pytest tests/nodes/analyzers/test_rogue_agent_negated_recommendation.py -k "skipping or delaying or avoiding"
3 failed, 17 deselected

With the fix: 3 passed, and the whole file gives 20 passed. The RA1/negation/prohibition tests in the neighbouring analyzer and unit test files give 497 passed. ruff check and ruff format --check are clean.

Signed-off-by: Udaya Tejas udayatejas2004@gmail.com

NVIDIA#929 lets a prohibition on recommending an action cover the action
when the words between them are proved object syntax. One branch of
that grammar accepted any "-ing" word as a gerund object, so a gerund
that negates the action also passed: "Never recommend skipping
`self-update`" instructs the self-update, yet RA1 dropped it as a
prohibition and the HIGH Self-Modification finding vanished.

Restrict the gerund branch to a closed list of verbs that perform the
action, in line with the default-deny grammar the rest of the gap uses.
"Do not advise running `self-update`" stays exempt.

Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>

@rng1995 rng1995 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.

[SkillSpector Review]

Value and readiness

The focused correction restores the reported detection while preserving the intended prohibition exemption. Ready for code approval.

Material findings

No required changes found. Replacing arbitrary [a-z]+ing with the closed action-performing vocabulary prevents skipping/delaying/avoiding from being consumed as proof of prohibition. All three reported double negatives now fail that exemption grammar. The existing Do not advise running self-update positive exemption and affirmative, separate-clause, arbitrary-action controls remain intact.

PIC tradeoffs

Unknown benign gerunds retain findings; this is the existing conservative fallback rather than a new suppression.

Verification and gaps

Read the complete two-file diff, pinned logical-line/clause/negation caller and complete 20-case test file, description, linked issue evidence and review/thread history. All six exact-head hosted checks succeeded. Findings are supported by source tracing; no before/after runtime score is independently claimed. No contributor code, tests, snippets, imports, builds, model calls or scanner invocations were executed.

Reviewed head: c1570d6361adb1425c8724a2d46a77b71c356ce2.

@rng1995
rng1995 merged commit 0eca236 into NVIDIA:main Oct 31, 2026
6 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.

RA1 negation exemption treats "never recommend skipping X" as a prohibition of X

2 participants