LibreChat/packages
Danny Avila 78eb0c98ce
🧭 refactor: Resolve Activity Phase Position Once Per Boundary (#14807)
* refactor(api): make anchor construction exhaustive

Bounded anchors were built in two places, each spreading one side and
hand-picking the rest, so any field nobody named was dropped silently and
nothing failed until a boundary landed badly. That already cost agentId
and then unresolvedToolStartIndex in consecutive review rounds, and
mergedAgentIds was never added to the demotion path at all.

Both constructors now assign an AnchorFields literal, mapped over
keyof Required<TrackedActivity>, so adding a field to TrackedActivity is
a type error at both sites until its anchor semantics are decided.

No behavior change: every field resolves to what the hand-picked versions
already produced. Adds a folding property over count, failure count,
agent attribution, and ordering.

* refactor(api): resolve activity position once per boundary

Positional fields on TrackedActivity are captured at different times
against an array that keeps moving, so each was a cache that could go
stale, collide, or be truncated — and closesBeforeBoundary read three of
them directly. Roughly two thirds of the review findings on #14785 were
that pattern: a proxy outranking, outliving, or standing in for the
rendered position.

resolvePosition now folds tool indices, the prior partition floor, the
unmaterialized fallback, and reasoning anchors into one value, and
closesBeforeBoundary takes only that value. A caller cannot reach past
it to a raw field, and the four branches the predicate used to carry
collapse into one comparison: an activity closes early exactly when
nothing locates it beyond the boundary.

Resolution also decides when the saved fallback has gone stale, so the
stripping that kept it out of snapshots is now a property of the resolved
value rather than a separate step.

No behavior change; the existing boundary and straddle regressions cover
both directions.
2026-08-13 19:29:42 -04:00
..
api 🧭 refactor: Resolve Activity Phase Position Once Per Boundary (#14807) 2026-08-13 19:29:42 -04:00
client 🎛️ feat: Adopt Composer Density Tokens (#14730) 2026-08-10 22:57:33 -04:00
data-provider 🔖 feat: Bound Parent Activity Phases With an Exclusive End Index (#14768) 2026-08-12 23:43:35 -04:00
data-schemas 🛟 fix: Isolate Invalid Skills During GitHub Sync (#14735) 2026-08-12 13:22:06 -04:00