mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-19 06:23:32 +00:00
* 🛤️ fix: Render a Single-Agent Group as Sequential Content A multi-agent graph assigns a parallel group id to every starting node (`MultiAgentGraph.computeParallelCapability`), so an ordinary agent that merely has other agents loaded carries a `groupId` on its OWN run steps and on every content part built from them. `groupId` is not evidence of parallel execution. The client treated `groupId != null` as parallel content in four places, so an ordinary turn: - rendered inside a `SiblingHeader` lane box, restating the message's own sender and adding a redundant branch control - lost tool grouping, activity-label headers and client-synthesized phase folds, because lanes render raw parts - widened the message row for columns that never arrive - rendered the one group repeatedly when phase markers split it, since each segment runs its own `ParallelContentRenderer` `~/utils/lanes.ts` adds `hasParallelLanes` / `MIN_PARALLEL_LANES`: a group backed by one agent is not a comparison, so it renders exactly like content with no group id at all. `groupParallelContent` demotes such a group into the sequential flow, and `ContentParts`, `useContentMetadata`, `MultiMessage` and `groupActivityPhases`'s `foldable` all ask the shared predicate. Fixing it client-side repairs persisted history too. Two adjacent bugs the demotion exposed in `ParallelContentRenderer`: a sequential part landing between the lanes' first and last index was dropped from the message entirely, and a section holding only placeholders rendered every part twice. Five existing fixtures asserted the parallel path with a single agent (some with a string `groupId` that never matched `groupId?: number`); they now carry a second agent so they keep testing lanes. * 🧹 refactor: Narrow the Lane Part Instead of Asserting Its Shape `TMessageContentParts` already carries `agentId`, so the assertion was only standing in for the undefined check the optional chain now does. * 🧵 fix: Keep Lane Identity and Transcript Order Across Sections Two P2s from review, both about content that a lane group does not own. **Lane cardinality belongs to the message, not the slice.** A completed server phase marker partitions the transcript, and `renderSegment` hands each slice to its own `ContentPartsBody`. A slice can hold one agent of a genuine two-agent group while its sibling slice holds the other, so counting agents locally demoted both and dropped the `SiblingHeader` that told the reader which agent produced which answer. `parallelLaneGroups` resolves the group ids once over the whole message; every slice and `groupParallelContent` now ask that verdict instead of recounting. **Sequential content between two sections rendered after both.** The before/after split was global: with group 1, an ordinary part, then group 2, the part fell into `after` and the transcript read group 1, group 2, part. Sequential parts are now laid out around EACH section, so the part renders in place. A part landing inside a section's own index range still falls to the next block — it has no column and no slot inside one, which is the tradeoff the earlier `>= minParallelIdx` bound already made to stop dropping it entirely. * 🔢 fix: Count Only Attributed Lanes, and Scan for Them Once Round 2 of review, two findings. **An unattributed part is not a second agent.** `agentId` and `groupId` are independently optional on a run step — `getStepMetadata` builds both from whatever the step carries and the writer sets each only when present — so a group can hold a part the server never attributed. It shares the `unknown` sentinel column, and counting that sentinel let one agent plus one metadata-less part pass the two-lane threshold, leaving exactly the single-agent turn this branch exists to demote in the parallel UI. `attributedLaneCount` discounts the sentinel, `groupParallelContent` counts claimed columns the same way, and the sentinel is now one exported constant instead of a literal on each side. **One lane scan per render, not two.** `groupActivityPhases` was scanning the whole message for lanes to decide `foldable` while `ContentParts` was scanning it again for `parallelLaneGroups`, on a path that re-runs for every streamed delta. The scan is now computed once and handed down; a set built from the same content answers `foldable` by its size. * 🧮 fix: Ignore Handoff Markers in Lanes, and Scan a Message Once Round 3 of review, two findings. **A handoff marker is not a second lane.** `useStepHandler` stamps an `AGENT_UPDATE` part with `{ agentId: <destination>, groupId: 1 }` even though the destination's own run steps carry no group id, so a single-lane graph that later hands off held two agent ids in one group: the run's output became one column and the marker became the other, at the exact point the handoff happened. `isLaneMarkerPart` keeps a marker from claiming a lane, and `groupParallelContent` mirrors it — a column claims its lane only when it holds output, except a placeholder column, which claims with no parts at all so a dual run shows both agents from the first render. **One scan per message, not three.** `MultiMessage`, `useContentMetadata` and `ContentParts` each traverse the same array in a single render pass, allocating a map and a set per call, and `content` is rebuilt on every streamed delta. `laneAgentsByGroup` now memoizes on the content array itself: the three callers collapse to one traversal, and the cache is exactly as fresh as the render, since a delta that kept the array identity would not re-render either. Entries die with the array that keys them. |
||
|---|---|---|
| .. | ||
| @types | ||
| a11y | ||
| common | ||
| components | ||
| constants | ||
| data-provider | ||
| hooks | ||
| lib/rum | ||
| locales | ||
| polyfills | ||
| Providers | ||
| routes | ||
| store | ||
| utils | ||
| App.jsx | ||
| main.jsx | ||
| mobile.css | ||
| style.css | ||
| vite-env.d.ts | ||