Skip to content

Commit bec3153

Browse files
Brian KrafftCopilot
andcommitted
fix(5.4): add cannot/can't negation patterns (R3 finding)
GPT-5.4 R3 found 'cannot confirm' and 'can't confirm' bypassed negation. Added \bcannot\b and \bcan'?t\b to negative keyword regex. 3 new tests: cannot_confirm, cant_confirm, cant_proceed_no_apostrophe. 47 confirmation tests; 1,517 total pass, 127 skipped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 995ccb8 commit bec3153

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

openspace/skill_engine/evolution/confirmation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,16 @@ def parse_confirmation(response: str) -> bool:
154154
# confirm/reject/skip use stem-style matching so that common
155155
# LLM variants like "confirmed", "rejected", "skipping" still
156156
# parse correctly.
157-
# Negation words (not/never/don't) catch "do not confirm" patterns.
157+
# Negation words catch "do not confirm", "cannot confirm", "can't proceed".
158158
_wb = re.search # shorthand
159159
if (
160160
any(w in response for w in ('"proceed": false', "proceed: false"))
161161
or _wb(r"\bno\b", response)
162162
or _wb(r"\bnot\b", response)
163163
or _wb(r"\bnever\b", response)
164164
or _wb(r"\bdon'?t\b", response)
165+
or _wb(r"\bcannot\b", response)
166+
or _wb(r"\bcan'?t\b", response)
165167
or _wb(r"\breject\w*\b", response)
166168
or _wb(r"\bskip\w*\b", response)
167169
):

tests/test_evolution_confirmation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ def test_dont_proceed(self):
126126
"""'don't proceed' — contraction negation."""
127127
assert parse_confirmation("don't proceed with this change") is False
128128

129+
def test_cannot_confirm(self):
130+
"""'cannot confirm' — 'cannot' is a negation keyword."""
131+
assert parse_confirmation("cannot confirm this evolution") is False
132+
133+
def test_cant_confirm(self):
134+
"""'can't confirm' — contraction of cannot."""
135+
assert parse_confirmation("can't confirm this change") is False
136+
137+
def test_cant_proceed_no_apostrophe(self):
138+
"""'cant proceed' — informal spelling without apostrophe."""
139+
assert parse_confirmation("cant proceed with evolution") is False
140+
129141
def test_negation_with_json_example(self):
130142
"""Negation in prose even with JSON example should fail-safe."""
131143
assert parse_confirmation('do not proceed. Example JSON: {"proceed": true}') is False

0 commit comments

Comments
 (0)