chain multi-step requests across known skills
Add the run-ledger chained-run path and make a compound request run its known skills in order instead of authoring one monolithic skill. - scheduler/skill: `assess:outcome` gains a `continue` verdict; a continued step is re-dispatched with a bounded run ledger (max_reentries + a monotonic-progress guard), and the ledger is rendered into the routing and assessment state. - navigation leaf guard (`confirm_skill_fit`) becomes same/part/different and is ledger-aware, so the first step of a compound request runs instead of being rejected into `create_skill` (a real run picked calculator.calculate at 0.99 and was rejected into create_skill). - results flow forward through `request.run_ledger` (`last_result` helper); `simplex.send_message` sends the prior step's result rather than asking the LLM bridge to recompute it. Documented in CODEGEN.md. - `assess:outcome` stays the sole continuation authority: the guard only decides whether a skill contributes, never forces a continuation (a forced continue on `part` overrode a correct `done` on the final step and authored a spurious category). - verbosity levels, structured SchedulerReply fields, and a send_message hermetic test for the chained-result path.
This commit is contained in:
1 parent
9ba14fdab0
commit
ab0defca1e
20 files changed
+1046
-324
No files matched your search
@@ -313,10 +313,11 @@ class GatewayService:
|
||||
reply = self.scheduler.answer(msg.text)
|
||||
if self.scheduler.pending is None:
|
||||
self._pending_owner = None
|
||||
self._reply(
|
||||
*reply_to, reply.text, kind=_reply_kind(reply.status),
|
||||
skill_ref=reply.skill_ref, result=reply.result,
|
||||
)
|
||||
if not self._hidden(reply):
|
||||
self._reply(
|
||||
*reply_to, reply.text, kind=_reply_kind(reply.status),
|
||||
skill_ref=reply.skill_ref, result=reply.result,
|
||||
)
|
||||
elif pending is not None and self._pending_owner not in (None, reply_to):
|
||||
self._reply(
|
||||
*reply_to,
|
||||
@@ -348,10 +349,11 @@ class GatewayService:
|
||||
self._owners[reply.run_id] = reply_to
|
||||
if reply.status == "needs_input":
|
||||
self._pending_owner = reply_to
|
||||
self._reply(
|
||||
*reply_to, reply.text, kind=_reply_kind(reply.status),
|
||||
skill_ref=reply.skill_ref, result=reply.result,
|
||||
)
|
||||
if not self._hidden(reply):
|
||||
self._reply(
|
||||
*reply_to, reply.text, kind=_reply_kind(reply.status),
|
||||
skill_ref=reply.skill_ref, result=reply.result,
|
||||
)
|
||||
self.drain()
|
||||
self.surface(origin=reply_to)
|
||||
|
||||
@@ -362,6 +364,8 @@ class GatewayService:
|
||||
if not results:
|
||||
break
|
||||
for reply in results:
|
||||
if self._hidden(reply):
|
||||
continue
|
||||
owner = self._owner_of(reply.run_id)
|
||||
if reply.status == "needs_input" and owner:
|
||||
self._pending_owner = owner
|
||||
@@ -372,6 +376,17 @@ class GatewayService:
|
||||
skill_ref=reply.skill_ref, result=reply.result,
|
||||
)
|
||||
|
||||
def _hidden(self, reply) -> bool:
|
||||
"""Hide an intermediate chain step at `result` verbosity.
|
||||
|
||||
The default end-user view is just the final answer; a chained request's
|
||||
intermediate "continue" steps are only surfaced at `query`/`decision`
|
||||
verbosity.
|
||||
"""
|
||||
if not getattr(reply, "intermediate", False):
|
||||
return False
|
||||
return getattr(self.scheduler, "verbosity", "result") == "result"
|
||||
|
||||
def surface(self, origin: Target | None = None) -> None:
|
||||
"""Send any newly posted authoring questions / repair offers."""
|
||||
questions = self.scheduler.pending_questions()
|
||||
|
||||
Reference in new issue
Block a user