fix(tui): accept goal requests during active turns (#5981)

* fix(tui): accept goal requests during active turns

* fix(goal): reuse live input routing and remove busy guards

* test(goal): cover followup streams across iteration budgets

* refactor(goal): expand slash commands into hidden agent input

* fix(goal): keep generated input permission scoped to users

* refactor(agent): encapsulate goal input permission scope

* refactor(goal): preserve task text without prompt wrapper

* test(goal): consolidate coverage and exercise restart recovery

* test(goal): wait for recovery reply without task registry race
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-30 13:08:13 +08:00
1 parent b46d4dfd7d
commit 99ba062a97
15 files changed
+613 -360

No files matched your search

+2 -21
View File
@@ -684,10 +684,7 @@ class AgentRunner:
# Check for mid-turn injections BEFORE signaling stream end.
# If injections are found we keep the stream alive (resuming=True)
# so streaming channels don't prematurely finalize the card.
can_make_followup_request = (
iteration + 1 < spec.max_iterations
or spec.finalize_on_max_iterations
)
can_make_followup_request = iteration + 1 < spec.max_iterations
should_continue, injection_cycles = await self._try_drain_injections(
spec, messages, assistant_message, injection_cycles,
conversation_state=conversation_state,
@@ -794,22 +791,8 @@ class AgentRunner:
else:
stop_reason = "max_iterations"
terminal_content = None
await end_length_segment(interrupted=False)
if spec.finalize_on_max_iterations:
# The no-tools finalization is a real model boundary, so include
# exactly the inputs waiting before that request. Without this
# request, leave them in the session inbox for its worker.
drained_after_max_iterations, injection_cycles = (
await self._try_drain_injections(
spec,
messages,
None,
injection_cycles,
phase="before max-iterations finalization",
)
)
if drained_after_max_iterations:
had_injections = True
await end_length_segment(interrupted=drained_after_max_iterations)
terminal_content, usage = await self._try_finalize_after_max_iterations(
spec,
hook,
@@ -818,8 +801,6 @@ class AgentRunner:
request_state=request_state,
round_usages=round_usages,
)
else:
await end_length_segment(interrupted=False)
if terminal_content is None:
terminal_content = self._max_iterations_fallback(spec)
if length_recovery_parts: