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:
gabby committed 2026-10-05 21:44:18 +00:00
1 parent 80518dcdda
commit 1d9730bfcb
6 files changed
+220 -98

No files matched your search

+22
View File
@@ -172,6 +172,28 @@ def test_navigation_routes_noise_into_the_response_tree(tmp_path):
assert getattr(result, "category", None) == "response", f"noise left the response tree: {text!r}"
def test_navigation_routes_vague_fragment_to_clarify(tmp_path):
"""A fragment too vague to act on ("what") is non-action: it lands on the
catchall `response.clarify` rather than authoring a redundant clarify skill.
Regression: "what" scored action 0.513 / non_action 0.487 and authored an
"unclear"/"clarify_intent" category."""
config = load_config()
require_real(config)
_isolate_runtime(config, tmp_path)
scheduler, config = build_scheduler(config)
result = navigate(
scheduler.engine,
scheduler.log,
scheduler.trace,
Request("what"),
scheduler.tree,
)
print(f"[vague] 'what' -> {result!r}")
assert getattr(result, "category", None) == "response", result
assert getattr(result, "name", None) == "response.clarify", result
def test_navigation_routes_uncovered_requests_to_create(tmp_path):
"""A request no skill covers must author a skill, not get a canned reply: the
actionability guard keeps the closed `response` tree for non-request input
+70 -1
View File
@@ -625,7 +625,12 @@ def test_navigate_leaf_picks_among_existing_skills_only(tmp_path):
self.request = request
ids = [o.id for o in request.options]
return DecisionResult(request=request, option_ids=ids, probabilities=[1.0] * len(ids))
if "non_action" in ids:
# the top-level actionability guard: this input is a request
probs = [1.0 if o == "action" else 0.0 for o in ids]
else:
probs = [1.0] * len(ids)
return DecisionResult(request=request, option_ids=ids, probabilities=probs)
engine = Recording()
log = DecisionLog(str(tmp_path / "decisions.jsonl"))
@@ -878,6 +883,70 @@ def test_navigate_actionability_keeps_a_statement_in_response(tmp_path):
)
def test_navigate_actionability_gate_precedes_category_selection(tmp_path):
"""The actionability guard runs at the top: a non-request never reaches the
category softmax, so it cannot be routed into a real category even when the
softmax would have picked one."""
log = DecisionLog(str(tmp_path / "decisions.jsonl"))
trace = TraceLog(str(tmp_path / "runs.jsonl"))
tree = build_tree(build_skills({"skills": {}}))
tree["simplex"] = [
Skill(
name="next_message",
category="simplex",
description="Read the next SimpleX message.",
)
]
engine = _ProbEngine(
{
"non-request input": {"non_action": 1.0},
# If the category softmax ran it would route to simplex, not response.
"top-level category": {"simplex": 1.0},
"canned response": {"response.greeting": 1.0},
}
)
result = navigate(engine, log, trace, Request("the sky is blue"), tree)
assert getattr(result, "category", None) == "response"
assert all(
"top-level category" not in c.question for c in engine.calls
), "the category softmax must not run for non-request input"
phases = [r["extra"]["phase"] for r in log.read()]
assert "navigate:actionability" in phases
assert "navigate:category" not in phases
assert phases.index("navigate:actionability") < phases.index("navigate:response")
def test_navigate_category_softmax_excludes_the_canned_response_tree(tmp_path):
"""Once actionability is decided at the top, `response` is never offered in
the category softmax — a request cannot be routed to a canned reply — and
actionability is logged before category selection."""
log = DecisionLog(str(tmp_path / "decisions.jsonl"))
trace = TraceLog(str(tmp_path / "runs.jsonl"))
tree = build_tree(build_skills({"skills": {}}))
tree["simplex"] = [
Skill(
name="next_message",
category="simplex",
description="Read the next SimpleX message.",
)
]
engine = _ProbEngine(
{
"top-level category": {"simplex": 1.0},
"Does the scope": {"covers": 1.0},
}
)
navigate(engine, log, trace, Request("read the next simplex message"), tree)
cat_decision = next(
c for c in engine.calls if "top-level category" in c.question
)
ids = [o.id for o in cat_decision.options]
assert "response" not in ids
assert "simplex" in ids and "create_category" in ids
phases = [r["extra"]["phase"] for r in log.read()]
assert phases.index("navigate:actionability") < phases.index("navigate:category")
def test_dispatch_action_tau_controls_catchall_routing(tmp_path):
"""navigation.action_tau is the catchall create door, separate from the other
taus: a borderline non-action verdict flips on it."""