check actionability at the top of navigation
Move the actionability guard (confirm_non_action) to the top of navigate,
before category selection, instead of only firing when the category softmax
proposed response/create_category. A non-request now goes straight to the
closed response tree and never reaches the category softmax, and the category
softmax offers only real categories (the canned response tree is excluded), so
a request can never be canned and a non-request can never be routed into a
real category.
Reword the guard so vague/incomplete fragments ("what") count as non-action:
they previously matched none of the non_action cases and split the decision
(action 0.513 / non_action 0.487), so "what" authored a redundant
"unclear"/"clarify_intent" category. It now lands on the catchall
response.clarify.
Remove the now-dead CreateSkill-for-canned fallback and _canned_fallback.
Update AGENTS.md, the navigation unit tests, the tune_navigation eval set, and
add an integration test for the vague-fragment route.
This commit is contained in:
1 parent
80518dcdda
commit
1d9730bfcb
6 files changed
+220
-98
No files matched your search
@@ -40,7 +40,6 @@ from .skill import SkillRunner
|
||||
from .timers import TimerService
|
||||
from .skills import (
|
||||
CANNED_CATEGORIES,
|
||||
RESPONSE_FALLBACK,
|
||||
ActionContext,
|
||||
CategoryRegistry,
|
||||
CreateCategory,
|
||||
@@ -467,16 +466,6 @@ class Scheduler:
|
||||
if isinstance(navigation, CreateCategory):
|
||||
return self._dispatch_create_category(request, weight)
|
||||
if isinstance(navigation, CreateSkill):
|
||||
if navigation.category in CANNED_CATEGORIES:
|
||||
fallback = self._canned_fallback(navigation.category)
|
||||
if fallback is not None:
|
||||
self.trace.append(
|
||||
"canned_fallback",
|
||||
request.id,
|
||||
category=navigation.category,
|
||||
fallback=fallback.name,
|
||||
)
|
||||
return self._run_skill(fallback, request)
|
||||
return self._dispatch_skill(request, navigation.category, weight)
|
||||
if navigation.category in CANNED_CATEGORIES:
|
||||
return self._run_skill(navigation, request)
|
||||
@@ -492,14 +481,6 @@ class Scheduler:
|
||||
return self._dispatch_skill(request, navigation.category, weight)
|
||||
return self._run_skill(navigation, request)
|
||||
|
||||
def _canned_fallback(self, category: str) -> Skill | None:
|
||||
"""The catchall canned reply for a closed category, else its first leaf."""
|
||||
skills = self.tree.get(category, [])
|
||||
for skill in skills:
|
||||
if skill.name == RESPONSE_FALLBACK:
|
||||
return skill
|
||||
return skills[0] if skills else None
|
||||
|
||||
def _dispatch_create_category(
|
||||
self, request: Request, weight: float = 0.0
|
||||
) -> DispatchResult:
|
||||
|
||||
Reference in new issue
Block a user