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

+20 -7
View File
@@ -46,6 +46,7 @@ from .skills import (
build_skills,
build_tree,
compose_state,
confirm_skill_fit,
generate_category,
generate_skill,
materialize_skill,
@@ -82,10 +83,10 @@ def build_gate_decision(request: Request, tree: dict[str, list[Skill]]) -> Decis
capabilities = tree_summary(tree)[:GATE_CAPABILITY_CHARS] or " (none yet)"
state = (
f"User input: {request.text}\n"
"[Context: the user is talking to a personal task agent and expects it to "
"handle this input. The agent performs real tasks through its skills; "
"reading or looking up information from a configured service is a real "
"task, not small talk.]\n"
"[Context: the user is talking to a personal task agent. Any imperative "
"request to perform a task — send, message, tell, check, create, remind, "
"or look something up — must be handled, even if no skill matches yet. "
"Only chatter, thanks, and bare greetings should be ignored.]\n"
f"[Available skills:\n{capabilities}]"
)
return DecisionRequest(
@@ -94,8 +95,8 @@ def build_gate_decision(request: Request, tree: dict[str, list[Skill]]) -> Decis
options=[
Option(
GATE_YES,
"Yes — do what it asks, including looking something up or "
"reporting information using the agent's skills.",
"Yes — do what it asks, including looking something up, reporting "
"information, or performing an action using the agent's skills.",
),
Option(
"no",
@@ -462,6 +463,16 @@ class Scheduler:
return self._dispatch_skill(request, created.skill, weight)
if isinstance(navigation, CreateSkill):
return self._dispatch_skill(request, navigation.category, weight)
if not confirm_skill_fit(
self.engine, self.log, self.trace, request, navigation, self.tau
):
self.trace.append(
"intent_mismatch",
request.id,
selected_skill=f"{navigation.category}.{navigation.name}",
chosen="create_skill",
)
return self._dispatch_skill(request, navigation.category, weight)
return self._run_skill(navigation, request)
def _dispatch_skill(
@@ -633,13 +644,15 @@ class Scheduler:
action_log=outcome.action_log,
updated_request=outcome.updated_request,
)
requeued = False
if outcome.updated_request and request.reentries < self.max_reentries:
child = _requeue(request, outcome.updated_request)
self.queue.push(child, 0.5)
self.trace.append("requeued", request.id, text=outcome.updated_request)
if self.on_request_requeued is not None:
self.on_request_requeued(request.id, child.id)
if not outcome.success and not outcome.updated_request:
requeued = True
if not outcome.success and not (outcome.updated_request and requeued):
self._propose_repair(skill, request, outcome)
return DispatchResult(
kind="ran",