Commit graph

3 commits

Author SHA1 Message Date
Danny Avila
3a2241c048
🌲 feat: Expose Navigable Subagent Progress Trees (#16748)
* feat: Return a Navigable Progress Tree When Checking a Running Subagent

check_background_task on a running or finished-but-undelivered subagent now
returns an activity digest: the child's turns, tool calls, and replies folded
to one line each and addressed by stable positional paths. Callers expand one
node or range with expand, and page with since against a settled-node cursor.

The owning process folds the child's update stream into a bounded tree that
keeps only tool names, the model-authored intent label, the tool-authored
outcome label, statuses, timings, and sizes. Routed claims carry the tree to a
poll on any replica, lists carry counts and the node in flight, and a finished
child whose owner is gone is rebuilt from its durable public projection.

The background-task card renders the digest as a foldable tree and links the
existing subagent activity panel.

* fix: Tighten Progress Digest Verdicts, Overflow Bounds, and Rebuilt Trees

Failed reply steps and schema-rejected calls now record as errors, and an
overflowed call is counted once without retaining it in the lookup maps.
A tree rebuilt from the durable projection re-checks completed calls with the
shared failure verdict, carries the projection's truncation, and tells the
caller its paths are a reconstruction. The card localizes folded summaries
instead of rendering the server's English tally.

* fix: Measure Single-Part Message Deltas in the Progress Digest

* fix: Scope Nested Progress Ownership by Run and Count Overflow Once

Nested runs now attach to the call recorded by their own spawning run, since
provider call ids repeat across runs. Only the step that announces a call can
count it as overflow, so later sightings of an unretained or evicted call never
re-count it or reopen history. A zero-valued since cursor is rejected, and the
card labels MCP tools with the configured server names.
2026-10-04 15:49:57 -04:00
Marco Beretta
7f4bde8352 🧩 feat: Map Message Content Parts to a UI Parts Union (#16374)
* feat: map message content parts to a UI parts union

Adds a UIMessage-shaped view of TMessage modelled on the AI SDK
(ai@7.0.114): content parts map one-to-one onto text, reasoning,
tool-<name>, file and data-* parts, holes map to step-start, and the
reverse restores the stored content so a view round-trips.

* fix: carry text, files and metadata through the reverse message mapping

An empty content array with text now views as contentless, an edited text part updates the stored text, attachment file parts reconcile message files, and metadata fields restore a message rebuilt without a stored base.

* fix: read durable tool markers and apply view edits in the parts mapping

Tool parts fall back from an empty id to the host step id, surface approval pauses and background-cancel or validation failures, and treat an empty legacy function output as submitted. The reverse mapping writes file and attachment edits over the stored records, keeps an explicit null parent, carries non-derived message text and absent text fields, persists hand-built tool failures, and collects text, content and attachments in one pass. Web search sources include link references and take message-wide ids. UIMessage drops the system role it could not round-trip. Adds mock-harness scenarios that view persisted replies, reasoning and tool turns and map them back.

* fix: view persisted reasoning without its think tags

Persisted reasoning is stored inside <think> tags that every renderer strips; the reasoning part now exposes the text alone and keeps the exact wrapper so the reverse mapping restores it. The tool-turn scenario skips mobile, where the composer MCP picker is not offered.

* fix: give view attachments a stable identity and read legacy tool outcomes

Attachment file parts carry the stored path they were viewed with, so an edited url still matches its file. Reverse slots advance only for content parts, audio takes its format from an edited media type, a null model survives a base-less rebuild, legacy retrieval outputs count as submitted, and error-prefixed outputs map to output-error through isToolErrorOutput, the predicate the tool output renderers use.

* fix: keep attachments, empty content and hand-built tool results through a rebuild

A base-less rebuild restores the stored attachments and an explicit empty content array from metadata. Hand-built tool parts record a completed status for output-available and keep an array output as a code interpreter call. Files the view never showed keep their stored positions while visible files fill the others in view order.

* feat: let the caller supply tool outcome rules to the parts mapping

Some tool outcomes are decided by rules the client owns, such as memory failure prose and background status attachments. toUIMessage, toUIParts and toUIPart take a resolveToolFailure option instead of copying those rules. Text deltas keep their ownership metadata, an empty hand-built array output is marked completed, and fromUIMessage documents that a stored message round-trips only with its base.

* fix: map untyped lane placeholders to step-start

A dual-conversation turn seeds type '' placeholder slots, which fell through the part switch and crashed toUIMessage. Any slot without a known type now maps to step-start, and the reverse leaves a hole, the same thing persistence compaction does.

* fix: identify view attachments by position and keep content added to plain messages

Attachment parts carry their index in message.files beside the path, so two files sharing a path stay distinct, and a hand-built part claims the first unclaimed match. Content parts added to a view of a plain message are written as content. Tool arguments that parse to a JSON primitive stay their string, inside the declared input type.

* fix: derive fallback tool ids from the streamed index and drop stale annotations

A tool call with neither a provider id nor a step id takes its fallback id from the streamed index the settled message keeps, so its identity survives compaction. Annotations on object-form text are dropped once the view's text no longer matches the value they index into.

* fix: map tool call slots without a call to step-start and keep text delta object shape

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017snqTCuA2LHsoKuC335HFG

* fix: report background and caller-resolved tool failures by their reason

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017snqTCuA2LHsoKuC335HFG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 6ac941eff3)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16374
2026-10-01 03:46:17 +00:00
Danny Avila
7b71c3fc35
🥅 fix: Keep Tool Error Prefix Parsing In Bounds (#15857) 2026-09-12 07:33:16 -04:00