routing: send unlearned actions to codegen, fix gate + repair loop

SemIf routing only sees option descriptions, but the leaf fallback said
'Suggest creating a new skill' (mechanism, not trigger), so a send request
had no verb match and fell through to the read skill that shared the word
'message'. Every send phrasing picked simplex.next_message; create_skill
scored ~0.03 and codegen was never reached.

- navigate: reword the create_skill fallback to the trigger ('No existing
  skill performs this action') and make the criterion ask which skill
  performs the requested action. Sends now route to create_skill at P~0.93.
- confirm_skill_fit: one action-vs-action SemIf guard (phase navigate:intent)
  after routing; a mismatch authors a new leaf instead of silently running the
  wrong skill. Wording tuned on the real model (no IM hint: it over-fires).
- gate: imperative tasks are actionable even with no matching skill, so a
  casually phrased send is no longer dropped as 'no actionable request'.
- finish_run: a failure whose retry is refused by the reentry budget still
  surfaces a repair offer.

Validated on jarvis: gate accepts all tasks/rejects all noise, sends route to
CreateSkill, reads still route to their skills. Dev: 265 passed; jarvis
non-codegen integration: 6 passed.
This commit is contained in:
Denton Social committed 2026-09-28 20:34:59 -05:00
1 parent 5589358de2
commit 13a512cc31
4 files changed
+294 -15

No files matched your search

+64 -2
View File
@@ -574,10 +574,14 @@ def navigate(
)
return CreateCategory()
skills = tree[category]
create_skill = Option("create_skill", "Suggest creating a new skill.")
create_skill = Option(
"create_skill",
"No existing skill performs this action; create a new skill for it.",
)
leaf = DecisionRequest(
state=compose_state(request, current=category),
question=f"Within {category}, which skill?",
question=f"Which {category} skill performs the action this request asks for? "
"Choose create_skill if none does.",
options=[Option(s.name, s.description) for s in skills] + [create_skill],
)
if not skills:
@@ -610,6 +614,64 @@ def navigate(
return next(s for s in skills if s.name == pick)
def confirm_skill_fit(
engine: SemIfEngine,
log: DecisionLog,
trace: TraceLog,
request: Request,
skill: Skill,
tau: float = 0.6,
) -> bool:
"""Does this skill's action actually match what the request asks for?
Navigation picks the closest leaf; a seeded read skill can outscore the
generic "create a new skill" branch on a request whose verb (send) no
existing action performs. This one SemIf decision guards against silently
running the wrong skill: a mismatch sends dispatch to author a new leaf
instead. Wording tuned against the real model: comparing the two *actions*
("different action") is unambiguous where "can this serve the request" was
not — e.g. "message Sam" (an implicit send in instant-messaging syntax)
reads as a different action from "read the next message". Do not add an
instant-messaging context hint: it over-fires and pulls read phrasings to
the send side.
"""
decision = DecisionRequest(
state=(
f"Requested action: {request.text}\n"
f"Action of the existing skill: {skill.description}"
),
question="Compare the requested action and the skill's action. Are they the same action?",
options=[
Option("same", "Same action."),
Option(
"different",
"Different action: the skill does not do what the user asks.",
),
],
)
result = engine.call(decision)
log.append(
decision,
result,
extra={
"phase": "navigate:intent",
"run_id": request.id,
"skill": f"{skill.category}.{skill.name}",
},
)
fits = result.prob("same") >= tau
trace.append(
"intent_guard",
request.id,
category=skill.category,
skill=skill.name,
selected=result.selected,
probs=result.probs,
fits=fits,
)
return fits
def tree_summary(tree: dict[str, list[Skill]]) -> str:
lines = []
for category in sorted(tree):