mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-06 22:32:39 +02:00
Stabilize HITL bundle UX and resume.
This commit is contained in:
parent
972650909c
commit
0af2c28a8d
12 changed files with 553 additions and 184 deletions
|
|
@ -22,7 +22,12 @@ def hitlrequest_action_count(pending_value: Any) -> int:
|
|||
|
||||
|
||||
def fan_out_decisions_to_match(resume_value: Any, expected_count: int) -> Any:
|
||||
"""Pad a single-decision resume to N entries so an ``action_requests=N`` bundle accepts it."""
|
||||
"""Legacy fallback: pad a 1-decision resume to N for an ``action_requests=N`` bundle.
|
||||
|
||||
Modern frontend submits N decisions per bundle (one per action_request) so
|
||||
this is a no-op; kept for backwards compatibility with old in-flight
|
||||
threads or non-bundle clients that send a single decision.
|
||||
"""
|
||||
if expected_count <= 1:
|
||||
return resume_value
|
||||
if not isinstance(resume_value, dict):
|
||||
|
|
|
|||
|
|
@ -139,13 +139,6 @@ def build_task_tool_with_parent_config(
|
|||
if resume_value is not None:
|
||||
expected = hitlrequest_action_count(pending_value)
|
||||
resume_value = fan_out_decisions_to_match(resume_value, expected)
|
||||
logger.info(
|
||||
"Forwarding surfsense_resume_value into subagent %r "
|
||||
"(action_requests=%d, targeted_id=%s)",
|
||||
subagent_type,
|
||||
expected,
|
||||
pending_id is not None,
|
||||
)
|
||||
result = subagent.invoke(
|
||||
build_resume_command(resume_value, pending_id),
|
||||
config=sub_config,
|
||||
|
|
@ -211,13 +204,6 @@ def build_task_tool_with_parent_config(
|
|||
if resume_value is not None:
|
||||
expected = hitlrequest_action_count(pending_value)
|
||||
resume_value = fan_out_decisions_to_match(resume_value, expected)
|
||||
logger.info(
|
||||
"Forwarding surfsense_resume_value into subagent %r "
|
||||
"(action_requests=%d, targeted_id=%s)",
|
||||
subagent_type,
|
||||
expected,
|
||||
pending_id is not None,
|
||||
)
|
||||
result = await subagent.ainvoke(
|
||||
build_resume_command(resume_value, pending_id),
|
||||
config=sub_config,
|
||||
|
|
|
|||
|
|
@ -13,4 +13,15 @@ later in this system prompt, after citation rules).
|
|||
|
||||
Do not treat live third-party state as if it were already in the indexed knowledge
|
||||
base; reach it via **task**.
|
||||
|
||||
Never emit more than one **task** tool call in the same turn. Bundle related work
|
||||
for the same specialist into a single **task** invocation (the subagent itself can
|
||||
call its own tools in parallel inside that one run). Parallel **task** calls would
|
||||
fan out into multiple concurrent subagent runs whose human-approval interrupts
|
||||
cannot be coordinated; one **task** at a time is required.
|
||||
</tool_routing>
|
||||
|
||||
<!-- TODO: lift the single-task constraint once the runtime supports parallel task
|
||||
interrupts end-to-end (multi-interrupt SSE + interrupt-id-keyed Command(resume)
|
||||
+ keyed surfsense_resume_value side-channel). Until then this nudge is the only
|
||||
guard; the parent graph's resume cannot address multiple pending interrupts. -->
|
||||
Loading…
Add table
Add a link
Reference in a new issue