Skip to content

Agent UI: status line keeps showing "Calling <tool>..." after the tool result has arrived #376

Description

@Ron-Brouwer

Which component is this issue related to?

Umbraco.AI.Agent (Umbraco.AI.Agent.UI - chat run controller / uai-agent-status)

Which Umbraco AI version are you using?

Umbraco.AI.Agent.UI 17.1.0-rc.3 (Umbraco.AI 17.4.0-rc.3, Umbraco.AI.Agent 17.2.0-rc.3, Umbraco.AI.Agent.Copilot 17.1.0-rc.3, Umbraco CMS 17.6.2). The same code is on v18/dev.

Bug summary

After a backend tool call has returned its result, the status line under the chat keeps showing Calling <tool>... for as long as the model is generating its next turn. The tool call itself is already rendered with a completed tick, so the two indicators contradict each other: the tick says "done", the caption says "still calling". The caption only changes when the next tool call starts or the run finishes.

On a long step (the model reading a large get_umbraco_content or get_context_resource result and then writing a long answer, or preparing a big set_value payload) this lasts a minute or more, during which editors believe the tool is hanging and reach for Cancel.

Specifics

Umbraco.AI.Agent.UI/src/Umbraco.AI.Agent.UI/Client/src/chat/services/run.controller.ts (line numbers for tag Umbraco.AI.Agent.UI@17.1.0-rc.3; v18/dev in brackets):

  • onToolCallStart sets this.#agentState.next({ status: "executing", currentStep: \Calling ${info.name}...` })` - lines 326 and 353 [275, 302].
  • onToolCallResult → #handleServerToolResult (line 418 [367]) marks the tool call completed and appends the tool message, but never touches #agentState.
  • onTextStart / onTextDelta / onTextEnd (lines 249–294 [198–]) never touch #agentState either.
  • #agentState is only replaced by the next onToolCallStart, by onStateSnapshot, or cleared in #handleRunFinished.

chat/components/agent-status.element.ts renders state.currentStep ?? defaultLabel. While the state object from the last onToolCallStart is still current, the caption stays Calling <tool>... even though the tool call's own status in the message list is already completed.

Steps to reproduce

  1. Open the Copilot sidebar on a document with an agent that has the built-in content-read and search scopes (default tools search_umbraco, get_umbraco_content, get_content_type_schema, plus the system tools list_context_resources / get_context_resource).
  2. Ask: "Search for pages about , read the three most relevant ones and write a detailed comparison of their content."
  3. Watch the status line. search_umbraco and the get_umbraco_content calls each flip to a completed tick; the caption keeps saying Calling get_umbraco_content... for the whole time the model writes the comparison, until the run finishes.

The same happens with a single tool: "Retrieve context resource X (via get_context_resource) and summarise it in detail" shows Calling get_context_resource... throughout the summary generation.

Expected result / actual result

Expected: once the tool result is in and no other tool call is pending or executing, the status line falls back to Thinking... (the model is generating). Calling <tool>... is shown only while a tool is actually running.

Actual: Calling <tool>... remains until the next onToolCallStart or onRunFinished, i.e. for the whole model-generation phase after the tool result.

Suggested fix

In #handleServerToolResult, after updating #currentToolCalls:

const stillRunning = this.#currentToolCalls.some((tc) => tc.status === "pending" || tc.status === "executing");
if (!stillRunning && this.#agentState.value?.status === "executing") {
    this.#agentState.next({ status: "thinking" });
}

and in onTextStart, set { status: "thinking" } (or a dedicated streaming state if you prefer a separate label) so text generation after a tool call is never labelled with the previous tool's name. The awaiting_approval state for frontend / HITL tools should keep precedence, so the fallback should only replace an executing state.

Dependencies

Umbraco CMS 17.6.2, Umbraco.AI.Anthropic 17.1.0 (provider does not matter; the caption is set client-side).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions