diff --git a/openspace/skill_engine/evolver.py b/openspace/skill_engine/evolver.py index 4dca928..ad9afdc 100644 --- a/openspace/skill_engine/evolver.py +++ b/openspace/skill_engine/evolver.py @@ -652,15 +652,21 @@ class SkillEvolver: return bool(data.get("proceed", False)) except (json.JSONDecodeError, ValueError): pass - # Fallback: look for keywords (use word boundaries to avoid - # false positives from substrings like "know" matching "no") + # Fallback: look for keywords. + # - yes/no use strict word boundaries to avoid false positives + # (e.g. "know" matching "no"). + # - confirm/reject/skip use stem-style matching so that common + # LLM variants like "confirmed", "rejected", "skipping" still + # parse correctly. _wb = re.search # shorthand if any(w in response for w in ("\"proceed\": true", "proceed: true")) \ - or _wb(r"\byes\b", response) or _wb(r"\bconfirm\b", response): + or _wb(r"\byes\b", response) \ + or _wb(r"\bconfirm\w*\b", response): return True if any(w in response for w in ("\"proceed\": false", "proceed: false")) \ - or _wb(r"\bno\b", response) or _wb(r"\breject\b", response) \ - or _wb(r"\bskip\b", response): + or _wb(r"\bno\b", response) \ + or _wb(r"\breject\w*\b", response) \ + or _wb(r"\bskip\w*\b", response): return False # Default: skip — ambiguous response should not trigger costly evolution logger.debug("LLM confirmation response was ambiguous, defaulting to skip")