Merge remote-tracking branch 'origin/main' into main

Resolve the navigate() leaf conflict: keep the local two-stage navigation
refactor (descriptions, confirm_category_fit, create_skill removed from the
leaf softmax) and apply origin's compose_state intent on top.

origin/main (857ad1a) was not runnable as pushed:
- compose_state renamed its param to additional_context but its body still
  read `current` (NameError) and _navigate_canned called it with a stray
  `additional_context:` annotation (SyntaxError).
- the rename was not propagated to scheduler.py's two callers (TypeError).

Resolution:
- compose_state(request, additional_context=None) renders `({additional_context})`.
- canned + navigate leaf decisions pass
  additional_context=f"all choices are within the {category} category".
- scheduler.py builds its state inline to keep the exact
  `[current process: …]` wording for the interrupt/priority decisions.
This commit is contained in:
gabby committed 2026-10-01 20:16:43 +00:00
commit da53e1eefc
3 files changed
+18 -10

No files matched your search

+1 -1
View File
@@ -229,7 +229,7 @@ the request, the tree, the elicitation answers, the runtime **bridge catalog**
| `interrupt:choice` | `scheduler.py:279` | request text + `[current process: <skill>]` | `interrupt` / `defer` | | `interrupt:choice` | `scheduler.py:279` | request text + `[current process: <skill>]` | `interrupt` / `defer` |
| `priority:score` | `scheduler.py:296` | request text (+ `[current process: …]` when busy) | critical / high / medium / low | | `priority:score` | `scheduler.py:296` | request text (+ `[current process: …]` when busy) | critical / high / medium / low |
| `navigate:category` | `skills.py:682` | request text | every category name (+ `create_category`) | | `navigate:category` | `skills.py:682` | request text | every category name (+ `create_category`) |
| `navigate:leaf` | `skills.py:736` | request text + `[current process: <category>]` | every skill name + description (+ `create_skill`) | | `navigate:leaf` | `skills.py:736` | request text + current category | every skill name + description (+ `create_skill`) |
| `navigate:response` | `skills.py:634` | request text + category | canned reply names + descriptions (catchall last) | | `navigate:response` | `skills.py:634` | request text + category | canned reply names + descriptions (catchall last) |
| `navigate:intent` | `skills.py:811` | `Requested action: <text>` + `Action of the existing skill: <description>` | `same` / `different` | | `navigate:intent` | `skills.py:811` | `Requested action: <text>` + `Action of the existing skill: <description>` | `same` / `different` |
| `assess:outcome` | `skill.py:257` | skill label + goal + action log | `success` / `failure` | | `assess:outcome` | `skill.py:257` | skill label + goal + action log | `success` / `failure` |
+2 -3
View File
@@ -49,7 +49,6 @@ from .skills import (
SkillStore, SkillStore,
build_skills, build_skills,
build_tree, build_tree,
compose_state,
confirm_skill_fit, confirm_skill_fit,
generate_category, generate_category,
generate_skill, generate_skill,
@@ -273,7 +272,7 @@ class Scheduler:
def _interrupt_choice(self, request: Request, current: Process) -> bool: def _interrupt_choice(self, request: Request, current: Process) -> bool:
decision = DecisionRequest( decision = DecisionRequest(
state=compose_state(request, current=current.skill), state=f"{request.text} [current process: {current.skill}]",
question="Should this be allowed to interrupt the current process?", question="Should this be allowed to interrupt the current process?",
options=[ options=[
Option(CHOICE_INTERRUPT, "Yes, interrupt the current process."), Option(CHOICE_INTERRUPT, "Yes, interrupt the current process."),
@@ -290,7 +289,7 @@ class Scheduler:
def _priority_score(self, request: Request, current: str | None = None) -> tuple[float, str]: def _priority_score(self, request: Request, current: str | None = None) -> tuple[float, str]:
decision = DecisionRequest( decision = DecisionRequest(
state=compose_state(request, current=current), state=f"{request.text} [current process: {current}]",
question="How urgent is this request?", question="How urgent is this request?",
options=[Option(option_id, description) for option_id, description in URGENCY_OPTIONS], options=[Option(option_id, description) for option_id, description in URGENCY_OPTIONS],
) )
+15 -6
View File
@@ -471,10 +471,10 @@ def unresolved_variables(
return [name for name in (skill.contract or {}) if name not in merged] return [name for name in (skill.contract or {}) if name not in merged]
def compose_state(request: Request, current: str | None = None) -> str: def compose_state(request: Request, additional_context: str | None = None) -> str:
parts = [request.text] parts = [request.text]
if current: if additional_context:
parts.append(f"[current process: {current}]") parts.append(f"({additional_context})")
return " ".join(parts) return " ".join(parts)
@@ -654,7 +654,10 @@ def _navigate_canned(
if len(ordered) == 1: if len(ordered) == 1:
return ordered[0] return ordered[0]
leaf = DecisionRequest( leaf = DecisionRequest(
state=compose_state(request, current=category), state=compose_state(
request,
additional_context=f"all choices are within the {category} category",
),
question=( question=(
"Which canned response best fits this input? " "Which canned response best fits this input? "
f"Choose {ordered[-1].name} if none of the others does." f"Choose {ordered[-1].name} if none of the others does."
@@ -759,7 +762,10 @@ def navigate(
"skill_needed", "skill_needed",
request.id, request.id,
category=category, category=category,
state=compose_state(request, current=category), state=compose_state(
request,
additional_context=f"all choices are within the {category} category",
),
question="(this category has no skills yet)", question="(this category has no skills yet)",
options=[], options=[],
selected="create_skill", selected="create_skill",
@@ -771,7 +777,10 @@ def navigate(
# guard, which owns the reuse-vs-create decision. # guard, which owns the reuse-vs-create decision.
return skills[0] return skills[0]
leaf = DecisionRequest( leaf = DecisionRequest(
state=compose_state(request, current=category), state=compose_state(
request,
additional_context=f"all choices are within the {category} category",
),
question=f"Which {category} skill performs the action this request asks for?", question=f"Which {category} skill performs the action this request asks for?",
options=[Option(s.name, s.description) for s in skills], options=[Option(s.name, s.description) for s in skills],
) )