Commit graph

2608 commits

Author SHA1 Message Date
Danny Avila
c2f3d0c07b
🎨 style: Color Image Tool Labels With the Activity Rows' Secondary Role (#15900)
The image generation and edit row set no text color, so its label inherited
`text-text-primary` from the message container. Every sibling row renders its
label in `text-text-secondary`, including this row's own icon. A finished,
failed or cancelled image label, and a running one under reduced motion where
the shimmer paints `currentcolor`, read brighter than the rows around it.

The row container now carries `text-text-secondary`, the way the generic tool
row's wrapper and the tool group header set their color.
2026-09-13 23:13:13 -04:00
Danny Avila
f3991f2949
🔡 style: Size Image Tool Labels Like Every Other Activity Row (#15898)
The image generation and edit label carried `progress-text-content` beside
`tool-status-text`. The former sets `font-size: inherit` and is declared later
in style.css, so it won the cascade. Outside the `progress-text-wrapper` that
class is meant for, the label inherited the page's 16px/24px instead of the
row role's 0.9x of the chat font size. It rendered larger than its sibling rows
at the default size and ignored the font-size preference at every other size.
2026-09-13 23:12:43 -04:00
Marco Beretta
e95e696d70
🧾 fix: Count the Tool Results a Tool-Limit Stop Retains (#15893)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Docker Dev Images Build / publish (push) Waiting to run
Sync Helm Chart Tags / Ignore non-main push (push) Waiting to run
Sync Helm Chart Tags / Sync chart tags (push) Waiting to run
* 🧾 fix: Count the Tool Results a Tool-Limit Stop Retains

Context snapshots reach the client only through the SDK's pre-invoke
`ON_CONTEXT_USAGE`, so the results of the tools a call requests are never in that
call's snapshot — the next call's snapshot carries them as kept-message context.
A run that stops at the tool-call limit makes no next call, so the tool result it
retains lives in the response and in no snapshot: the gauge reported
`(budget − remaining) + completedOutputTokens` and left the retained result out
of used tokens and out of the tool-call share until the following turn.

The save path now counts those results with the run's own tokenizer and persists
them as `retainedToolTokens`, a second post-snapshot delta alongside
`completedOutputTokens` rather than a number folded into the provider-reconciled
`messageTokens`. `resolveRetainedToolTokens` owns the rule that only a tool-limit
stop retains anything, and the snapshot handler records where its content ended
so the count starts at the right boundary.

Counting had to avoid `Tokenizer.getTokenCount`, whose fallbacks would have put a
guess inside exact accounting: above 4 KiB it returns byte length, several times
the real count on ordinary text, and it estimates from character length while an
encoding loads. `countExactTokens` tokenizes in bounded slices cut on code-point
boundaries and returns nothing at all when the encoding is cold, so an
uncountable result withdraws the figure instead of inflating it.

The client adds the field to used tokens, subtracts it from the runway headroom
and widens the tool-call share, in the live snapshot after finalization and in
the persisted blob after a reload.

* 🧹 style: Wrap the Retained-Counter Assertion as Prettier Requires

* 🧮 fix: Address the Review of the Retained-Tool Count

Three findings from the first round, each a real defect in how the figure was
produced rather than a style point.

The boundary was a content index recorded mid-run, but completion reshapes the
array — skill cards are unshifted onto the front and `hide_sequential_outputs`
replaces it with a filtered one — so a saved index no longer means the same
position. The snapshot now records the tool-call ids it already accounts for, and
the save path counts the results of the calls missing from that set: ids survive
every reshape, and a filtered-away call is correctly left out.

Counting in 4 KiB slices was not exact either: a BPE merge spanning a seam is
charged twice, measured at ~1 token per slice, and the field exists precisely to
be an exact addend. `countExactTokens` now tokenizes the whole input — ~60 ms/MB,
paid once at the end of a stopped turn — and refuses content past 8 MiB rather
than estimating it.

The counter takes its exact-count function instead of reaching for the tokenizer
singleton, so `resolveRetainedToolTokens` owns the default (the run's own
encoding) and a caller or test can supply another. That also removes the mock of
global state from the specs.

`compactionReclaim` now includes the retained result in the total it subtracts the
kept exchange from. `latestExchangeTokens` already counts that result on the
other side, so leaving it out subtracted content the total never carried and
understated the savings — to zero on a large final result.

* 🧯 fix: Bound One Turn's Retained-Result Tokenization

The tokenizer refuses a single result past 8 MiB, but a final call that requested
several tools in parallel would pay that bound once per result. The counter now
holds a budget for the whole turn and withdraws its figure past it, so the save
path cannot be made to tokenize an unbounded pile of output.

* 🎚️ feat: Configure the Retained-Result Tokenization Budget

The exact count the gauge adds costs ~60 ms/MB of retained tool output, and the
ceiling on that work was hard-coded in two places. It is now one lever:
`endpoints.agents.maxRetainedToolCountChars`, defaulting to the 8 MiB that
reproduces today's behavior, shared by the schema and the save path through
`DEFAULT_MAX_RETAINED_TOOL_COUNT_CHARS`. Deployments whose tools legitimately
return more can raise it; slower hardware can lower it, or set `0` to withhold
the figure entirely.

`Tokenizer.countExactTokens` no longer carries a bound of its own — the caller
owns the budget — and `resolveRetainedToolTokens` passes the configured value to
the counter, which spends it across all of a final call's parallel results.

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
2026-09-13 22:20:25 -04:00
Marco Beretta
8e6e6f062d
🪧 fix: Emit the Configured-Footer Answer With the HTML Shell (#15886)
* 🪧 fix: Emit the Configured-Footer Answer With the HTML Shell

The chat surface lays out against whether the deployment configured a footer
(customFooter, privacy policy, terms of service). The client answered that from
localStorage — whatever the last resolved `/api/config` recorded — so the answer
was a guess on a first-ever visit and could be stale for a deployment whose
configuration changed.

The backend already knows when it serves client/dist/index.html, so it says so
there: `injectConfiguredFooterBootstrap` writes `hasConfiguredFooter` into
`window.__LIBRECHAT_CONFIG__` ahead of the app's own scripts, once at boot from
the base app config, and the client reads it on its first render instead of
remembering the last answer. The `configured-footer` storage atom is gone.

Client and server share one predicate (`hasConfiguredFooter` in
librechat-data-provider) so the two cannot disagree, and the shell injection is
generalized (`injectBootstrapConfig`), with the query-devtools flag now going
through it.

* 🧷 fix: Keep Bootstrap Values Literal and State the Shell's Contract

`injectBootstrapConfig` passed its script as a replacement string, so a `$&`,
`$1` or `$'` inside an injected value was expanded by `String.replace` instead
of reaching the client. Both insertion points take a replacement function now,
and the spec reads its values back off the global through an explicit result
type rather than an unchecked dictionary.

The shell answers from the deployment's own configuration, which a per-tenant,
role or user override of `interface.privacyPolicy` or `termsOfService` can
disagree with — `/api/config` resolves the caller's and the client prefers it.
That contract was overstated in three comments ("a deployment-lifetime fact",
"the same one the config will give"); they now say what the answer is and what
resolves the rest. Two scenarios cover the disagreement end to end: a document
served without the answer, and a policy link only this caller's config carries.
2026-09-13 21:53:54 -04:00
Marco Beretta
91e00bbe6e
🧷 fix: Mark a Failed Compaction So Its Rerun Controls Stay Withheld (#15883)
* 🧷 fix: Mark a Failed Compaction So Its Rerun Controls Stay Withheld

A manual compaction that failed with an error part carried no marker: the
server stamped `initiatedBy: 'user'` only on a summary that produced text and
returned early once an error part existed. On a branch ending in a user
message, the resulting turn had no marker and a user parent, so the hover row
kept Edit, Regenerate and Continue — and using one answered that user message
instead of retrying the compaction.

`markCompactionOutcome` now marks whichever part carries the outcome, summary
or error, and `isUserInitiatedCompaction` reads both. The marking moved from
`api/server/controllers/agents/client.js` into `packages/api`, where the
behavior belongs; the controller keeps the call.

* 🏷️ refactor: Type the compaction spec helpers with SummaryContentPart

* 🧯 fix: Record a Marked Failure When a Compaction Produces Nothing

A compaction run that produced neither a summary nor an error part threw
COMPACTION_FAILED out of `sendCompletion`. The turn was then saved by
`saveErrorTurn`, which writes only top-level `text`/`error` and no content, so
the row carried no compaction marker: on a user leaf the hover row kept
Regenerate, and using it answered that user message.

`markCompactionOutcome` now records the typed failure as a marked error content
part instead, so the turn streams and persists like every other failed
compaction. A cancelled run still fails as a typed error, leaving the abort
path to own the turn. `saveErrorTurn` marks the compaction rows it still writes
for failures that are rethrown rather than recorded as content.

Verified end to end by two new mock scenarios that run Compact context against
a summarizer returning nothing, live and after a reload.

* 🧪 test: Run the Empty-Compaction Scenarios Against a Real Compaction

* 🧱 refactor: Resolve Failed-Turn Compaction Content in packages/api

`saveErrorTurn` decided in CJS whether a failed row carries compaction
identity. The decision moves to `resolveFailedTurnContent` in
`packages/api`, which returns the content fields a failed turn is persisted
with — the marked failure for a compaction, nothing for any other turn — and
`request.js` spreads the result.

* 🧹 fix: Keep an Unusable Summary Out of a Failed Compaction's Turn

History loading accepts any nonempty summary as the conversation's checkpoint
(`BaseClient.findSummaryContentBlock` ignores `failed`), so a compaction that
streamed partial text before failing would have persisted that truncated text
beside its recorded failure and replaced the history it failed to summarize.
The fallback now drops the unusable summary, leaving the typed failure as the
turn's whole outcome.

The empty-summarizer scenarios switch the shared fixture summarizer to blank
output, so the reset moves to `afterEach` and runs even when the helper throws
before its caller's `finally`.
2026-09-13 21:53:29 -04:00
Marco Beretta
c640d80539
🪟 fix: Opaque Header Controls Over the Chat Gradient (#15894)
* 🪟 fix: Opaque Header Controls Over the Chat Gradient

The mobile sidebar toggle let the conversation show through itself: the chat
header is a gradient fading to transparent with messages scrolling under it,
and the shared `header-action` variant carried `bg-transparent` while every
other control in that row sits on `bg-presentation`.

* 🔒 fix: Keep an Explicit Button Shape Over the Header Compound

A compound variant is emitted after the `shape` recipe, so the `header-action`
+ `size: 'sm'` corner repair outranked a caller that asked for
`shape="theme"` or `shape="round"` — `cn` kept the later `rounded-xl` and
dropped the requested radius. Gate it on `shape: 'unset'`, the way the
`subtle` compound already is, so it only repairs the default geometry.

Adds the mobile header row's acceptance scenarios to the mock harness: the
toggle's interior does not change as the conversation scrolls under it, its
fill and corner match the new-chat and overflow controls beside it, and the
drawer's close toggle is the same control by fill, corner and tap target.
All three fail against the previous transparent fill.

* 🧪 test: Rewind the Header Scenario Before Scrolling It

The scroll scenario sampled the toggle from wherever a freshly opened
conversation happened to land. That is the app's business — the newest message
with auto-scroll on, the top of a seeded transcript without it — and a landed
end leaves a wheel delta in that direction nothing to move, which would fail the
"the conversation did not move" guard rather than measure the fill.

Rewind to the top first, then bring the transcript down under the header, so the
wheel always has a known distance to travel. The guard stays: a run where the
conversation does not move still fails instead of passing vacuously.

* 🧪 test: Read the Header Toggles With the Pointer Off Them

`click()` leaves the pointer on the opener's coordinates, and the drawer slides
its own toggle onto those same coordinates, so one of the pair could be reading
`hover:bg-surface-active-alt` while the other sat on `bg-presentation` — an
equality that depended on when the 300ms slide settled.

Move the pointer off both controls, wait for the drawer, and assert the pointer
really is clear: each surface now reports its own `:hover` state, so a run that
measures a hovered control fails on that rather than on the colour.
2026-09-14 00:58:37 +02:00
Marco Beretta
566e0a8266
🪢 fix: Withhold the Editor's Rerun Where No User Turn Can Be Replayed (#15887)
A rerun replays the edited message's parent as the turn's user message, so a
response with no user turn behind it has nothing to submit. The editors gated the
action on `parent?.isCreatedByUser !== false`, which treats an unresolved parent as
replayable: a reply the import left at the root kept an enabled Rerun, bound to
Ctrl/Cmd+Enter, that both handlers then refused with no feedback.

Both editors now resolve that parent through `findRerunParent`, at render and again
at submit, so the button and the submission cannot disagree. Where the action is
withheld the footer's existing status slot says why instead of going blank. Save,
Cancel and Ctrl/Cmd+S are untouched.

The hover row carried the same shape: `parentIsUserMessage` was undefined for an
absent parent, leaving Regenerate and Continue enabled while `regenerate` only
logged. It now separates a missing thread — a search row, which still withholds
nothing — from a parent that is not in the thread.
2026-09-13 12:54:01 -04:00
aruj0
d6f8b2e92a
🏷️ fix: Keep a Configured Sender Label From Revealing the Model on Hover (#15489)
A conversation whose sender is a label someone configured shows that label as the
header's name. Since #14851 the header's hover crossfade swaps the raw `message.model`
back in, and the sr-only "Model:" text announces it regardless of hover.

Ask the message, not the settings. `resolveSender` writes an agent's name, then the
`getEphemeralSender` chain — a preset's `modelLabel`, a model spec's `label`, an
endpoint's `modelDisplayLabel` — and falls back to `getResponseSender` only when none
is set, so the persisted `sender` is the one thing that records which it was. The new
`isConfiguredSender` compares it against what `getResponseSender` would produce for the
same endpoint and model: equal means the header is showing a model-derived name and the
hover may reveal the model, different means it is standing in for one.

That settles three things a settings lookup cannot. Labels that live in config a caller
may not hold — a spec that sets `label` and leaves `preset.modelLabel` unset is the
ordinary shape, and the share publisher cannot read the spec list. Labels an endpoint
ignores — Anthropic keeps writing `Claude` whatever `chatGptLabel` says, and it matches
here without anything enumerating which endpoints honour what. And labels changed since
the message was written — the row still shows the sender it was written under, so
clearing a label must not start revealing the model behind the rows that carry it.

Equality is the test, so the ordinary way to be wrong is a stored name that no longer
matches what the current heuristics produce, which withholds a model rather than
revealing one. Three cases are decided before any comparison: a user turn is headed by
its author and has no model to withhold; agents and assistants are named by whoever
authored them, so the header shows that name whether or not the response stored a
sender; and an endpoint that cannot be named — an older message saved without one —
says nothing either way, where reading silence as a label would withhold the model from
every unlabelled row it reached.

`getHeaderHoverLabel` takes that answer and produces no hover label when it is true, so
the header renders the plain label with no swap and no sr-only model text. Without a
configured sender the behaviour is unchanged.

- Chat rows: `useMessageActions` and `useMessageHelpers` decide once per row from the
  message they already hold, so MessageRender, MessageParts and ContentRender consume it
  like any other derived display state.
- Share links: the view has no conversation in scope, so `getSharedMessages` reads the
  answer off the very messages it is returning, collected in the pass `anonymizeMessages`
  already makes rather than a second traversal. Only messages the link actually publishes
  have a say, and nothing about the link is re-derived from the conversation afterwards.
  `ShareContext` — already the carrier for share-scoped values such as `shareId` — hands
  it to the header.

The flag travels rather than the label text: each surface only needs the decision, and
the text is already carried by `message.sender`, which the share content preflight
inspects.

Search rows are left alone. `GET /api/messages?search` returns each hit's stored sender
and endpoint but overwrites `model` with the conversation's current one, so a row cannot
be classified from what it carries without changing what that payload means.
2026-09-13 11:57:12 -04:00
Danny Avila
9cf33cc8be
🧿 fix: Bind Login Flows to the Browser That Started Them (#15880)
* 🧿 fix: Bind Login Flows to the Browser That Started Them

Social OAuth logins (Google, Facebook, GitHub, Discord, Apple) now store a random state in an HttpOnly cookie scoped to the callback path and only exchange the returned code when the callback carries that state. Apple's form_post callback uses a SameSite=None cookie, and passport-apple's own fixed state no longer bypasses the store.

Local login, temp-token 2FA verification and admin local login reject requests a browser sent from another origin (Sec-Fetch-Site, falling back to Origin vs Host), trusting DOMAIN_CLIENT and DOMAIN_SERVER. Requests without browser fetch metadata, such as server-side callers, pass unchanged.

The sessionless OAuth callbacks drop failureMessage, which wrote to req.session and turned any rejected callback into a 500.

* 🧿 fix: Configure Login State Cookies and Localize Origin Rejections

- OAuth state cookies take secureCookie and maxAgeMs from the caller; registration.oauthStateTtlMs in librechat.yaml sets the lifetime (default 10 minutes).
- Secure deployments use a __Host- cookie at Path=/ so a sibling subdomain cannot plant a state.
- The cookie keeps up to three pending states, so logins started in separate tabs all complete, and an unmatched callback no longer discards them.
- passport-apple's preset state is dropped by deferStateToStore in packages/api.
- The Origin fallback compares scheme and host against the request itself.
- The same-origin rejection carries ErrorTypes.AUTH_CROSS_ORIGIN, which the login and 2FA screens show as a localized message.

* 🧿 refactor: Sign Login State Against a Per-Browser Binding

- The OAuth state store keeps a random per-browser binding in a __Host- cookie (reused across flows) and signs each state as issuedAt.nonce.HMAC(JWT_SECRET, provider, binding, issuedAt, nonce). Nothing is stored per flow, so any number of tabs complete, each state expires on its own clock, and concurrent starts no longer overwrite each other.
- The experimental server entrypoint passes its app config to configureSocialLogins.
- The same-origin guard also trusts an explicitly configured ADMIN_PANEL_URL.

* 🧿 fix: Keep Separate Bindings for Racing First Logins

A browser without a login-state binding now gets one under a cookie name with a random suffix, so two tabs that start their first login at once each keep their own binding. Later starts reuse an existing binding, and a callback is accepted when its state was signed for any binding the browser presents.

* 🧿 fix: Sanitize Request-Derived Values in the Cross-Site Rejection Log

The same-origin guard logged the request Origin and path verbatim. A non-browser client fully controls the Origin header, and the console transport uses a printf format that does not escape control characters, so a crafted value could forge log lines. Strip ASCII control characters (CR, LF, NUL and the rest) before logging, matching the pattern apiNotFound already uses.
2026-09-13 11:47:29 -04:00
Marco Beretta
9bf51fc302
🧷 style: Sidebar Row Controls, Pinned Unpin Badge and Drag Rules (#15870)
* 🔘 style: Seat Sidebar Row Actions One Radius Inside Their Row

Every control that sits on a sidebar row took the base `rounded-lg`, the same
radius as the row hosting it, so a hovered button filled corner to corner with
its row. `row-action` and `section-action` now carry `rounded-md`, one step
inside the rows, which stay as they were.

Three controls also diverged from the recipe they were built on. `ConvoOptions`
and the Projects heading action overrode the variant's hover fill with
`surface-hover`; the rename form's save and cancel buttons answered the pointer
with `hover:opacity-70` and no fill at all. All four now take the shared hover.

The project row's two actions are the exception that earns its own recipe: they
sit on a row that fills on hover, where the variant's hover surface reads as a
second, weaker hover stacked on the first. They take `surface-active` instead,
under the pointer and while the menu one of them owns is open, and sit 4px apart
like a pinned chat's own pair.

* 🧲 fix: Give Both Pinned Row Kinds One Unpin Badge, and Stop Its Flicker

Pinned chats and pinned agents/models sit in one list and are dragged against
each other, but their unpin badges were two controls: the chat's was
`text-text-primary` and always visible, the favorite's was a hand-rolled copy of
the shared row action, `text-text-secondary`, revealed on hover. `UnpinButton`
is now the single badge both rows render. It keeps the favorites' reveal, holds
open while the row's overflow menu is, and is inert while hidden so it cannot
swallow a click meant for the row.

The reveal is asked for in JS rather than through an `@media (hover: hover)`
variant: the variant has to beat the `group-hover` rules that reveal the badge,
and it loses that cascade for `opacity` while winning it for `pointer-events`,
which left the badge visible and unclickable.

Two things made a row's controls flicker under the pointer:

- The overflow slot took its width from its content, and the menu mounts a tick
  after the row is hovered. The unpin badge beside it slid 28px left at that
  moment, out from under the pointer, mid-fill; whatever landed there started
  its own. The slot now reserves its width from the row's hover, and `shrink-0`
  keeps a growing sibling from squeezing it.
- `hasInteracted` unmounted that menu on every leave, so each entry mounted a
  fresh button one frame late into an already-revealed slot, restarting its fill
  from transparent. A row that has been reached now keeps its control for as
  long as the row lives; virtualization still drops the whole row.

* 🧺 feat: Unpin a Chat by Dropping It on Chats, and Keep Pinned Kinds Apart

Dropping a chat on the Chats section filed it out of its project but left a
pinned one pinned, so the section it landed in was not the section it went to.
The drop now also unpins, and accepts a pinned chat that is already in the root
list; a chat that is both filed and pinned comes out of both, each call a no-op
for the half that already holds.

Pinned chats and pinned agents/models could be dragged through each other, which
the list cannot honour: the two are ordered independently and a row dropped into
the other group snapped back. Each row now accepts only its own drag type, so
the other kind never previews a displacement, and Alt+Arrow refuses the same
step. An order saved while the two interleaved is read back grouped, or a row
would be walled in by neighbours it is not allowed to swap with.

* 🧹 fix: Unnest the Row Action Width Ternary and Correct the Pinned Doc

The rebase onto `dev` left two things the branch's own checks catch: the width
branch that reserves a chat row's action slot had grown a nested ternary, which
the repository's ESLint forbids, and `dnd.ts` carried an import out of order.

The section's own doc comment still promised that favorites and conversations
"interleave freely", which this branch stopped being true: a row only reorders
against its own kind, and a stored order is read back grouped.

* 🪃 fix: Keep a Pinned Reorder That Was Released on a Row

Reordering the Pinned section with the pointer never survived the release. The
rows shifted under the drag, and the moment the button came up they snapped back
to where they had started; nothing was written, so a reload showed the old order
too. Only Alt+Arrow could actually reorder the list.

A row is a drop target — that is what makes the hover that reorders the list
arrive at all, since the HTML5 backend reports hover only for targets that could
receive the drag. react-dnd then counts that target as having handled the drop
whether or not it carries a `drop` handler, so `monitor.didDrop()` was true for
every release on a row, and the drag's `end` reads that as "this chat was filed
somewhere else" and discards the arrangement the drag built.

The row now answers the release with a result that names it, and `end` treats a
handled drop as a filing action only when the result is not that one. The same
change stops a row swallowing the drop of an unpinned chat that lands on it:
that drop reaches the section underneath, which is what pins the chat.

Covered by `dropping-a-chat-on-a-pinned-row-pins-it` and the same-kind control
inside `a-pinned-chat-cannot-be-dragged-through-a-pinned-model`, both in
`e2e/specs/mock/scenarios/pinned-drag-rules.spec.ts`.

* 🧪 test: Drive the Sidebar Row Rules in a Real Browser

Twelve scenarios in the mock harness, one per behaviour this branch claims: the
radius and fill every row control draws inside its row, the one unpin badge both
pinned row kinds carry and when it shows, the controls holding still while the
pointer crosses a row, the touch tap that reaches the badge directly, the drop on
Chats that unpins, the drop on a pinned row that pins, the kind boundary a drag
and Alt+Arrow both refuse, and the stored interleaved order that loads grouped.

They seed pinned chats straight into Mongo and set favourites and the pinned
order through the routes the star and the drag use, so the server's own cache
invalidation runs. Pointer-only scenarios skip on a pointer that cannot hover and
the touch scenario skips where it can, which is what lets the same file cover the
desktop and mobile projects.

`dragRowOnto` steps the pointer rather than jumping: the list reorders on
`dragover` once the pointer has crossed the hovered row's midpoint, and a single
move never delivers enough of them.

* 🧭 fix: Sequence the Two Halves of a Drop on Chats, and Reach the Mobile Drawer

Dropping a chat that is both pinned and filed in a project asked for the two
writes at once. The pin route answers with the conversation as it stands after
its own write, and the sidebar publishes that answer into every list, so a pin
that overlapped the project write could put the old `chatProjectId` back over
the lists the assignment had just corrected — and a failed assignment still left
the chat unpinned, out of the section it had been dragged from and still in the
project it was supposed to leave.

The unpin now waits for the assignment and runs only if it took, so a failure
leaves the chat exactly where it was and the published snapshot is the one taken
after both writes. `useAssignDroppedConversation` reports that outcome through a
named `AssignDroppedConversation` type, and the project row's drop keeps handing
back nothing, since the pinned list reads the drop result to tell a reorder from
a filing action.

On a narrow viewport the sidebar is a drawer that slides out of view rather than
unmounting, so its rows answer every query while nothing on them can be tapped.
The scenario helpers open it through the chat header the way a person does,
which is what lets the touch and keyboard scenarios run in the mobile project.

* 📝 docs: Say What the Kept Overflow Control Actually Costs

The comment beside `hasInteracted` claimed virtualization bounded the controls a
hovered row leaves mounted. It does for the chats list, which drops a row as it
scrolls out, but not for the Pinned section: that one mounts every pinned row at
once, so a pointer crossing it leaves one `ConvoOptions` per row it touched,
standing until the section unmounts. The bound there is the number of chats the
user pinned, which is worth stating rather than implying it is zero.

* ⏱️ test: Give the Sidebar Scenario Hooks the Time Their Seeding Takes

`test.setTimeout` called inside a test body does not reach the hooks around it,
and the slow part of these scenarios is in a hook: seeding a pinned list, then
reloading and waiting for the section. On a loaded machine the `beforeEach` hit
the default 30s and failed a scenario whose own budget was 60s. The timeout is
configured once per file instead, and the per-test calls it duplicated are gone.

* ⏳ test: Allow for the Cold Start the First Sidebar Scenario Pays

The first test of a run loads the app for the first time against a database that\nmay be a network hop away, and under reviewctl verify that first load pushed the\nseeding hook past 60s. The file budget is 120s and the navigation waits are 30s,\nwhich is the cold start plus room, not a licence for a slow assertion: every\nassertion here still resolves in single-digit seconds once the app is warm.

* 🧱 test: Tell an Unlaid Sidebar From a Closed One

The helper that brings the sidebar on screen read a missing bounding box as "off\nscreen" and reached for the chat header's opener, which desktop widths do not\nrender: the click waited out the whole test budget while the panel it was waiting\nfor was already open beside it. Placement is now three states — on screen, slid\nout of view, not laid out yet — and only a drawer that is really closed, on a\nviewport that really has an opener, is clicked.

* 🧮 fix: Keep Each Pinned Kind in Its Own Slots, and Never Report a Pending Write as Done

Two ways the drop and order bookkeeping could still move a row nobody touched.

A stored order written before the two kinds were kept apart can interleave them,
and `mergeVisibleOrder` substituted visible keys across that interleaving. With
part of the pinned list still draining, reordering two visible chats could carry
an undelivered chat across the favorite between them, so the row moved within its
own group once the rest of the list arrived. The stored order is now grouped the
way the section reads it back, and each kind is substituted inside its own run.

`useAssignDroppedConversation` treated a pending assignment's destination as an
outcome: dropping the same chat on Chats again while its first write was still in
flight matched `effectiveProjectId`, reported success, and unpinned the chat — and
if that first write then failed, the chat stayed in its project with its pin gone.
A write already heading where the drop asks now reports "not filed", so the drop
that started it keeps ownership of what follows.

Covered by `dnd.spec.ts` (`keeps each kind in its own slots when a legacy order
interleaves them`), `unpinDropped.spec.tsx` (`does not unpin again while an
assignment to the same place is in flight`) and the `PinnedSection` hidden-key
test, which now states the normalized order it expects.

The pinned scenarios also wait for the rows to advertise their reorder shortcut
before dragging: a move is refused until the saved order has arrived, so a drag
issued before that passed or failed on how fast the query answered.

* 🔗 fix: Wait for the Write a Drop Asked For, Whoever Started It

The pending-assignment guard assumed the write in flight belonged to another\ndrop, which would unpin the chat when it landed. The row menu populates the same\nmap and unfiles a chat without unpinning it, so a drop onto Chats made while that\nmenu action was in flight did nothing at all: an accepted drop left the chat in\nthe Pinned section.\n\nA pending entry now only stops this path from reading \ as\n"already there". The drop issues its own write and waits for that one; the\nmutation queues writes per conversation, so it lands after the one already out\nand repeats what it asked for, which the server takes as the no-op it is. The\nunpin still runs only on a write this drop saw succeed.

* 🛰️ fix: Let the Server Say Whether a Dropped Chat Is Out of Its Project

Three rounds of review found three ways the same guess went wrong, so the guess
is gone. Deciding locally whether the filing half of a Chats drop "already
holds" meant reading one of three things that are not the answer: a pending
write, which is a request that can still fail; a cached project, which another
tab may already have changed; or the drag item's own copy, older still. Each one
could let the drop unpin a chat that stayed in its project, and a chat that is
pinned nowhere and filed in a project is in neither list the sidebar shows.

The drop now always sends the assignment and acts on what comes back. Repeating
an assignment the chat already has is the no-op update it looks like, and the
mutation queues writes per conversation, so this one lands after anything
already out. The success notice reads the two project ids in the response rather
than the fact that a request was sent, so a write that moved nothing stays
quiet — which is what a pinned chat with no project gets when it is dropped on
Chats.

`unpinDropped.spec.tsx` covers the three: the unpin waits for the write, a failed
write keeps the pin, and a chat already out of every project is still confirmed
with the server and unpinned without announcing a move that did not happen.

The scenario drag helper also steps its pointer more finely. The list shifts rows
as it reorders and reads the pointer offset when the hover fires; a pointer that
arrived in one jump got a single reading, sometimes taken mid-render, and the
reorder it asked for did not always happen.

* 🧷 test: Press Only a Row the List Has Connected for Dragging

The pinned list disconnects its drag sources while the saved order reconciles,\nand a press on a disconnected row is not a refused drag — it is a click, so the\nrow opens instead of moving. Against the lab database, where that reconciliation\ntakes long enough to overlap the gesture, the Chats-drop scenario failed with the\ndragged row still pinned and now the active chat.\n\nreact-dnd marks a connected source \, so the helper waits for that\nbefore pressing.
2026-09-13 16:40:00 +02:00
Danny Avila
e18606e5ce
🚀 v0.8.8-rc3 (#15859)
Some checks failed
Docker Dev Images Build / publish (push) Waiting to run
Sync Helm Chart Tags / Ignore non-main push (push) Waiting to run
Sync Helm Chart Tags / Sync chart tags (push) Waiting to run
Publish `@librechat/client` to NPM / pack (push) Has been cancelled
Publish `librechat-data-provider` to NPM / pack (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / pack (push) Has been cancelled
Publish `@librechat/client` to NPM / publish-npm (push) Has been cancelled
Publish `librechat-data-provider` to NPM / publish-npm (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / publish-npm (push) Has been cancelled
* 🚀 chore: prepare v0.8.8

* 🚀 chore: prepare v0.8.8-rc3

* docs: mention Agent workspace defaults
2026-09-13 02:17:48 -04:00
Danny Avila
f43301f818
🔭 feat: Conversation Trace Viewer (#15869)
* 🔭 feat: Conversation Trace Viewer

Adds a trace view for a user's own conversations: a summary, a pinned
waterfall overview with interval focus, a hierarchical record ledger and
a record inspector, opened from the chat header (or the mobile overflow
menu) and read through a provider-neutral seam with Langfuse as the
first reader.

- interface.traceViewer (enabled, showInputOutput, maxRecords,
  maxContentLength, requestsPerMinute), off by default
- /api/traces/:conversationId availability, records and record routes,
  re-proving conversation ownership and narrowing the Langfuse session
  to traces the user's own sampled responses produced
- Langfuse reader over the v2 Observations API with cursor paging, time
  bounds, typed failures and server-side input/output withholding
- forks no longer copy the source messages' trace sampling record

* 🛂 fix: Address Trace Viewer Review Round 1

- interface.traceViewer.requestTimeoutMs bounds each Langfuse round trip
- availability is one existence query across every sampled response
  instead of the oldest one, run alongside the ownership check
- tree items report their position among visible siblings
- point-in-time Langfuse events read as completed, not running
- reads prefer the project holding the most responses when a tenant
  connection arrived mid-conversation

* 🎯 fix: Leave Focus With a Navigation That Closes the Trace

* 🧭 fix: Keep Trace Reads on One Project and Cancel Abandoned Reads

- page cursors and record details stay on the project that served the
  first page; pages report an opaque sourceId
- Open in Langfuse only appears when the linked project served every
  loaded page (the session link now reports its destinationId)
- client and server abort Langfuse reads when the viewer closes or the
  client disconnects
- reads never wait on the central project lookup, which the request
  timeout does not govern
- the cost total is withheld when any model call with usage is unpriced

* 🕰️ fix: Refresh Trace Pages After a Turn, Honor Clock Settings, Show Refresh Failures

- a settled run invalidates the cached trace pages, so reopening shows
  the new turn instead of pages fresh for another 30 seconds
- trace durations and clock times format in the app language and the
  user's 12/24-hour setting, as message timestamps do
- a failed refresh with every page loaded surfaces an alert and a retry

* 🔐 fix: Only Server-Authored Responses Grant Trace Access

- the message-create route and imports strip langfuseSampled and
  langfuseDestinationIds, and trace reference queries ignore client-authored
  rows (isUserSubmitted) and user turns, so a forged row cannot claim a trace
- the Langfuse reader receives its destination resolver and HTTP client
  from the route instead of defaulting to process-global ones
- availability asks the client to check again while central's project id
  is still resolving, instead of caching a false answer
- listRecords tries the next readable project when legacy responses left
  the first one empty
- a settled run also invalidates cached record details
- running is read from a record's status, not a missing end time

* 🏢 fix: Scope Trace Reads to the Tenant and Reach Every Project Holding a Turn

- ownership and both trace reference queries carry the requester's tenant
  (tenantless is its own scope), so a duplicate user and conversation id in
  another tenant cannot grant or supply trace references
- a read visits, page by page, every project that could hold a turn no
  earlier project provably holds, so legacy turns in another project stay
  reachable after a newer destination ranks first
- the trace read limiter takes its store from the route
- transient availability failures retry instead of hiding the control

* 🛟 fix: Fail Over Between Projects, Refresh One Page, Search Visible Labels

- a fresh read fails over to another project holding the same turns when the
  preferred one fails; the cursor carries the failed sources so later pages
  keep the rebuilt plan, and detail reads fail over the same way
- destinations for one project collapse into one source
- the trace read limiter keys each user within their tenant
- refresh and a settled run keep only the newest page before refetching, so
  older pages are not replayed through the limiter; retry repeats the read
  that failed
- search matches the localized kind and status labels a row shows

* 🧭 fix: Read the Newest Turn First, Report Failures Behind Empty Projects, Fit Trimmed Views

Rank trace sources by the newest sampled response they could hold before coverage and preference, so a conversation that moved projects shows its latest turn first.

Throw a list failure when a failed project could hold a turn that no answering project provably holds, instead of rendering an empty trace. Detail reads keep probing projects after an empty answer, skip ones whose turns an answering project provably holds, and surface a failure that could hide the record.

Refresh and settled runs trim the cache to the newest page; the viewer now fits a focused interval to the remaining records or clears it, and drops a selection whose record left with the older pages.

* 🧵 fix: Page Traces by Turn, Include Failed Runs, Keep the Active Row Mounted

List reads now page by turn segments instead of whole projects. A segment is the newest unread turn and up to 49 older consecutive turns one project could hold. The request filters Langfuse to those turns' run and title traces, so pages stay newest first when a conversation's responses alternate between projects. Legacy turns without destination ids are asked of the other projects in the segment. A project that failed for newer turns is retried when it alone holds older turns. A page whose rows all fail the observation schema is an upstream failure, not an empty trace.

A failed turn's error row now stores the sampling fields of the run that failed, plus langfuseRunId when that run was created, so the trace viewer and feedback scores follow the run's trace. langfuseRunId is stripped from client message writes and imports, dropped by forks, and hidden from client message projections.

The ledger keeps its active tree item mounted while virtualization scrolls it out of the window, so aria-activedescendant always names a rendered row.

* 🕰️ fix: Merge Multi-Project Trace Pages by Start Time, Keep Literal Content

A segment that reads more than one project now runs every read before returning. A read that fills the record budget cuts the page at the oldest start time all reads loaded, and the continuation carries that start time as an inclusive bound instead of a Langfuse cursor. Every project continues from the same point, so a newer turn held by another project is never left behind an older one, and failover works on any page. A page drawn from several projects no longer names a single source. A continuation that would repeat its own bound fails instead of looping.

Input and output that are literally the strings {} or null are kept; only an empty object or JSON null value is dropped.

* 🔎 fix: Read Each Trace Segment From a Project Shown to Hold It

Recorded destination ids say where a trace was eligible to go, not where it landed. A list read now looks up the turns more than one readable project could hold before choosing where to read them. Each project, preferred first, is asked which of those traces it holds a root observation for, and each turn is read from the preferred project that holds it, or from the preferred eligible one while a run's root is not exported yet. Turns only one project could hold need no lookup.

Segments are consecutive turns from one project, paged by that project's own Langfuse cursor. Records that share a start time page correctly, and the page budget bounds a single read. A failed project is dropped for the request. A turn only it could hold raises its failure at the turn's own place in page order, instead of leaving an empty or partial trace. Cursors carry the segment's trace-set hash and start over when the segment changed or Langfuse rejects them. Detail reads ask every project until the record turns up.

The trace summary withholds its cost total when any generation has no cost, with or without usage.

* 🧷 fix: Evidence per Trace, Continuations Without Replays, Stable Turn Order

A turn's run and title run are exported separately, so each trace id is looked up and read from a project shown to hold it. A trace no project shows (a title run the turn never had, or a run whose root is not exported yet) joins an adjacent segment whose project could hold it. Only a run that a failed project alone could hold raises that failure.

A continuation now stays on its project. Its failure is returned as is, and a cursor the segment no longer matches, or one Langfuse rejects, returns invalid_request instead of replaying the segment's first page. The viewer answers invalid_request on an older page by reloading from the newest page, with a message saying the trace changed.

Sampled responses sort by createdAt then _id, so responses saved in the same millisecond keep one order across page requests.

* 🪪 fix: Scope Trace Reads to the Exporting User, Order Split Title Runs

Trace ids derive from message ids, which a request can influence, so a colliding id must not return someone else's trace. Every Langfuse list, probe and detail read now also filters by userId: the requester's internal id, plus the configured langfuse.trace.userIdField value when set. The server stamps that id on the trace at export. The handler passes the requesting user into the trace query.

When a turn's run and title run sit in different projects, the probes' root start times decide which is read first, so a title generated after the response is not left behind Load older. Cursors name the trace a segment starts at within its turn.

The failed-turn trace lookup moves into packages/api as getFailedTurnTraceFields. The agent controller only passes the error row id, the run id and whether the run was created.

* 🔒 fix: Authorize Trace Reads by the Internal User Id Only

A configured langfuse.trace.userIdField can export a non-unique value (name, username) or one that repeats across tenants (email, provider ids) as the trace userId, so it cannot prove who a trace belongs to. Reads now require the internal user id alone. A deployment that exports another field reports no trace and logs why once, instead of trusting that value.

A failed read of a title run that a probe found in that project now raises its failure instead of dropping the title. The page contract now states that pages are ordered by turn and a turn's records may continue on the next page.

* 📚 fix: Page Sampled Responses With the Trace, Share Ingress Stripping

List reads load sampled response references a segment at a time: up to 50 ending at the cursor's turn, plus one older response that names the next page. Pages of a long conversation no longer rematerialize every sampled response. getConversationTraceRefs gains through and limit, anchored by createdAt and _id.

The message-create route and conversation imports strip trace sampling fields through withoutTraceRefs instead of their own field lists. A userIdField the exporter ignores counts as the internal id. A root lookup whose cursor repeats fails that project instead of paging forever.

In the viewer, Refresh also rereads the open record's detail, and closing the inspector after a filter removed every row returns focus to the search field.

* ⏱️ fix: One Round Trip per Trace Reference Read, Detail Reads Scoped to Their Turn

Cursors carry the anchor response's order key (creation time, then _id). The bounded sampled-response read then runs alongside the first-message lookup, with no anchor lookup ahead of it. A key that no longer names its response returns nothing, and the reader answers the cursor as changed.

Detail reads take the turn the list attributed the record to (?message=). They load only that sampled response instead of the conversation's whole history, and ask Langfuse within that turn's traces. The route rejects a detail read without it, and the client sends it from the listed record.

A list read whose Langfuse cursor repeats now fails instead of handing the next page the same records.

* 🧭 fix: Reject Out-of-range Trace Cursors, Open Any Listed Turn, Mark Copies Unsampled

A page cursor whose base-36 time parses to a number outside the Date range reached Mongoose as an Invalid Date and surfaced as a 500 the viewer retried; it now resumes nothing, which the reader reports as invalid_request so the viewer reloads its newest page.

The detail read capped the message id at the Langfuse record-id bound while the app stores response ids at any length, so a listed turn could refuse to open; message ids only name a stored row and are accepted at any length. Ids that reach a Langfuse filter keep their caps.

Copied and client-authored rows now carry langfuseSampled: false instead of no record, so a feedback score on a fork, import or posted message never recomputes sampling for a trace that was never made.

* 🧪 test: Type a Recordless Row for the Unsampled-copy Spec

An object literal with none of the trace fields fails TypeScript's weak-type check against the helper's all-optional constraint; the spec now passes a typed row that declares the optional field, as every stored message type does.

* 🚰 fix: Release Failed Langfuse Response Bodies

A non-success Langfuse response was turned into a TraceReadError without consuming or cancelling its body, and Node's fetch returns a connection to its pool only once the body is released, so a sustained upstream failure left sockets checked out until garbage collection. The body is now cancelled before the status becomes an error.
2026-09-13 00:56:52 -04:00
Danny Avila
74fa60cee1
🔎 fix: Enforce WEB_SEARCH Role Permission on Agents (#15875)
* 🔎 fix: Enforce WEB_SEARCH Role Permission on Agents

Squash of #15822 onto dev, preserving authorship:

- 🔎 fix: Enforce WEB_SEARCH Role Permission on Agents
- 🧪 test: Cover the Runtime Tool Loader's Web Search Gate
- 🔒 fix: Gate Web Search on the OpenAI-Compatible Embedder Surface
- 🩹 fix: Authorize Web Search by the Execution Context's User
- 📝 docs: Note the Grant Memo's One-Subject-Per-Request Assumption
- 🧹 fix: Deny Web Search Before an Endpoint Default Can Grant It
- 🙈 fix: Withhold the Web Search Model Parameter From a Denied Role
- 🧱 fix: Strip Provider-Native Search an Endpoint Re-Enables After Denial
- 🔌 fix: Close the OpenRouter Plugin Path and Stop Pruning Hidden Parameters

* 🧭 fix: Gate Provider-Native Web Search on the Built Config

The web search role gate ran before the provider builder and only when the
agent's stored `web_search` was not `false`, so an endpoint's `addParams`
re-enabled native search for a denied role, and every OpenAI-compatible and
Responses request read the role whether or not search was in play.

The gate now reads the builder's output: when it carries a native search tool
or OpenRouter's `web` plugin, the `WEB_SEARCH` grant is resolved and the search
stripped on denial. The routes that reach `initializeAgent` with `runtime` and
no `req` pass a lazy `resolveWebSearchGrant` that joins their request-memoized
grants, forwarded through agent discovery to handoffs and subagents. The
embedder surface wires it whenever `getRoleByName` is supplied, independent of
`appConfig`.

---------

Co-authored-by: TomasPalsson <tomas2212042710@gmail.com>
2026-09-12 23:00:10 -04:00
Danny Avila
1163045cef
🖋️ feat: Seal Code Environment Choices Per Conversation (#15868)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
* feat: lock code environments per conversation

* style: Sort code environment imports

* fix: Harden code environment decisions

* fix: Preserve code environment rollout compatibility

* fix: Harden code environment boundaries

* refactor: Centralize code environment policy

* test: Restore partial disconnect policy mock

* fix: Close code environment edge paths

* fix: Preserve implicit stateful code routes

* fix: Stabilize implicit code routing

* test: Align remote workspace contract

* chore: Sort code route import
2026-09-12 20:45:00 -04:00
Dustin Healy
19eb24921e
🔠 feat: Render Safe Upstream Model Errors (#15837)
* ✨ feat: Surface Upstream Model Errors

* 🧪 test: Cover Upstream Error Rendering

* 🛡️ fix: Harden Upstream Error Fallbacks

* 🛡️ fix: Defer Upstream Error Fallbacks
2026-09-12 20:23:54 -04:00
Joseph Licata
f25242df98
🦘 feat: Share Run-Scoped Files With Subagents (#15848)
* feat: add run-scoped file sharing for subagents

Delegate current-message files through authorized execution catalogs and publish selected immutable code-output versions through the existing file pipeline.

Requires the companion agents SDK context adapter before the dependency can be released and pinned.

* fix: preserve child tool artifacts and verify file-sharing lifecycle

Keep citations and other non-sandbox artifacts on their existing delivery path while retaining private code outputs and inspected images until publication.

Cover native and text delivery, nested and sibling authorization, concurrent runs, cancellation cleanup, and checkpoint recovery through the browser harness.

* test: align file-sharing fixtures and integration cleanup

* test: repair LibreOffice conversion fixtures

* test: verify deployment skill bytes across checkout formats

* fix: align subagent file budgets and refresh boundaries

* chore: update agents SDK to 3.8.6

* refactor: move code output processing into API workspace

* fix: enforce shared file budgets for parents and teams

* fix: declare the shared file encoder interface
2026-09-12 20:14:22 -04:00
Marco Beretta
246e7e5de7
💠 fix: Paint Native Tool Verification Badges (#15862)
* 🪪 style: Give Native Tools a Painted Verified Mark

The native badge on a tool card was lucide's BadgeCheck filled with status-success-strong: green, the same hue the card already uses for selected, and stroked in currentColor, so the white check color also outlined the badge and left a white halo on any surface that is not the card's own white — hover, selection, dark mode.\n\nVerifiedIcon paints the badge instead of stroking it and carries the check as the only stroked path, and status-verified gives provenance its own blue across all four themes.

* 🩹 fix: Hold the Verified Mark at 3:1 on Every Card State

The dark fill was tuned against surface-secondary, but ToolCard repaints to surface-tertiary (#2f2f2f) on hover, where #0b74d4 fell to 2.85:1 — below the non-text floor, and invisible to the spec, which asserted the panel only. The fill moves to #1a7fd8 and the contract now covers every background the card takes. Both of the mark's relationships are graphical objects under WCAG 1.4.11, so the check is held at 3:1 rather than AA: no hue clears 3:1 on the hover surface and 4.5:1 under a white check at once.\n\nA theme that predates the token names status-success-strong and not status-verified, and would otherwise wear LibreChat's stock blue beside its own text-on-status and card surfaces. resolveTheme and the legacy mapColors adapter now carry the mark onto the fill it had before the token existed, following the six derived-token fallbacks already there.

* ✅ test: Exercise the Verified Mark in the Tool Library

Four scenarios in the mock harness, each named by the behavior it observes: the mark a native card wears, its silhouette under the dark hover repaint that the retune fixes, a pre-token deployment palette carrying it on the theme's own success fill, and a third-party MCP server card carrying no mark at all. The contrast assertions read the rendered colors rather than the tokens, so a regression in the component or in theme application fails them.

* 🧪 fix: Teach the Marketplace Dialog Spec About VerifiedIcon

The suite hand-lists the @librechat/client surface it mocks, so ToolCard's new icon resolved to undefined and every render in the file threw.

* 🧪 fix: Reach the Agent Builder on a Narrow Viewport

The scenario run covers mobile emulation, where the side rail is collapsed and the panel opens from the header's Control Panel toggle; the helper only knew the rail. The MCP scenario also minted its access token before the app had loaded, so the refresh request had no origin to resolve against.

* 🧪 fix: Run the Verified-Mark Scenarios on a Touch Viewport

Mobile emulation has no side rail: the panel switcher lives inside a sidebar that starts off-canvas, so the helper opens the sidebar and picks the Agent Builder entry from the switcher's menu. A touch viewport also has no hover state, so the hover scenario measures whatever background the card actually takes there and still holds the mark to 3:1 against it.

* 🩹 fix: Keep Pre-Token Themes on the Fill the Mark Inherited

The first fallback only fired when a theme restated status-success-strong, so a partial palette that customizes surfaces or text-on-status and inherits the green still landed on the stock blue. resolveTheme now derives the omission for any custom theme from the resolved success fill, and the legacy adapter takes the mode's bundled palette from ThemeProvider so it can do the same for a theme that names neither.\n\nThe scenario helper picked its path from a one-second probe for the desktop rail, which turns a slow first paint into the mobile branch; it now decides on viewport width and keeps the suite's full assertion timeout in each branch. The mock project is Desktop Chrome, so a touch scenario asks for a touch context explicitly rather than leaving that layout unexercised in CI.

* 🧪 fix: Match the App's Inclusive Layout Breakpoint

useSidebarState switches on (max-width: 768px), so a 768px-wide context renders the sidebar switcher while the helper's strict comparison went looking for the desktop rail.

* 🩹 fix: Scope the Verified Fallback to Themes That Painted the Mark

Two rounds pulled the same predicate in opposite directions: keying it on a theme restating status-success-strong missed palettes that only repaint the check or the card, and keying it on any custom color at all gave a new partial theme a green mark identical to the selected cue. Both are answered by asking what the theme actually painted — the fill the mark wore, the text-on-status check it carries, or the surfaces ToolCard takes — which is the same shape as the series-scale fallback above it. A theme that repaints none of those keeps the bundled blue.

* 🧪 fix: Wait for the Shell Before Reading the Sidebar State

isVisible() answers immediately, so a slow first paint read as an already-open drawer and the helper then waited on a switcher sealed inside it. It now waits for whichever of the opener and the switcher the shell paints first, which is the same assertion timeout the desktop branch gets.

* 📝 fix: Keep the Token Catalog Entry Catalog-Sized

The entry restated the icon's construction, the contrast rule and the pre-token fallback, all of which live on the token's own doc comment and in semanticTokens.spec.ts; the catalog around it is one line per role.

* 🔦 fix: Let a Crashed Lighthouse Run Be Retried

The audit shells out to Lighthouse three times and fails the lane if any single process exits nonzero, so a NO_NAVSTART — Lighthouse losing the trace of a page load, whose own message is "run Lighthouse again" — sinks a pull request that has nothing wrong with it. That is what happened on this branch: runs 1 and 2 wrote reports, run 3 crashed, and the identical head passed on rerun.\n\nEach run now gets a second attempt before the failure propagates. The repeat is per run, so the median is still taken over three completed reports, and a page that genuinely cannot be traced fails both attempts and still fails the lane.

* 🧪 fix: Read the Drawer State From Its Inert Marker

The readiness wait accepted the panel switcher, which is mounted whether or not the drawer is open — translated off-canvas and inert — so a shell that painted the sidebar before the chat header could satisfy it with the drawer closed and leave the helper clicking an off-viewport control. The drawer's own inert attribute is the state, so the helper waits for the drawer to attach and reads it there, with no timing probe on either side.

* 🧪 fix: Open the Drawer Before Trusting the Restored Form

A narrow context that had already selected the builder restores the form inside the closed drawer, and a translated element passes a visibility check, so the early probe accepted a form sitting under an inert drawer and handed it to the caller. The layout decision now comes first and the drawer is opened before anything inside it is read.
2026-09-12 16:03:03 -04:00
Marco Beretta
5b4ec6bfe2
🔎 feat: Filter and Sort the Sidebar Chats List (#15842)
* 🔎 feat: Filter and Sort the Sidebar Chats List

The sidebar could only list every unarchived chat by last activity. Archived chats
lived behind a settings modal, sorting was not exposed at all, and the only filter
was a bookmark dropdown squeezed next to the search field.

A single control beside the Chats heading now carries the status (active or
archived), the sort field and direction, and the bookmark filter, each scoped to
that list alone: Projects, Pinned and Favorites are untouched by it.

* 🧹 fix: Answer Review Round on Sidebar Chat Filters

Rows derive their archive action from `conversation.isArchived`, which the list
projection now carries, instead of from the sidebar's filter mode: the archive view
keeps the unarchived pins beside it, and its previous page's rows outlive a status
switch, so the list mode offered to restore chats that were never archived.

Mutations reconcile the archived list caches they can now reach — rename, pin,
tags, project assignment, shared links — and archiving refetches the archived
query instead of inserting into page one, which dropped the row whenever the
active sort placed it later.

Title grouping keeps the order the server paged, heads each group with the title's
first code point, and the archive's legacy group falls back to `createdAt` the way
the cursor orders it. A failed list request renders an error with Retry rather
than "No chats yet", the status setter sanitizes a malformed stored sort, and
signing into another account no longer inherits the previous one's filters.

* 🧵 fix: Keep Sidebar Cache Writes Inside the Chosen Sort

Title groups are emitted as contiguous runs, so a `#` heading that the server's
order places either side of a letter no longer merges and drags a row across the
cursor boundary the next page continues from.

The live cache writers only reproduce newest-first, which is the one order they can
place a row in without the server's keyset. A title, created-at or ascending variant
now takes the field update in place and is refetched instead of having rows moved to
or seeded at the front of page one.

Archive and restore refetch every loaded page of the lists they touch — the archive
preserves `updatedAt`, so a restored chat can belong on a later active page — while
inactive variants are left stale rather than eagerly refetched. Archiving everything
still refetches them all, because every cached list is wrong afterwards. Renaming or
deleting a bookmark now rewrites the sidebar's selected tags, which otherwise kept
filtering by a name no menu could uncheck.

* 🗂️ fix: Treat the Archived List as a Live Conversation Cache

* 🔍 fix: Refetch List Variants Whose Membership the Client Cannot Decide

A cached search result is evaluated by the server, so a newly created row may or may
not belong in it. Skipping those variants left a mounted search list missing a row
it should show — forking from an archived search result being the case that exposed
it. The insert decision is now three-valued: insert into a variant whose membership
and order the client can reproduce, skip one the row provably does not belong to,
and refetch anything undecidable.

Forks, duplicates and imports inherit the source's archive state, so their
invalidations cover the archived list too, and the delete path reads `chatProjectId`
from archived caches as well.

* 🔎 fix: Reconcile Searched List Variants on Every Write

* 📣 fix: Announce Archive and Restore From the App Live Region

* 🧹 fix: Drop Unmounted Lists on Archive-All and Fill a Missing Archive State

Archive-all refetched every loaded page of every cached list, mounted or not, so a
session that had visited several sort, bookmark or search combinations paid a burst of
requests for lists nobody was looking at. Mounted variants still refetch all pages;
the rest are dropped, which reconciles them more thoroughly than a refetch and costs
nothing until something mounts them.

A row's own `isArchived` decides whether its menu offers Archive or Restore, and this
branch is what adds that field to the list projection — so mid-rollout, an archived
row from an older backend would offer Archive and submit a no-op. The list query now
fills a missing value from what the variant asked for, leaving an explicit one alone.

* 🧭 fix: Give Callers One Way to Reconcile Both Conversation Lists

Callers that cannot say what changed — a stream recovered after a disconnect, a
schedule whose run moved a chat, a project that took its chats' fields with it — were
invalidating the active list by hand, so a mounted archive kept a row the server had
already changed. `invalidateConversationLists` reaches both prefixes and is now the
only way those paths reconcile; `findConversationListQueries` shares its key list, so
adding a prefix is one edit rather than a sweep.

* 🔤 fix: Follow the Server Order, Index the Created Sort, and Tell the Truth When Empty

* 🎯 fix: Identify the Open Chat When a Restore Resolves

A restore leaves the chat open, so its success callback writes the new archive state
into the active conversation — but the callback captured that conversation when the
menu item was clicked. Open another chat before the request lands and the identity
check still matched the captured row, replacing the conversation the user had just
opened while the URL kept pointing at it.

The write is now a functional update that compares `conversationId` against current
state, so a stale callback leaves the open chat alone. Reading the conversation value
is no longer needed either, which also stops every row's menu from re-rendering on
conversation updates.

* 🧷 fix: Recheck the Open Route When an Archive Resolves
2026-09-12 15:56:10 -04:00
Danny Avila
7b71c3fc35
🥅 fix: Keep Tool Error Prefix Parsing In Bounds (#15857) 2026-09-12 07:33:16 -04:00
Danny Avila
1d45f5bd40
🏡 feat: Remember Agent Workspace Defaults (#15843)
* 🧭 feat: Remember Attached Workspace Choices

* Guard Workspace Defaults Across Navigation and Version Restore

* Order Workspace Preference Imports

* fix: Harden agent workspace defaults

* fix: Type workspace validation schema

* test: Cover safe execution projections

* fix: Bind workspace defaults to attached environments

* fix: Preserve unchanged workspace bindings

* fix: Scope workspace preferences to active agents

* fix: Preserve workspace selection state

* test: Target workspace discovery status

* fix: Keep workspace reset available

* fix: Resolve workspace defaults per environment

* fix: Collect per-environment workspace defaults

* fix: Reconcile Deleted Agent Graph Caches

* fix: Reject Stale Workspace Bindings
2026-09-12 05:45:16 -04:00
Danny Avila
767ee591d0
📴 fix: Stop Hidden Code Spinners (#15846)
* fix: keep quote selection updates outside React renders

* fix: stop animating hidden code execution spinners

* test: guard idle transcripts against continuous animations

* test: Assert accepted paste behavior independently of placeholder resize
2026-09-11 21:37:49 -04:00
Marco Beretta
1bea7e4c9e
🧽 style: Composer, Welcome Screen and Context Panel Polish (#15838)
* 🕵️ style: Mark Temporary Chat with the Incognito Icon

The dashed speech bubble (`MessageCircleDashed`) read as a generic chat glyph
rather than a retention cue, and its dashes break up at 16px. Every temporary
chat surface now uses lucide's `hat-glasses`, the hat-and-glasses incognito
mark: the header toggle, the read-only indicator chip once a conversation has
started, the overflow menu row, and the landing empty state.

`hat-glasses` landed in lucide 0.528.0, so `lucide` and `lucide-react` move
from `^0.525.0` to `^0.528.0` in `client` and `packages/client` (dependencies
and peers). That is the smallest bump that carries the icon; lucide redraws
existing icons between minors and the whole UI draws from it, so jumping to the
current 0.577 would bring unrelated visual churn.

`useChatBadges` imported the old icon without using it; the import is dropped.

* 🧹 style: Keep the Model Disclaimer on the Landing Page Only

The footer disclaimer rendered under the composer in every conversation, where
it repeats itself on each turn and costs a line of the thread. It now renders
only on the landing page, where it is first seen.

`Footer` is untouched, as are its other hosts: the auth screens and the public
shared-link view still render it. The component is a zero-height `relative`
wrapper around an `absolute bottom-0` bar, so dropping it from the conversation
branch shifts no layout.

* 📱 fix: Run the Mobile Composer to the Screen Edges

Below `sm` the composer is full-bleed — no horizontal padding, squared off at
the bottom, flush with the viewport floor — but it was inset on two sides there:

- `.scrollbar-gutter-spacer` reserved the message column's scrollbar band (8px)
  on the composer's trailing edge. That lines the composer up with the thread on
  desktop, but on mobile it only cut a dead strip off its right side, so the
  padding now applies from `sm` up. Its two users, the composer band and the
  scroll-to-bottom control, move together, so the control still stacks over the
  send button.
- The composer surface carried `pb-4` under its action row below `sm`
  (`sm:pb-0` above), leaving 16px of empty surface between the buttons and the
  bottom of the screen.

Desktop metrics are unchanged: the band still reserves the gutter, the composer
still clears the floor by `sm:mb-10`, and the surface still resolves to `pb-0`.

* 🔅 style: Mute the Landing Page Disclaimer

The footer sat in `text-primary`, the same weight as the greeting above it, so
the least important line on the landing page read as one of the most prominent —
hardest to ignore in the light theme, where it lands at 16.1:1 on white.

It now takes `text-muted`, the quietest text token that still clears AA for
12px copy on `bg-presentation`: 5.11:1 on white and 7.93:1 on the dark canvas.
The contrast modes collapse every text token to pure black or white, so
`high-contrast-light` and `high-contrast-dark` keep the disclaimer at 21:1.

The links move with it instead of keeping the brighter `text-secondary`: the
underline carries the affordance, and a link that outshines its own sentence
puts the emphasis back where this change takes it from.

The text stays at the bottom of the page. The landing hierarchy is the composer
and its title first, the sidebar second, and moving the disclaimer under the
text field would place it above both.

* 💠 style: Draw the Empty Prompts Panel Like Its Neighbours

The prompts side panel hand-rolled its own empty card — the same circular icon,
title and caption as the bookmarks, memories and schedules panels, but written
out again and a shade off: `border-border-medium` where the shared card uses
`border-border-light`.

It now renders the `EmptyState` primitive the other panels use, which is where
that appearance is owned. The strings, the icon and the list's own `my-2` are
unchanged, so the panel reads the same apart from the border it was never meant
to differ on.

* 📐 fix: Close the Gap Under the Composer in a Conversation

From `sm` up the composer band left 40px under itself, the height of the
disclaimer that used to sit there. A started conversation no longer carries one,
so the composer floated a line above the viewport floor with nothing in the gap.

The clearance now follows what is underneath. `ChatView` owns that fact — it is
the same `isLandingPage` it gates the footer on — and passes it to `ChatForm`:

- landing, centred composer: `sm:mb-28`, unchanged
- landing, composer at the bottom: `sm:mb-10`, the clearance the disclaimer
  needs, unchanged
- started conversation: `sm:mb-4`, enough to show the surface's own shadow

Below `sm` the composer still runs to the viewport floor in every state.

`ChatForm` cannot answer this for itself: deriving it from
`conversation?.messages?.length === 0` reads false while `messages` is
undefined, which silently drops the un-centred landing page to the conversation
clearance and overlaps the disclaimer.

`SubagentThreadPanel` states that its own bottom padding matches the main
composer's so the two surfaces end on one line when the panel is open beside a
thread, so it moves with it.

* 🎞️ fix: Slide the Composer Between Welcome Screen and Conversation

With "Center Chat Input on Welcome Screen" off, the welcome composer sits at the
bottom with the disclaimer's clearance under it and a conversation's sits 24px
lower. React keeps the same form node across that navigation, so the band had
everything it needed to travel and jumped instead: `margin-bottom`, the property
that carries it, was not in the transition list — only `max-width` was, from the
chat-width preference.

`margin-bottom` now transitions with it, 300ms on Tailwind's default easing, in
both directions and from the centred welcome composer as well. Reduced motion
gets the new position outright (`motion-reduce:transition-none`): this is a
slide across the page, not decoration.

* ↔️ fix: Hold the Composer Still Across the Welcome Screen

Opening a conversation from the welcome screen slid the composer 4px to the
left. A conversation's composer band reserves the band the message column holds
back for its scrollbar (`.scrollbar-gutter-spacer`, 8px here), which is what
lines the composer up with the messages; the welcome screen reserved nothing, so
its composer was centred on the full region and half the gutter off from where
it was about to land. Now that `margin-bottom` animates, the sideways step ran
alongside the downward one.

The gutter is reserved once per state, wherever the centring happens: the
conversation keeps it on the band around the composer, and the welcome screen
takes it on the column that centres greeting and composer together, so both move
as one and the composer lands where the message column will put it.

Measured across the navigation — 1280 and 1024 wide, centred and bottom
composer, sidebar open and collapsed: the surface keeps its exact left edge and
width. Below `sm` the reservation does not apply and the composer stays
full-bleed on both sides of the navigation.

* 📏 fix: Measure the Scrollbar Gutter Before the Welcome Screen Reserves It

The welcome screen holds back the band the message column reserves for its
scrollbar, so the composer lands where the message column will put it. On a
fresh load no message column has mounted, so `useScrollbarGutter` has published
nothing and the spacer fell back to `--scrollbar-size`: a fixed 8px, correct
only where the app's own `::-webkit-scrollbar` width applies. On an
overlay-scrollbar platform the real band is zero, so the welcome screen started
4px off-centre and the composer stepped sideways as soon as the first
conversation measured the band for real — the jump this change set out to
remove, inverted.

The gutter is now seeded from a detached probe built like the column itself
(`overflow-y: auto` with `scrollbar-gutter: stable`), which answers the same
question for the platform in front of the user: the scrollbar width, and zero
where scrollbars overlay. A mounted column measures itself and is
authoritative, so the seed only fills the gap before the first one exists and
never overwrites a published measurement.

Reported by Codex on PR #15838:
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3991992182

* 🧪 test: Cover the Composer and Welcome Screen Behaviours

Nine browser scenarios for what this change promises, in the mock harness
against the in-process fake model, tagged so each one is addressable:

- `welcome-screen-disclaimer-only`, `welcome-disclaimer-readable-while-muted`:
  the disclaimer stays on the welcome screen, leaves the conversation, and
  clears AA contrast against the canvas it is painted on — the dark project
  measures the dark palette, the light one the light palette.
- `composer-holds-position-into-conversation`,
  `composer-holds-position-with-overlay-scrollbars`: the composer keeps its left
  edge and width across the navigation and lines up with the message column,
  both with the app's own scrollbars and on a platform whose scrollbars reserve
  nothing.
- `composer-slides-down-into-conversation`,
  `composer-settles-instantly-under-reduced-motion`: the clearance change runs as
  a `margin-bottom` transition on the composer's own form, and runs no
  transition at all under `prefers-reduced-motion`.
- `mobile-composer-reaches-screen-edges`: below `sm` the surface spans the
  viewport and its action row is the last thing in it.
- `temporary-chat-marked-with-incognito-icon`: turning the mode on marks the
  toggle and the welcome screen with the outline incognito mark.
- `empty-prompts-panel-matches-other-panels`: the empty prompts card and the
  empty bookmarks card are drawn identically.

Each scenario skips the projects whose viewport it does not describe, rather
than asserting a desktop layout under mobile emulation.

* 🩹 fix: Seed the Gutter Before Paint and Keep Configured Footers

Three findings from the review round on eec4b37, one root cause each.

The gutter seed measured in a passive effect, so the welcome screen's first
frame still reserved the `--scrollbar-size` token and recentred by 4px once the
real band was known — the load-time half of the shift this reservation removes.
It measures in a layout effect now, before the browser paints.

Scoping the disclaimer to the welcome screen also unmounted the only
authenticated-chat renderer of `customFooter`, and of a deployment's privacy
policy and terms links. `Footer` takes `configuredOnly`: the generic disclaimer
is dropped, operator content is kept, and with nothing configured it renders
nothing rather than an empty bar. The conversation renders it again under that
scope.

The mobile composer spec gated itself on viewport width, and the repository's
mock config has one Desktop Chrome project, so CI skipped it and reported
nothing. It declares the viewport it describes with `test.use`.

Two scenarios cover the first two:

- `welcome-composer-paints-in-its-final-position`: samples the composer's x from
  the document's first frame on a platform whose scrollbars reserve nothing, and
  fails on any later correction.
- `configured-footer-stays-in-a-conversation`: serves a configured
  `customFooter` through the startup-config route and finds it on both the
  welcome screen and inside a conversation.

Findings:
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3992539826
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3992539834
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3992539845

* 🧹 test: Drop the First-Paint Sampler, Keep the Layout Effect

The sampler recorded the composer's x from the document's first frame to catch a
late recentring on a platform whose scrollbars reserve nothing. It cannot fail:
with the seed measured in a passive effect it still recorded a single position
in all three projects, because React flushes that effect before the browser
paints the commit it belongs to. A test that passes with and without the
behaviour it describes pins nothing.

The measurement stays in a layout effect: a value the layout reads belongs
before paint by construction, whatever a given runtime's flush order happens to
be. The reservation itself is covered by
`composer-holds-position-with-overlay-scrollbars`, which does fail without it —
4px, the half-band Codex reported.

* 🧷 fix: Clear the Configured Footer and Remeasure the Band on Contrast

Two findings from the round on d942b7c, one invariant each.

Keeping a configured footer in conversations left the composer reserving 16px
above an absolutely positioned bar about 32px tall, so the bar painted over the
composer's action row and would have taken its clicks. The clearance follows
what actually renders beneath the composer now, not which page it is: `ChatView`
reads `useConfiguredFooter` once and both decisions — whether to render the
footer, and how much room to leave for it — come from that same answer.
`ChatForm` takes `footerBelow` and keeps the welcome screen's rhythm for the
welcome screen.

The band is not a constant of the platform either: the contrast modes widen the
app's own scrollbar to 0.75rem, and a reader can turn contrast on — or have the
OS turn it on — while the welcome screen is the only thing mounted, with no
message column to republish. The seed remeasures when `ThemeProvider` flips a
class on the document element, which is the thing that changed the band.

Two scenarios, both failing before the fixes:

- `configured-footer-clears-the-composer`: with `customFooter` configured, the
  bar sits at or below the composer's bottom edge and the composer still takes a
  click at its own bottom row.
- `composer-holds-position-across-a-contrast-switch`: contrast turned on while
  the welcome screen is up, then a conversation opened; the composer keeps its
  left edge and width.

Findings:
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3992984510
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3992984517

* 🪡 fix: Align the Subagent Panel With the Conversation's Footer

The panel's bottom band states that it matches the main composer's clearance so
the two surfaces end on one line beside each other. That clearance became
footer-dependent in the previous commit, and the panel kept a fixed `pb-4`, so a
deployment with a configured footer ended them 24px apart.

The panel reads the same answer the composer reads — `useConfiguredFooter` — and
clears the bar when there is one. Three consumers now share one source for the
question "does a footer render beneath this surface": `ChatView`, `ChatForm`
through `footerBelow`, and this panel.

The panel's own alignment has no browser scenario: reaching this surface needs
an agent with subagents, a dispatched task and an open control footer, which is
a fixture of its own. The shared cause is covered by
`configured-footer-clears-the-composer` on the main composer.

Reported by Codex on PR #15838:
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993177163

* 🧵 fix: Hold the Footer Clearance Through a Cold Load and a Stale Band

Three findings from the round on 55106cd.

Whether a conversation carries a footer is an answer from the startup config,
and on a cold `/c/<id>` load it arrives after the composer is painted.
`useConfiguredFooter` now reports `{ present, resolved }`, and the two readers
use them differently on purpose: nothing renders until the answer arrives,
because there is nothing to render, but the clearance is held from the first
frame, because guessing "no footer" moves the composer twice.

The measured scrollbar band outlives the chat screen on purpose, and the screens
it outlives can change it — the auth layout carries a theme selector, and a
contrast switch there widens the app's own scrollbar while no chat column is
watching. The seed measures on every mount now instead of trusting a value it
did not publish.

`@librechat/client`'s peer range kept its previous line as well as the new one
(`^0.525.0 || ^0.528.0`): only `/client` consumes `HatGlasses`, and the shared
package still builds against either, so raising the published minimum would have
rejected downstream installs for an icon it does not use. Its devDependency
stays on 0.528, which is what it is tested against.

Two scenarios, both failing before the fixes:

- `configured-footer-clearance-survives-a-cold-load`: the startup config is
  served 700ms late with a custom footer, and the composer's bottom is sampled
  from the document's first frame; any correction fails it.
- `welcome-screen-remeasures-a-stale-gutter`: a 40px reservation is left behind
  before the app boots, as another screen would, and the welcome screen has to
  replace it rather than inherit it.

Findings:
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993328716
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993328723
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993328726

* 🧠 fix: Remember the Footer Answer Instead of Guessing It

Reserving the footer's band while the startup config was in flight fixed the
cold load of a deployment that configures a footer and broke the cold load of
one that does not: the composer took `sm:mb-10`, then dropped 24px when the
answer said there was nothing to clear. Both defaults are wrong for one of the
two deployments, because the layout was being derived from an answer that does
not exist yet.

`useConfiguredFooter` remembers the answer instead. A deployment's footer
configuration is a deployment-lifetime fact, so the last answer it gave is the
right thing to lay out against while `/api/config` is in flight; it is recorded
once the query resolves. Every load after the first is exact in either kind of
deployment, and a first-ever visit falls back to LibreChat's default — no
configured footer — and settles once if the deployment disagrees.

`ChatView` and the subagent panel drop the `!resolved` term: `present` already
carries the remembered answer, so the value is the same before and after the
config answers.

Scenarios, both sampling the composer's bottom from the document's first frame
with the config served 700ms late:

- `configured-footer-clearance-survives-a-cold-load` now primes the answer with a
  first visit and asserts the load after it, which is the load a returning user
  gets.
- `default-clearance-survives-a-cold-load` covers the other branch: a deployment
  that configures nothing must not move either.

Reported by Codex on PR #15838:
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993438258

* 🛟 fix: Treat a Failed Startup Config as No Answer

React Query reports a request that exhausted its retries as fetched, with no
data, so reading `isFetched` turned a failed `/api/config` into a confirmed
"nothing configured": a deployment remembered as having a footer lost the
clearance that footer needs, and the memory was overwritten with the guess, so
the composer moved again on the next load that succeeded.

`useConfiguredFooter` reads `isSuccess`. A failure now answers nothing: the
remembered deployment state stands, and nothing is recorded until a response
actually arrives.

`config-failure-keeps-the-remembered-footer` covers it: a first visit records a
configured footer, a second visit is served 500s until the retries run out, and
the composer's clearance has to be the one it had.

Reported by Codex on PR #15838:
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993554041

* 🧽 test: Drop the Config-Failure Scenario, Keep the Success Check

The scenario recorded a configured footer, served `/api/config` 500s until the
retries ran out, and then asserted the next successful load lays out once. It
cannot fail: without a startup config the app renders no chat at all, so
`useConfiguredFooter` is never mounted on the failing visit and nothing is
recorded either way. The negative control — reading `isFetched` again — passes
it in all three projects.

The reported corruption therefore has no reachable path: the hook only observes
a failed query while the chat is mounted, which requires a config that answered
once, and React Query keeps that answer as cached data through a later failure.

`isSuccess` stays. "A failure answers nothing" is what the code should say, and
saying it costs nothing; the test that pretended to prove it does not stay.

Reported by Codex on PR #15838:
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993554041

* 🧱 refactor: Own the Footer Memory in Jotai and Take the Landing Preference In

Two repository-policy findings from the round on 5d535a6.

The remembered footer answer was a raw `localStorage` read and write, which is
the persistence path the client state rules replaced: it is feature-owned state
that the chat surface both writes and reads, so it is a Jotai storage atom now
(`configuredFooterAtom`, beside the feature that owns it). `getOnInit` is what
makes it usable — the value has to be there on the first render, or it is the
guess again — and only a successful config response writes to it.

`ChatForm` also still subscribed to `centerFormOnLanding` directly, an
app-level persisted preference the chat feature only consumes. `ChatView`
already reads it for `Landing`, and now passes it in beside `isLandingPage` and
`footerBelow`, so the composer's clearance is computed entirely from what the
host handed it.

Findings:
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993728399
https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993728405

* 🔍 fix: Give the Context Popover Its Own Foreground

The popover is portaled to the body with a surface colour and no text colour, so anything inheriting \ there took the user-agent default black: the insights toggle rendered at 1.3:1 on the dark canvas and was invisible until hovered. The panel now names \ beside its surface, as the shared hover-card surface already does.

* 🧮 fix: Show the Cached Share Beside Its Tokens

The cached and cache-write rows were built without a max, and the row renders its share only when one is given, so both printed a bare token count while every row around them carried a percentage. Both now key the window, and the cached test pins the share.

The insights toggle also names its resting colour here: the ghost variant defines only a hover colour, and every other glyph in the panel names a role.
2026-09-11 21:23:17 -04:00
Marco Beretta
e2f5772961
🧮 feat: Surface Retained Tool-Message Context Usage (#15796)
Some checks are pending
Docker Dev Images Build / publish (push) Waiting to run
Sync Helm Chart Tags / Ignore non-main push (push) Waiting to run
Sync Helm Chart Tags / Sync chart tags (push) Waiting to run
* feat: surface retained tool-message context usage

* fix: correct post-snapshot context accounting and lockfile registry

Adjudicated the review findings on the retained tool-message context work:

- package-lock.json resolved four entries (@librechat/agents, call-bind-apply-helpers,
  es-object-atoms, get-intrinsic) from a private mirror, breaking `npm ci` outside
  that network. Restored the public registry hosts; the integrity hashes already
  match the public tarballs.
- `finalizeUsage` migrated every usage atom except `subagentUsageFamily` before
  dropping the temporary `new` key, so a first-turn subagent total vanished when
  the conversation id was assigned.
- The runway projection divided the pre-invoke `remainingContextTokens` by per-call
  growth, ignoring the output generated after that snapshot, and the compaction hint
  subtracted a post-call exchange from a pre-call message total. Both now apply the
  post-snapshot output, so each side is measured at the same point in time.
- The estimate path rendered its tool-call share as a peer row although it is a
  subset of Input/Output/Estimated, so the visible rows summed past `usedTokens`.
  It is now an indented subtotal; the counted rows stay provider-accurate.
- The Totals block presented conversation-wide session subagent usage beside
  branch-scoped rows; it is now labeled all-branches.
- Rewrote the truncated `rgb-series-8` rationale as one comment on the series block.

* fix: keep subset accounting whole across cache, legacy snapshots, and custom themes

Adjudicated the second review round on the retained tool-message context work.
One cause per finding, each measured on the same basis as what it is compared to:

- The all-branches subagent subtotal summed input+output only, so a cached
  subagent call was under-reported and a fully cached call with no output
  disappeared from the row while the Cache read/write rows above still counted
  its traffic. It now sums every normalized bucket.
- `collectAnchorSeries` read an absent `remainingContextTokens` as zero and
  recorded that snapshot as having spent its entire budget, which distorted the
  growth delta feeding the runway projection. A snapshot saved in the older
  shape now derives its used total from the breakdown, exactly as the render
  path's `baseUsed` does, and one that carries neither basis is skipped. Each
  reading is tagged with its basis and the projection compares only readings of
  the same basis instead of reporting the difference between two measurements.
- `resolveTheme` filled an omitted `rgb-series-8` from the bundled base, so a
  stored or environment theme that paints its own seven-slot scale got
  LibreChat's indigo on surfaces it never checked: 2.41:1 against that theme's
  meter track, under the 3:1 mark floor the scale claims. An owned scale now
  derives the slot from the theme's own neutral text — 11.5:1 on the same
  reference theme — and naming `rgb-series-8` still opts out.
- Ordered the `--series-*` declarations in the light block by slot.

* fix: keep cached shares out of the peer rows and track resolved text for slot 8

Third round on the retained tool-message context work, correcting the two
variants of invariants this PR already fixed elsewhere rather than patching
them locally:

- The snapshot path rendered the reconciling call's Cached and Cache write
  shares as peer rows with window percentages, although reconciliation already
  counted those tokens inside the segments above. A fully cached prompt showed
  its tokens twice and the visible rows summed past the meter. They now render
  as an indented subtotal, the same treatment the estimate path's tool-call
  share received. The existing test claimed this invariant in its name but only
  asserted the rows exist, so it now asserts they are not peers.
- The `rgb-series-8` fallback required the theme to name its own text, so a
  theme that repaints the scale and its surfaces while inheriting LibreChat's
  text colours still received the bundled indigo. It now derives from the
  RESOLVED secondary text, so the stop tracks whatever the theme reads its body
  copy against whether it names one or inherits ours.

* fix: settle the subagent share with its run and measure both reclaim sides alike

Fourth round on the retained tool-message context work:

- The subagent share was committed on arrival while the usage it is a subset of
  stayed pending, so a run that ended with no salvageable response left its
  tokens in the Totals after `resetLive` discarded them from every rollup, and a
  resume re-folded the same events into the cumulative figure. It now
  accumulates in `pendingSubagentUsageFamily` beside the pending usage and
  settles with it: committed by `flushPendingInto` when the response keeps its
  usage, dropped by `resetLive` otherwise, migrated with the conversation id.
  The view merges committed and in-flight shares, so the live row is unchanged.
- `latestExchangeTokens` subtracted a summarizing turn's whole response,
  including the summarization completion the backend folds into `tokenCount`
  while the snapshot holds it in `breakdown.summaryTokens` rather than
  `messageTokens`. The reclaim hint was understated by the summary and could
  reach zero after a long one; the summary block's size is now excluded from the
  tail's contribution when that turn compacted.
- `sumBranch` exposed the tail's char estimate and tool share even when the tail
  carried a `tokenCount`, so a resumed partial response stayed in the message
  total while its tool traffic was dropped from the Tool calls split. Both tail
  figures are now zero for a counted tail, which also stops the estimate path
  subtracting an estimate that was never summed.

* chore: drop the lockfile churn the base branch already carries

The SDK bump this PR set out to make landed on dev as 3.8.5, so the branch no
longer changes any package.json and its lockfile edits (the 3.8.4 entry plus the
transitive call-bind-apply-helpers/es-object-atoms/get-intrinsic bumps that
install pulled in) are churn against the base.

* fix: give the eighth series slot a value every bundled theme can carry

The base branch grew high-contrast palettes that must declare every registry
token, and a test that a series slot can carry `text-on-status` at the 3:1 mark
floor, because a slot also fills a badge chip under that glyph. Slot 8 failed
both: the high-contrast palettes could not name a token that did not exist when
they were written, and the dark indigo #8c98e6 carried white at 2.71:1.

Dark slot 8 is muted to #8082be, which reads 3.66:1 under the status label and
still clears 3.66:1 on every series surface. The high-contrast palettes take
their own neutral text as slot 8 — the same stop `resolveTheme` derives for a
third-party theme that paints its own scale — because seven saturated hues is
all either canvas affords at their stated CVD separation; it is distinguished
by lightness at 21:1 on the canvas instead of by hue.

* test: exercise the context split through the mock harness

Nine scenarios of the acceptance contract, one tagged Playwright test each,
driving the real application: a tool round-trip through the e2e MCP server for
the Messages/Tool calls split, its keyboard disclosure of per-tool counts, the
peer rows staying inside the meter and surviving a reload; a real subagent run
for the all-branches total; seeded conversations for the legacy snapshot whose
used figure comes from its breakdown and for the estimate path's nested tool
share; and a stored theme that owns the series scale for the eighth slot's
fallback and its opt-out.

* test: keep the tool and subagent scenarios on the viewports that expose them

* 📌 feat: Unified Pinned Section With Sidebar Drag Interactions (#15057)

* feat: unified pinned section with drag interactions and sidebar polish

- Pinned chats and favorite models/agents/specs render as one interleaved,
  reorderable list persisted via users.pinnedOrder
- Drag conversations onto project rows to file them, onto Chats to unfile,
  and onto the Pinned section to pin (empty section materializes as a drop
  zone during a conversation drag)
- Row-level unpin button on pinned chats matching the favorites' button,
  and the row action menu shares the same hover/focus treatment
- Agent Marketplace entry moved under the New Chat button in the side rail
- Bookmarks trigger sized to the search bar, search focus no longer swaps
  its border color, tag filtering shows a loading state, and opening a
  project shows row-shaped skeletons

* fix: add pinnedOrder to IUser type and sort imports

* fix: pinned drag threshold, unpin focus target, and marketplace link

* fix: surface failed pinned reorders and skip no-op order writes

* fix: address review findings on unified pinned section

Move the pinned-order endpoints into packages/api as TypeScript handlers and
route their URLs through the data-provider endpoint registry. Raise the entry
and key caps so a valid model favorite and an unbounded pin count can both be
persisted.

Keep the marketplace entry reachable from the mobile drawer, which is the only
sidebar surface on small screens. Merge a reorder into the stored order while a
bookmark filter hides part of the list, instead of dropping the hidden keys.
Add Alt+Arrow keyboard reordering with a live-region announcement, restore the
focus handoff when a favorite is removed, and hold the local arrangement until
the stored order catches up. Serialize overlapping order writes and discard the
optimistic value when the first one fails. Derive the tag-filter loading state
from isPreviousData rather than a flag that could stick on.

* fix: release drag while renaming and dedupe repeated favorite keys

A draggable ancestor swallows drag-select inside the rename input, so both the
row's own drag source and the pinned wrapper's release while a title is being
edited.

The favorites payload validator accepts a repeated entry, and two rows keyed
the same would collide in React, point every drag at the first copy, and fail
the order endpoint's uniqueness check. Build the pinned list keyed-unique.

* fix: address PR review bot findings

Make the model favorite key injective. Joining endpoint and model on '::'
collided for components containing the delimiter, so two distinct favorites
keyed the same and the dedupe hid one; the endpoint is now length-prefixed.

Replace the pinned-order entry cap with a total size guard. Pinning has no
membership cap and the sidebar query drains every cursor, so any count limit
rejects a legitimate list rather than bounding anything; what needs bounding is
the user document.

Let only the newest order write touch the cache. An earlier write failing
rolled back over a newer arrangement that was still in flight, leaving the UI
on a stale order while the server held the current one. A confirmed write now
takes the server's answer, and a failed newest write discards the value that
was never accepted.

Persist the favorites array only once the order write succeeds, so a rejected
write cannot leave the two stores disagreeing with the rolled-back display.

* fix: address second round of PR review bot findings

Read favorites membership at write time rather than capturing it at drag end.
A favorite added or removed while the order request was in flight was undone by
writing the older list back; only the relative order now comes from the drag.

Move the pinned-order queue to module scope. The sidebar unmounts whole
sections while a search is active, so a component-local ref let a remounted
hook start a second queue alongside a request that was still running.

Serialize project assignment per conversation. Every drop target owns its own
mutation instance and the write is an unconditional update, so two quick drops
let whichever request reached the database last decide the project.

Read the pinned-order request body null-safely: destructuring a nullish body
threw past the handler into Express's generic error path instead of returning
the intended 400.

* fix: address third round of PR review bot findings

Drop the secondary favorites write. No consumer of the favorites array reads
its order, so mirroring the arrangement there bought nothing while racing the
membership mutations that share that whole-array endpoint; pinnedOrder is the
single source of ordering.

Always merge the committed order into the stored one. The visible list is not
always the whole list, since a bookmark filter hides rows and the pinned query
publishes partial results while draining its cursor, and replacing wholesale
dropped every key it could not see.

Release the local arrangement when the write settles instead of when the stored
order matches it key for key. A pin arriving mid-request made that equality
unreachable, stranding the snapshot and hiding the new row until remount.

Abandon a queued pinned-order write if the signed-in user changed, so a
deferred request cannot write one account's order into another's document.

* fix: address fourth round of PR review bot findings

Guard the pinned-order completion callbacks on the signed-in account. The
pre-send check only covers a write that has not left yet; a response arriving
after a session change would publish one account's order into the next one's
cache, which this query never refetches on its own.

Commit a reorder only when the pinned rows handled the drop. Dragging a pin
onto a project row or into Chats sweeps the pointer across sibling rows, whose
hover handlers shift the order, so a filing action was also saving a move the
user never asked for.

* fix: address fifth round of PR review bot findings

Deselect pinnedOrder at schema level. It is display-only and allowed to grow
large, but every authentication request loads the user document, so it was
adding its whole payload to paths that never read it.

Refuse to reorder until the stored order has loaded. Merging against an absent
order and then cancelling its fetch posted only the visible keys and discarded
saved positions for good.

Prune keys only once the visible list is known to be the whole list. Merging
unconditionally grew the array until the size guard rejected every write, so
completeness now gates compaction rather than the filter flag alone.

Track every renaming row, not just the most recent. RenameForm has no blur
cancellation, so a second form can open while the first is still mounted and
the single key reconnected the first row's drag source under its open input.

Judge drop eligibility by the queued destination. A drag item carries the
project its row had when the drag began, so re-dropping a chat back where it
started while an assignment was queued read as a no-op.

Take mutation ownership from the user atom AuthContext fills on login rather
than the user query, which is still empty in that window, and never treat an
unknown owner as a match.

Restore the pinned section's 30vh cap. Matching the Projects section's 42vh put
84vh of non-shrinking content above Chats and starved it on short viewports.

* fix: address sixth round of PR review bot findings

Gate reordering and pruning on successful fetches rather than attempted ones.
A failed pinned-order GET still reports as fetched, and a failed later page of
the pinned drain still publishes partial data and stops fetching, so both gates
were opening on exactly the states they were meant to exclude.

Scope the post-unpin focus handoff to this section by its own marker. The whole
conversations pane is a labelled region too, and the project lists inside it
render the same row, where unpinning only clears the flag and the row stays
put, so focus was being moved off a row that never went away.

Clear the account tracker when the mutation hook unmounts. The sidebar drops
that section during a search, leaving a stale non-null id that also shadowed
the cache fallback, so a deferred write could pass its owner check after a
session change.

* fix: gate pruning on a delivered favorites list

A favorites fetch that exhausted its retries leaves isLoading false with the
list empty, so an otherwise complete pinned load enabled pruning and dropped
every favorite key from the stored order. useFavorites now exposes the query's
success state and the pruning gate requires it, matching the pinned-order and
pinned-membership sources.

* fix: address eighth round of PR review bot findings

Identify queued assignments by token rather than by destination. Comparing
destination values cannot tell two drops onto the same project apart, so a
B, A, B run let the first B's cleanup discard an entry the still-queued later
drops owned, and the next drop was then judged against a stale project.

Report the rename ending when a row unmounts. A pinned row removed mid-rename,
for instance by unpinning the same chat from the project list that also renders
it, left its key in the renaming set and came back permanently undraggable.

* fix: address ninth round of PR review bot findings

Stand the keyboard reorder down wherever the pointer drag does. Alt/Option plus
an arrow moves the caret word-wise inside a text field, so the shortcut was
moving and saving the whole row out from under an open rename input.

Hold a settled assignment destination until a drag item shows the new project.
The mutation's cache invalidations are not awaited, so a row still reported its
old project for a moment after the write succeeded and a quick drag back to
where it started read as a no-op.

* fix: address tenth round of PR review bot findings

Serialize project assignment inside the mutation instead of at one caller. The
drag targets, the row menu and the project dialog each hold their own instance,
so a queued drop could still overwrite a newer menu write; moving the queue
down covers every surface and lets the drag helper drop its own.

Tie the live snapshot's release to the arrangement that created it. An older
write settling mid-drag cleared the newer arrangement, snapping the rows back
to a stale order while the drag still held its own, so releasing saved an order
the user could no longer see.

* fix: address eleventh round of PR review bot findings

Move assignment destination tracking next to the queue that owns it. Keeping it
in the drag helper meant a menu or dialog move left the drag helper still
reporting its own older destination, with no row left to observe that would
ever clear it, so a later move back was rejected for good.

Resolve a conversation's project from the write the mutation confirmed rather
than from whichever list rendered the row. The same chat appears in the Pinned
section and its expanded project, and those caches refresh independently, so
observing one of them was never a sound way to decide the other had caught up.
The conversation cache is written synchronously on success, which makes the
lazy self-clearing and its settled flag unnecessary.

* fix: cancel an in-flight conversation refetch before confirming an assignment

Navigation invalidates the exact conversation query, so a refetch that read the
old project can be in flight when an assignment resolves and land afterwards,
reverting the move in the cache that now answers where a conversation lives.

* fix: keep queued pinned-order writes attributable across an unmount

Refuse a queued write only when a different account is positively established.
Clearing the identity on unmount stopped stale attributions but stranded work
that belonged to the same account, since the sidebar drops the section that
owns this hook whenever a search is active, and it denied that work its
rollback as well.

Correct the cache from the request rather than from onError. The observer
callbacks do not run once that section unmounts, so an order the server never
accepted could survive on a query that refetches on nothing.

* fix: publish the session identity from the user atom

Queued pinned-order writes were attributed by a tracker that only the pinned
section's hook updated, and the sidebar unmounts that section during a search.
A retained value went stale across a sign-in, and login clears the user query
before the next account's fetch resolves, so a write queued by the previous
account could pass its own check and post on the new account's credentials.

A Recoil atom effect publishes the identity instead: it runs wherever the atom
is set, including sign-out, so attribution comes from the state itself rather
than from a component that happens to be mounted. That makes a signed-out
session foreign to every owner and lets the check be a strict comparison again,
rather than a rule that had to guess when identity was merely unreadable.

* fix: discard reorders that ended on a refused external target

A drop the pinned rows did not handle usually means a reorder, but a project
row or the Chats section refusing one reports the same, so dragging a chat onto
the project it already belongs to was saving the incidental shift its pointer
caused on the way out.

The rows and those targets now report their hovers, so the last one under the
pointer settles it, which also allows for a drag that strays over a project and
returns to reorder after all.

* fix: attribute queued writes to the credentials they will travel with

Publishing the account from React state, whether an effect or a Recoil atom
effect, always lagged the credential change: setUserContext installs the new
Authorization header in one synchronous call, and a write queued by the
previous account and sent in that gap read its own owner back and went out as
the new one. A test against the atom effect showed onSet is deferred too, so
the atom was no better than the effect it replaced.

The header is the thing that decides who the server sees, so ownership is read
from it. The id claim is compared rather than the token, since a silent refresh
rotates the token for the same account and discarding that work would strand
something the user is still entitled to.

Leaves AuthContext and the user atom untouched.

* fix: attribute a reorder to the account that started it

onMutate awaits cancelQueries before the request is built, and the mutation
function was reading the session again afterwards, so credentials turning over
inside that gap sent one account's order as the next. The owner is now recorded
in onMutate's first synchronous statement and carried on the order itself, and
the optimistic write is skipped when the session moved on, since that cache is
shared and showing an order to the wrong account is the same mistake as sending
it.

Record a pinned hover before the guards rather than after. Hovering the dragged
row is a no-op for ordering but still means the pointer is inside the list, so
a drag that wandered onto a project and returned to its own position was being
discarded as a filing action.

* fix: address a further round of PR review bot findings

Mark a hover anywhere in the pinned section as internal. The header and the
padding around the rows are part of the list, so a drag that wandered onto a
project and came back to rest on one of them ran no row hover and was discarded
as a filing action.

Hold off pruning while a favorites write is unsettled. The earlier GET's
success stands through an optimistic removal, so pruning then dropped the
ordering key of a write that had not landed, and a failed one came back without
its saved position.

Declare the reorder shortcut on the elements that take focus. The section's
written hint is skipped by anyone tabbing straight to a row, leaving the only
non-pointer way to reorder undiscoverable.

* fix: reach a real New Chat control, and let the shortcut prop through the memo

The unpin fallback looked for a test id no component carries, so once the last
pinned row unmounted focus fell to the document rather than to New Chat. It now
tries the controls that exist, in sidebar order. The test that covered this had
fabricated the missing id, so it proved nothing.

Convo is memoized on conversation fields and isGenerating alone, so the
shortcut appearing once the pinned order loaded never reached the element that
announces it. The comparator now accounts for it.

* fix: identify OpenID sessions, and see favorites writes from every hook

With OpenID token reuse the bearer is the provider's own id_token, which names
its subject as sub under an issuer and carries no LibreChat id, so every such
session resolved to nobody and two different accounts compared equal. That is
the case the ownership guard exists for, so it read as safe while being exactly
wrong. Sessions are identified by whatever the credential offers now, and an
owner that cannot be identified is foreign to everything including itself.

Count favorites writes across the query client rather than from one observer.
A favorite row runs its own useFavorites, so a removal started there was
invisible to the pinned section and its ordering key could still be pruned.

* fix: close the assignment cache gap, and let a failed drain be retried

The assignment released its pending destination as soon as the request settled,
while the cache write waited on an awaited cancellation in onSuccess. A drag
started in that gap saw neither, fell back to the stale row and refused a valid
drop. The write now happens in the request, before the entry is released, which
also survives the owning component unmounting.

Also clear the pagination guard when the Chats section collapses. A drain that
exhausted its retries leaves the conversations array unchanged, so the guard
barred every later attempt and the remaining chats stayed unreachable for the
session. Reopening the section now tries once more. That guard came from #14860
rather than this branch, so it can be split out if preferred.

* fix: compose the marketplace link, and keep focus on a surviving row

The marketplace control was a raw link with restated appearance classes, and
in restating them it left out the focus ring entirely, so keyboard focus on it
was invisible. It composes through the shared button now, which carries the
ring, the hover fill and the theme timing.

Unpinning from a project list leaves the row in place but removes the pin badge
that had focus, and the pinned-section successor search deliberately returns
nothing there, so focus fell to the document. It moves to the row's own link.

Reconcile the pinned order on window focus and reconnect. It is one shared
per-user record, so a second tab would otherwise show a stale arrangement and
its next reorder would post a full array undoing the other tab's.

* fix: keep a rename from restoring a conversation's other fields

A rename request carries only a title, but its response is the whole
conversation as the server saw it, and writing all of that back restores the
pre-request value of every other field. An assignment confirmed while the
rename was in flight was therefore reverted in the cache that now answers which
project a conversation belongs to, and a drag back to the original project read
as a no-op.

Only the title and its timestamp are taken from the response. Cancelling
queries cannot help here, since this is another mutation's write rather than a
fetch.

* fix: compose the unpin badge through the shared row-action button

The badge restated a reusable icon control's sizing, radius, hover and focus
classes. The client package already had a row-action variant and an icon-xs
size that match it exactly, so it uses those instead of its own copy.

* fix: reconcile before reordering, and scope assignments to their session

A reorder stayed enabled while the order's focus refetch was in flight, so
returning to a tab could cancel that refetch and post the arrangement it was
about to replace. Pruning had the matching gap: the pinned list keeps its data
fresh for five minutes, so a tab whose order had reconciled could prune against
membership that had not, dropping the position of a conversation another tab
pinned. Both now wait for data that is settled and not stale.

Assignments carry the account that started them, like the order writes already
did. Conversation ids are per-user, so a queued one travelling with the next
account's credentials would act on whatever that id names over there, and its
answer would describe one account's conversation to another in a cache that is
not scoped by user.

The row's overflow trigger derives from the shared row-action variant too, so
the two actions in a row stop keeping separate copies of the same recipe.

* fix: reject foreign assignment results, and share the section header

An assignment settling after a session change returned normally, so the success
path still ran: the caller reported success and the response could be applied to
the next account's conversation, since ids repeat across accounts. It rejects
now, so nothing downstream treats it as a result.

The collapsible section header existed as three identical copies, Chats,
Projects and Pinned, and this branch added the third. It moves into the shared
button as a section-header variant and all three compose from it.

* fix: let favorites membership reconcile between tabs

The favorites query disabled focus, reconnect and mount refetches, so a second
tab kept its old list indefinitely. Its pruning gate waits for a fetch, and
none was ever going to happen, so a reorder there could delete the saved
position of a favorite the first tab had added. It reconciles on focus and
reconnect now, like the order it is arranged alongside.

* fix: hold reconciling refetches off while a write is in flight

Enabling focus and reconnect refetches on the order and favorites queries let
one start after onMutate's single cancellation, read the pre-write state and
land after the write, putting the old value back. Both now decline those
refetches while a write for that resource is outstanding, keeping the cross-tab
reconciliation itself.

The check asks the query client at the moment the event fires rather than
reading useIsMutating: that hook only reaches the query's options on the next
render, which is a race against the very event being gated. A test that
dispatches focus mid-write fails without it.

* fix: release abandoned assignments and gate pruning on current membership

An assignment rejected before entering the try block kept its pending entry
forever, so a later session read a destination that was never sent. The
ownership check now sits inside the block that releases it, and it runs again
after the conversation query cancellation resolves, since the session can turn
over while that await is pending.

Pruning the pinned order now requires membership at least as current as the
order it is pruned against. The pinned query holds its data for five minutes
while the order has no such window, so focusing a tab reconciled the order
alone and the next reorder dropped the key of a conversation another tab had
pinned in between.

The assignment spec resets its mocks between tests and gives each test its own
conversation id, so one test's unconsumed mock and leftover queue entries no
longer decide the next test's result.

* fix: address the sixth round of review findings on the pinned section

The section header recipe asked for the shared button variant without a size,
so CVA emitted the default `h-10 px-4` after it and the merge kept it, putting
a 40px control in a 32px header row. The variant opts out of default sizing
through a compound now, since a heading is sized by its own text.

Restore the search field's focus border. Removing it left keyboard focus
signalled only by a background change that hover already uses, so the field
had no distinguishable focus state at all.

An assignment can reach the database before a concurrent rename and still
answer after it, carrying a conversation that predates the rename. Only the
project field is merged into the cached conversation and published to the
active one now, matching what the rename handler already does.

An order refetch that starts mid drag no longer lets the drop post an array
built from the order that refetch is about to replace: the arrangement is held
and written once the fresh order lands. Reorder writes superseded by a newer
arrangement are skipped rather than sent, so holding the shortcut costs two
writes instead of one per intermediate position. The order and favorites
queries reconcile on mount as well, since a sidebar search unmounts the
section and a query with no observer never sees the focus event.

* fix: preserve pinned order until favorites membership catches up

* fix: reconcile pinned membership and preserve auth and focus state

* fix: preserve reconciled keys during active pinned arrangements

* style: sort pinned order regression imports

* fix: reconcile favorite rollbacks before pinned-order pruning

* 🧊 fix: Withhold Rerun Controls on Compaction Turns (#15797)

* 🧊 fix: Withhold Rerun Controls on Compaction Turns

A compaction turn's response parents onto the leaf it summarized, not onto a
user message, so the hover Edit's Rerun replayed an assistant message in the
user slot: the request minted a user message under the existing assistant
leaf's id and ran the turn with empty text, which fails. Editing offered
nothing either, since SUMMARY is not an editable part type.

Edit, Regenerate and Continue are now withheld on a compaction turn, and both
rerun paths refuse a parent that is not user-created, matching the guard
`useChatFunctions.regenerate` already applied.

* 🧭 fix: Gate Rerun Controls on the Replayed Parent Turn

Withholding Edit, Regenerate and Continue on summary-only content also hit an
ordinary turn that auto-summarized and was cancelled before its first answer
token: that response is parented to the user's message and is exactly the turn
a rerun is for. The row now resolves the message it would replay and withholds
the rerun shapes only when a model turn hangs off another model turn, which is
the manual compaction shape. An unresolvable parent withholds nothing.

`isCompactionTurn` is gone with it, and `isCompactedLeaf` keeps its original
body; its docstring now says per part what it always measured per part.

* 🧮 fix: Identify a Compaction Turn by Content and Parent

Gating the rerun controls on parent authorship alone withheld Edit, Regenerate
and Continue from any model turn hanging off another model turn. An imported
conversation chains messages sequentially, so a skipped empty human message
leaves an ordinary reply parented to the previous reply; its stored content is
editable and its controls must stay. It also made every model row resolve its
parent out of the flat message list: 100 full-thread scans while mounting a
200-message conversation.

A manual compaction is now both halves of its shape — summary-only content and
a parent that is not the user's turn — so only such a row consults the thread.
`isSummaryOnlyContent` is the content half, in data-provider next to
`isCompactedLeaf`.

* 🧷 test: Pin the Rerun Refusal on a Chained Model Turn

A rerun replays its parent as the user turn, so a model turn parented onto
another model turn must submit nothing rather than mint a user message under an
existing response's id. Removing the guard makes the case call `ask` once.

* 🧱 fix: Gate the Editor on Content and the Rerun on the Parent

Identifying a compaction turn by content shape missed the ones the server
persists with an error part (a skipped or failed compaction keeps its
explanation instead of a summary), which left Edit, Regenerate and Continue on
a turn where every rerun shape is inert.

The two controls answer two different questions now. A rerun replays the
message's parent as the turn's user message, so Regenerate and Continue go
whenever a model turn hangs off a model turn. The editor goes only when that
turn also has no part to type in: an imported chain's reply is saved directly
and stays editable, while a compaction — summary or error part — would open an
empty editor with one inert Rerun.

`findMessageById` indexes the messages array once per identity, so resolving
the parent no longer scans the thread per row: 100 full-array walks while
mounting a 200-message conversation become one.

* 🏷️ fix: Honor the Server's Compaction Marker on Any Leaf

Compact runs on whatever leaf the branch ends with, so a compaction can hang off
a user message rather than off the answer it summarized. Inferring the turn from
its position alone left the rerun controls on that one: replaying the parent
would answer the user's earlier message again instead of redoing the compaction.

`isUserInitiatedCompaction` reads the marker the server already stamps —
`markCompactionSummary` sets `initiatedBy: 'user'`, and nothing else writes it,
so an automatic summary detour keeps its controls. A marked turn is excluded
from the rerun shapes wherever it hangs.

* 🎨 fix: Ask the Editor What It Can Edit

The hover row had its own idea of an editable part and counted artifact-bearing
text as one, while `EditContentParts` keeps an artifact in its read-only
renderer. A chained model turn whose only content is an artifact therefore still
offered Edit, and opening it gave a read-only artifact, a disabled Save and a
Rerun the guards refuse.

`editableParts.ts` now owns that rule for both: `isEditablePart` is the
editor's own filter, `hasEditablePart` asks it per message. The row resolves it
lazily — the artifact check parses markdown, and only a turn with nothing to
replay needs the answer — so a streaming row never pays for it.

* 🚫 fix: Withhold the Editor's Rerun Instead of Refusing It

Both editors resolved the parent inside the handler and returned when it was not
a user turn, so a chained model turn — an imported thread with no user message
between two replies — kept an enabled Rerun that did nothing, with Ctrl/Cmd+Enter
bound to it.

Each editor resolves that parent at render and withholds the action instead: the
button is gone, the shortcut is inert and `aria-keyshortcuts` no longer advertises
it, while Save keeps writing the edit. An unresolvable parent keeps the action,
matching the hover row.

* 🧹 style: Sort the New Imports in Both Editors

CI's import-sort check failed on the two files the previous commit touched.

* 💬 fix: Report Unsaved Changes When No Rerun Is Offered

A save-only editor still warned about the rerun. An answer's draft is discarded
by the rerun, and multi-part edits must be saved before one, but neither is true
where the action is withheld — a model turn chained onto another model turn — so
the status slot claimed a precondition for something the footer does not offer.

Both statuses are gated on the same `canRerun` the button is: the plain-text
editor reports unsaved changes, and `rerunRequiresSave` cannot hold without a
rerun to require it.

* 🧪 test: Exercise the Compaction Controls in the Browser

Eight mock-harness scenarios drive the real row and the real editors: a
finished, failed, error-part and user-parented compaction withhold Edit,
Regenerate and Continue while Copy stays; a turn that only auto-summarized
keeps all three; a reply chained onto a reply keeps a save-only editor whose
status reports unsaved changes; an artifact-only chained reply loses the
editor; and the context indicator still offers Compact after a failed
compaction.

`SeedMessage` carries `content`, `finish_reason` and `model` so a branch can be
seeded in the shapes the mock model cannot produce — a persisted summary, an
error part, an artifact.

* 🩻 feat: improve agent filter controls for insights (#15807)

* feat(insights): improve agent filter controls

* feat(insights): add search and fixed agent selection controls

* fix(insights): show search before all agents control

* test(e2e): allow steer consumption before arm response

* 🔠 fix: Name Artifact Downloads After Their Titles (#15836)

* fix: Use artifact titles for download filenames

* fix: Match artifact filenames to downloaded content

* fix: Preserve raw artifact extensions and GFM headings

* fix: Download complete artifact files and retain filename provenance

* fix: Distinguish cached artifact exports from originals

* fix: Name unnamed artifact originals by their media type

* fix: Recognize legacy CSV MIME in artifact filenames

* fix: preserve context insights across reloads and configuration changes

* fix: retain primary call details when resuming context snapshots

* fix: preserve resumed output and retained tool-result estimates

* fix: keep resumed output compatible with older clients

---------

Co-authored-by: Ravi Kumar L <upman@users.noreply.github.com>
Co-authored-by: Danny Avila <danny@librechat.ai>
2026-09-11 15:53:29 -04:00
Danny Avila
ab506011e5
🔠 fix: Name Artifact Downloads After Their Titles (#15836)
* fix: Use artifact titles for download filenames

* fix: Match artifact filenames to downloaded content

* fix: Preserve raw artifact extensions and GFM headings

* fix: Download complete artifact files and retain filename provenance

* fix: Distinguish cached artifact exports from originals

* fix: Name unnamed artifact originals by their media type

* fix: Recognize legacy CSV MIME in artifact filenames
2026-09-11 14:57:19 -04:00
Ravi Kumar L
980f3ede77
🩻 feat: improve agent filter controls for insights (#15807)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
* feat(insights): improve agent filter controls

* feat(insights): add search and fixed agent selection controls

* fix(insights): show search before all agents control

* test(e2e): allow steer consumption before arm response
2026-09-11 10:54:37 -04:00
Marco Beretta
afaf22f608
🧊 fix: Withhold Rerun Controls on Compaction Turns (#15797)
* 🧊 fix: Withhold Rerun Controls on Compaction Turns

A compaction turn's response parents onto the leaf it summarized, not onto a
user message, so the hover Edit's Rerun replayed an assistant message in the
user slot: the request minted a user message under the existing assistant
leaf's id and ran the turn with empty text, which fails. Editing offered
nothing either, since SUMMARY is not an editable part type.

Edit, Regenerate and Continue are now withheld on a compaction turn, and both
rerun paths refuse a parent that is not user-created, matching the guard
`useChatFunctions.regenerate` already applied.

* 🧭 fix: Gate Rerun Controls on the Replayed Parent Turn

Withholding Edit, Regenerate and Continue on summary-only content also hit an
ordinary turn that auto-summarized and was cancelled before its first answer
token: that response is parented to the user's message and is exactly the turn
a rerun is for. The row now resolves the message it would replay and withholds
the rerun shapes only when a model turn hangs off another model turn, which is
the manual compaction shape. An unresolvable parent withholds nothing.

`isCompactionTurn` is gone with it, and `isCompactedLeaf` keeps its original
body; its docstring now says per part what it always measured per part.

* 🧮 fix: Identify a Compaction Turn by Content and Parent

Gating the rerun controls on parent authorship alone withheld Edit, Regenerate
and Continue from any model turn hanging off another model turn. An imported
conversation chains messages sequentially, so a skipped empty human message
leaves an ordinary reply parented to the previous reply; its stored content is
editable and its controls must stay. It also made every model row resolve its
parent out of the flat message list: 100 full-thread scans while mounting a
200-message conversation.

A manual compaction is now both halves of its shape — summary-only content and
a parent that is not the user's turn — so only such a row consults the thread.
`isSummaryOnlyContent` is the content half, in data-provider next to
`isCompactedLeaf`.

* 🧷 test: Pin the Rerun Refusal on a Chained Model Turn

A rerun replays its parent as the user turn, so a model turn parented onto
another model turn must submit nothing rather than mint a user message under an
existing response's id. Removing the guard makes the case call `ask` once.

* 🧱 fix: Gate the Editor on Content and the Rerun on the Parent

Identifying a compaction turn by content shape missed the ones the server
persists with an error part (a skipped or failed compaction keeps its
explanation instead of a summary), which left Edit, Regenerate and Continue on
a turn where every rerun shape is inert.

The two controls answer two different questions now. A rerun replays the
message's parent as the turn's user message, so Regenerate and Continue go
whenever a model turn hangs off a model turn. The editor goes only when that
turn also has no part to type in: an imported chain's reply is saved directly
and stays editable, while a compaction — summary or error part — would open an
empty editor with one inert Rerun.

`findMessageById` indexes the messages array once per identity, so resolving
the parent no longer scans the thread per row: 100 full-array walks while
mounting a 200-message conversation become one.

* 🏷️ fix: Honor the Server's Compaction Marker on Any Leaf

Compact runs on whatever leaf the branch ends with, so a compaction can hang off
a user message rather than off the answer it summarized. Inferring the turn from
its position alone left the rerun controls on that one: replaying the parent
would answer the user's earlier message again instead of redoing the compaction.

`isUserInitiatedCompaction` reads the marker the server already stamps —
`markCompactionSummary` sets `initiatedBy: 'user'`, and nothing else writes it,
so an automatic summary detour keeps its controls. A marked turn is excluded
from the rerun shapes wherever it hangs.

* 🎨 fix: Ask the Editor What It Can Edit

The hover row had its own idea of an editable part and counted artifact-bearing
text as one, while `EditContentParts` keeps an artifact in its read-only
renderer. A chained model turn whose only content is an artifact therefore still
offered Edit, and opening it gave a read-only artifact, a disabled Save and a
Rerun the guards refuse.

`editableParts.ts` now owns that rule for both: `isEditablePart` is the
editor's own filter, `hasEditablePart` asks it per message. The row resolves it
lazily — the artifact check parses markdown, and only a turn with nothing to
replay needs the answer — so a streaming row never pays for it.

* 🚫 fix: Withhold the Editor's Rerun Instead of Refusing It

Both editors resolved the parent inside the handler and returned when it was not
a user turn, so a chained model turn — an imported thread with no user message
between two replies — kept an enabled Rerun that did nothing, with Ctrl/Cmd+Enter
bound to it.

Each editor resolves that parent at render and withholds the action instead: the
button is gone, the shortcut is inert and `aria-keyshortcuts` no longer advertises
it, while Save keeps writing the edit. An unresolvable parent keeps the action,
matching the hover row.

* 🧹 style: Sort the New Imports in Both Editors

CI's import-sort check failed on the two files the previous commit touched.

* 💬 fix: Report Unsaved Changes When No Rerun Is Offered

A save-only editor still warned about the rerun. An answer's draft is discarded
by the rerun, and multi-part edits must be saved before one, but neither is true
where the action is withheld — a model turn chained onto another model turn — so
the status slot claimed a precondition for something the footer does not offer.

Both statuses are gated on the same `canRerun` the button is: the plain-text
editor reports unsaved changes, and `rerunRequiresSave` cannot hold without a
rerun to require it.

* 🧪 test: Exercise the Compaction Controls in the Browser

Eight mock-harness scenarios drive the real row and the real editors: a
finished, failed, error-part and user-parented compaction withhold Edit,
Regenerate and Continue while Copy stays; a turn that only auto-summarized
keeps all three; a reply chained onto a reply keeps a save-only editor whose
status reports unsaved changes; an artifact-only chained reply loses the
editor; and the context indicator still offers Compact after a failed
compaction.

`SeedMessage` carries `content`, `finish_reason` and `model` so a branch can be
seeded in the shapes the mock model cannot produce — a persisted summary, an
error part, an artifact.
2026-09-11 10:41:50 -04:00
Marco Beretta
e75835e327
📌 feat: Unified Pinned Section With Sidebar Drag Interactions (#15057)
* feat: unified pinned section with drag interactions and sidebar polish

- Pinned chats and favorite models/agents/specs render as one interleaved,
  reorderable list persisted via users.pinnedOrder
- Drag conversations onto project rows to file them, onto Chats to unfile,
  and onto the Pinned section to pin (empty section materializes as a drop
  zone during a conversation drag)
- Row-level unpin button on pinned chats matching the favorites' button,
  and the row action menu shares the same hover/focus treatment
- Agent Marketplace entry moved under the New Chat button in the side rail
- Bookmarks trigger sized to the search bar, search focus no longer swaps
  its border color, tag filtering shows a loading state, and opening a
  project shows row-shaped skeletons

* fix: add pinnedOrder to IUser type and sort imports

* fix: pinned drag threshold, unpin focus target, and marketplace link

* fix: surface failed pinned reorders and skip no-op order writes

* fix: address review findings on unified pinned section

Move the pinned-order endpoints into packages/api as TypeScript handlers and
route their URLs through the data-provider endpoint registry. Raise the entry
and key caps so a valid model favorite and an unbounded pin count can both be
persisted.

Keep the marketplace entry reachable from the mobile drawer, which is the only
sidebar surface on small screens. Merge a reorder into the stored order while a
bookmark filter hides part of the list, instead of dropping the hidden keys.
Add Alt+Arrow keyboard reordering with a live-region announcement, restore the
focus handoff when a favorite is removed, and hold the local arrangement until
the stored order catches up. Serialize overlapping order writes and discard the
optimistic value when the first one fails. Derive the tag-filter loading state
from isPreviousData rather than a flag that could stick on.

* fix: release drag while renaming and dedupe repeated favorite keys

A draggable ancestor swallows drag-select inside the rename input, so both the
row's own drag source and the pinned wrapper's release while a title is being
edited.

The favorites payload validator accepts a repeated entry, and two rows keyed
the same would collide in React, point every drag at the first copy, and fail
the order endpoint's uniqueness check. Build the pinned list keyed-unique.

* fix: address PR review bot findings

Make the model favorite key injective. Joining endpoint and model on '::'
collided for components containing the delimiter, so two distinct favorites
keyed the same and the dedupe hid one; the endpoint is now length-prefixed.

Replace the pinned-order entry cap with a total size guard. Pinning has no
membership cap and the sidebar query drains every cursor, so any count limit
rejects a legitimate list rather than bounding anything; what needs bounding is
the user document.

Let only the newest order write touch the cache. An earlier write failing
rolled back over a newer arrangement that was still in flight, leaving the UI
on a stale order while the server held the current one. A confirmed write now
takes the server's answer, and a failed newest write discards the value that
was never accepted.

Persist the favorites array only once the order write succeeds, so a rejected
write cannot leave the two stores disagreeing with the rolled-back display.

* fix: address second round of PR review bot findings

Read favorites membership at write time rather than capturing it at drag end.
A favorite added or removed while the order request was in flight was undone by
writing the older list back; only the relative order now comes from the drag.

Move the pinned-order queue to module scope. The sidebar unmounts whole
sections while a search is active, so a component-local ref let a remounted
hook start a second queue alongside a request that was still running.

Serialize project assignment per conversation. Every drop target owns its own
mutation instance and the write is an unconditional update, so two quick drops
let whichever request reached the database last decide the project.

Read the pinned-order request body null-safely: destructuring a nullish body
threw past the handler into Express's generic error path instead of returning
the intended 400.

* fix: address third round of PR review bot findings

Drop the secondary favorites write. No consumer of the favorites array reads
its order, so mirroring the arrangement there bought nothing while racing the
membership mutations that share that whole-array endpoint; pinnedOrder is the
single source of ordering.

Always merge the committed order into the stored one. The visible list is not
always the whole list, since a bookmark filter hides rows and the pinned query
publishes partial results while draining its cursor, and replacing wholesale
dropped every key it could not see.

Release the local arrangement when the write settles instead of when the stored
order matches it key for key. A pin arriving mid-request made that equality
unreachable, stranding the snapshot and hiding the new row until remount.

Abandon a queued pinned-order write if the signed-in user changed, so a
deferred request cannot write one account's order into another's document.

* fix: address fourth round of PR review bot findings

Guard the pinned-order completion callbacks on the signed-in account. The
pre-send check only covers a write that has not left yet; a response arriving
after a session change would publish one account's order into the next one's
cache, which this query never refetches on its own.

Commit a reorder only when the pinned rows handled the drop. Dragging a pin
onto a project row or into Chats sweeps the pointer across sibling rows, whose
hover handlers shift the order, so a filing action was also saving a move the
user never asked for.

* fix: address fifth round of PR review bot findings

Deselect pinnedOrder at schema level. It is display-only and allowed to grow
large, but every authentication request loads the user document, so it was
adding its whole payload to paths that never read it.

Refuse to reorder until the stored order has loaded. Merging against an absent
order and then cancelling its fetch posted only the visible keys and discarded
saved positions for good.

Prune keys only once the visible list is known to be the whole list. Merging
unconditionally grew the array until the size guard rejected every write, so
completeness now gates compaction rather than the filter flag alone.

Track every renaming row, not just the most recent. RenameForm has no blur
cancellation, so a second form can open while the first is still mounted and
the single key reconnected the first row's drag source under its open input.

Judge drop eligibility by the queued destination. A drag item carries the
project its row had when the drag began, so re-dropping a chat back where it
started while an assignment was queued read as a no-op.

Take mutation ownership from the user atom AuthContext fills on login rather
than the user query, which is still empty in that window, and never treat an
unknown owner as a match.

Restore the pinned section's 30vh cap. Matching the Projects section's 42vh put
84vh of non-shrinking content above Chats and starved it on short viewports.

* fix: address sixth round of PR review bot findings

Gate reordering and pruning on successful fetches rather than attempted ones.
A failed pinned-order GET still reports as fetched, and a failed later page of
the pinned drain still publishes partial data and stops fetching, so both gates
were opening on exactly the states they were meant to exclude.

Scope the post-unpin focus handoff to this section by its own marker. The whole
conversations pane is a labelled region too, and the project lists inside it
render the same row, where unpinning only clears the flag and the row stays
put, so focus was being moved off a row that never went away.

Clear the account tracker when the mutation hook unmounts. The sidebar drops
that section during a search, leaving a stale non-null id that also shadowed
the cache fallback, so a deferred write could pass its owner check after a
session change.

* fix: gate pruning on a delivered favorites list

A favorites fetch that exhausted its retries leaves isLoading false with the
list empty, so an otherwise complete pinned load enabled pruning and dropped
every favorite key from the stored order. useFavorites now exposes the query's
success state and the pruning gate requires it, matching the pinned-order and
pinned-membership sources.

* fix: address eighth round of PR review bot findings

Identify queued assignments by token rather than by destination. Comparing
destination values cannot tell two drops onto the same project apart, so a
B, A, B run let the first B's cleanup discard an entry the still-queued later
drops owned, and the next drop was then judged against a stale project.

Report the rename ending when a row unmounts. A pinned row removed mid-rename,
for instance by unpinning the same chat from the project list that also renders
it, left its key in the renaming set and came back permanently undraggable.

* fix: address ninth round of PR review bot findings

Stand the keyboard reorder down wherever the pointer drag does. Alt/Option plus
an arrow moves the caret word-wise inside a text field, so the shortcut was
moving and saving the whole row out from under an open rename input.

Hold a settled assignment destination until a drag item shows the new project.
The mutation's cache invalidations are not awaited, so a row still reported its
old project for a moment after the write succeeded and a quick drag back to
where it started read as a no-op.

* fix: address tenth round of PR review bot findings

Serialize project assignment inside the mutation instead of at one caller. The
drag targets, the row menu and the project dialog each hold their own instance,
so a queued drop could still overwrite a newer menu write; moving the queue
down covers every surface and lets the drag helper drop its own.

Tie the live snapshot's release to the arrangement that created it. An older
write settling mid-drag cleared the newer arrangement, snapping the rows back
to a stale order while the drag still held its own, so releasing saved an order
the user could no longer see.

* fix: address eleventh round of PR review bot findings

Move assignment destination tracking next to the queue that owns it. Keeping it
in the drag helper meant a menu or dialog move left the drag helper still
reporting its own older destination, with no row left to observe that would
ever clear it, so a later move back was rejected for good.

Resolve a conversation's project from the write the mutation confirmed rather
than from whichever list rendered the row. The same chat appears in the Pinned
section and its expanded project, and those caches refresh independently, so
observing one of them was never a sound way to decide the other had caught up.
The conversation cache is written synchronously on success, which makes the
lazy self-clearing and its settled flag unnecessary.

* fix: cancel an in-flight conversation refetch before confirming an assignment

Navigation invalidates the exact conversation query, so a refetch that read the
old project can be in flight when an assignment resolves and land afterwards,
reverting the move in the cache that now answers where a conversation lives.

* fix: keep queued pinned-order writes attributable across an unmount

Refuse a queued write only when a different account is positively established.
Clearing the identity on unmount stopped stale attributions but stranded work
that belonged to the same account, since the sidebar drops the section that
owns this hook whenever a search is active, and it denied that work its
rollback as well.

Correct the cache from the request rather than from onError. The observer
callbacks do not run once that section unmounts, so an order the server never
accepted could survive on a query that refetches on nothing.

* fix: publish the session identity from the user atom

Queued pinned-order writes were attributed by a tracker that only the pinned
section's hook updated, and the sidebar unmounts that section during a search.
A retained value went stale across a sign-in, and login clears the user query
before the next account's fetch resolves, so a write queued by the previous
account could pass its own check and post on the new account's credentials.

A Recoil atom effect publishes the identity instead: it runs wherever the atom
is set, including sign-out, so attribution comes from the state itself rather
than from a component that happens to be mounted. That makes a signed-out
session foreign to every owner and lets the check be a strict comparison again,
rather than a rule that had to guess when identity was merely unreadable.

* fix: discard reorders that ended on a refused external target

A drop the pinned rows did not handle usually means a reorder, but a project
row or the Chats section refusing one reports the same, so dragging a chat onto
the project it already belongs to was saving the incidental shift its pointer
caused on the way out.

The rows and those targets now report their hovers, so the last one under the
pointer settles it, which also allows for a drag that strays over a project and
returns to reorder after all.

* fix: attribute queued writes to the credentials they will travel with

Publishing the account from React state, whether an effect or a Recoil atom
effect, always lagged the credential change: setUserContext installs the new
Authorization header in one synchronous call, and a write queued by the
previous account and sent in that gap read its own owner back and went out as
the new one. A test against the atom effect showed onSet is deferred too, so
the atom was no better than the effect it replaced.

The header is the thing that decides who the server sees, so ownership is read
from it. The id claim is compared rather than the token, since a silent refresh
rotates the token for the same account and discarding that work would strand
something the user is still entitled to.

Leaves AuthContext and the user atom untouched.

* fix: attribute a reorder to the account that started it

onMutate awaits cancelQueries before the request is built, and the mutation
function was reading the session again afterwards, so credentials turning over
inside that gap sent one account's order as the next. The owner is now recorded
in onMutate's first synchronous statement and carried on the order itself, and
the optimistic write is skipped when the session moved on, since that cache is
shared and showing an order to the wrong account is the same mistake as sending
it.

Record a pinned hover before the guards rather than after. Hovering the dragged
row is a no-op for ordering but still means the pointer is inside the list, so
a drag that wandered onto a project and returned to its own position was being
discarded as a filing action.

* fix: address a further round of PR review bot findings

Mark a hover anywhere in the pinned section as internal. The header and the
padding around the rows are part of the list, so a drag that wandered onto a
project and came back to rest on one of them ran no row hover and was discarded
as a filing action.

Hold off pruning while a favorites write is unsettled. The earlier GET's
success stands through an optimistic removal, so pruning then dropped the
ordering key of a write that had not landed, and a failed one came back without
its saved position.

Declare the reorder shortcut on the elements that take focus. The section's
written hint is skipped by anyone tabbing straight to a row, leaving the only
non-pointer way to reorder undiscoverable.

* fix: reach a real New Chat control, and let the shortcut prop through the memo

The unpin fallback looked for a test id no component carries, so once the last
pinned row unmounted focus fell to the document rather than to New Chat. It now
tries the controls that exist, in sidebar order. The test that covered this had
fabricated the missing id, so it proved nothing.

Convo is memoized on conversation fields and isGenerating alone, so the
shortcut appearing once the pinned order loaded never reached the element that
announces it. The comparator now accounts for it.

* fix: identify OpenID sessions, and see favorites writes from every hook

With OpenID token reuse the bearer is the provider's own id_token, which names
its subject as sub under an issuer and carries no LibreChat id, so every such
session resolved to nobody and two different accounts compared equal. That is
the case the ownership guard exists for, so it read as safe while being exactly
wrong. Sessions are identified by whatever the credential offers now, and an
owner that cannot be identified is foreign to everything including itself.

Count favorites writes across the query client rather than from one observer.
A favorite row runs its own useFavorites, so a removal started there was
invisible to the pinned section and its ordering key could still be pruned.

* fix: close the assignment cache gap, and let a failed drain be retried

The assignment released its pending destination as soon as the request settled,
while the cache write waited on an awaited cancellation in onSuccess. A drag
started in that gap saw neither, fell back to the stale row and refused a valid
drop. The write now happens in the request, before the entry is released, which
also survives the owning component unmounting.

Also clear the pagination guard when the Chats section collapses. A drain that
exhausted its retries leaves the conversations array unchanged, so the guard
barred every later attempt and the remaining chats stayed unreachable for the
session. Reopening the section now tries once more. That guard came from #14860
rather than this branch, so it can be split out if preferred.

* fix: compose the marketplace link, and keep focus on a surviving row

The marketplace control was a raw link with restated appearance classes, and
in restating them it left out the focus ring entirely, so keyboard focus on it
was invisible. It composes through the shared button now, which carries the
ring, the hover fill and the theme timing.

Unpinning from a project list leaves the row in place but removes the pin badge
that had focus, and the pinned-section successor search deliberately returns
nothing there, so focus fell to the document. It moves to the row's own link.

Reconcile the pinned order on window focus and reconnect. It is one shared
per-user record, so a second tab would otherwise show a stale arrangement and
its next reorder would post a full array undoing the other tab's.

* fix: keep a rename from restoring a conversation's other fields

A rename request carries only a title, but its response is the whole
conversation as the server saw it, and writing all of that back restores the
pre-request value of every other field. An assignment confirmed while the
rename was in flight was therefore reverted in the cache that now answers which
project a conversation belongs to, and a drag back to the original project read
as a no-op.

Only the title and its timestamp are taken from the response. Cancelling
queries cannot help here, since this is another mutation's write rather than a
fetch.

* fix: compose the unpin badge through the shared row-action button

The badge restated a reusable icon control's sizing, radius, hover and focus
classes. The client package already had a row-action variant and an icon-xs
size that match it exactly, so it uses those instead of its own copy.

* fix: reconcile before reordering, and scope assignments to their session

A reorder stayed enabled while the order's focus refetch was in flight, so
returning to a tab could cancel that refetch and post the arrangement it was
about to replace. Pruning had the matching gap: the pinned list keeps its data
fresh for five minutes, so a tab whose order had reconciled could prune against
membership that had not, dropping the position of a conversation another tab
pinned. Both now wait for data that is settled and not stale.

Assignments carry the account that started them, like the order writes already
did. Conversation ids are per-user, so a queued one travelling with the next
account's credentials would act on whatever that id names over there, and its
answer would describe one account's conversation to another in a cache that is
not scoped by user.

The row's overflow trigger derives from the shared row-action variant too, so
the two actions in a row stop keeping separate copies of the same recipe.

* fix: reject foreign assignment results, and share the section header

An assignment settling after a session change returned normally, so the success
path still ran: the caller reported success and the response could be applied to
the next account's conversation, since ids repeat across accounts. It rejects
now, so nothing downstream treats it as a result.

The collapsible section header existed as three identical copies, Chats,
Projects and Pinned, and this branch added the third. It moves into the shared
button as a section-header variant and all three compose from it.

* fix: let favorites membership reconcile between tabs

The favorites query disabled focus, reconnect and mount refetches, so a second
tab kept its old list indefinitely. Its pruning gate waits for a fetch, and
none was ever going to happen, so a reorder there could delete the saved
position of a favorite the first tab had added. It reconciles on focus and
reconnect now, like the order it is arranged alongside.

* fix: hold reconciling refetches off while a write is in flight

Enabling focus and reconnect refetches on the order and favorites queries let
one start after onMutate's single cancellation, read the pre-write state and
land after the write, putting the old value back. Both now decline those
refetches while a write for that resource is outstanding, keeping the cross-tab
reconciliation itself.

The check asks the query client at the moment the event fires rather than
reading useIsMutating: that hook only reaches the query's options on the next
render, which is a race against the very event being gated. A test that
dispatches focus mid-write fails without it.

* fix: release abandoned assignments and gate pruning on current membership

An assignment rejected before entering the try block kept its pending entry
forever, so a later session read a destination that was never sent. The
ownership check now sits inside the block that releases it, and it runs again
after the conversation query cancellation resolves, since the session can turn
over while that await is pending.

Pruning the pinned order now requires membership at least as current as the
order it is pruned against. The pinned query holds its data for five minutes
while the order has no such window, so focusing a tab reconciled the order
alone and the next reorder dropped the key of a conversation another tab had
pinned in between.

The assignment spec resets its mocks between tests and gives each test its own
conversation id, so one test's unconsumed mock and leftover queue entries no
longer decide the next test's result.

* fix: address the sixth round of review findings on the pinned section

The section header recipe asked for the shared button variant without a size,
so CVA emitted the default `h-10 px-4` after it and the merge kept it, putting
a 40px control in a 32px header row. The variant opts out of default sizing
through a compound now, since a heading is sized by its own text.

Restore the search field's focus border. Removing it left keyboard focus
signalled only by a background change that hover already uses, so the field
had no distinguishable focus state at all.

An assignment can reach the database before a concurrent rename and still
answer after it, carrying a conversation that predates the rename. Only the
project field is merged into the cached conversation and published to the
active one now, matching what the rename handler already does.

An order refetch that starts mid drag no longer lets the drop post an array
built from the order that refetch is about to replace: the arrangement is held
and written once the fresh order lands. Reorder writes superseded by a newer
arrangement are skipped rather than sent, so holding the shortcut costs two
writes instead of one per intermediate position. The order and favorites
queries reconcile on mount as well, since a sidebar search unmounts the
section and a query with no observer never sees the focus event.

* fix: preserve pinned order until favorites membership catches up

* fix: reconcile pinned membership and preserve auth and focus state

* fix: preserve reconciled keys during active pinned arrangements

* style: sort pinned order regression imports

* fix: reconcile favorite rollbacks before pinned-order pruning
2026-09-11 10:41:05 -04:00
Danny Avila
e1cc0805f2
🥅 fix: Keep Mobile Composer Actions In Bounds (#15825) 2026-09-10 15:12:43 -04:00
Dustin Healy
03a42d6c7e
🎒 fix: Carry Subagent Identity Past Streaming (#15795)
* fix: resolve saved subagent display identity

* fix: persist explicit subagent execution identity
2026-09-09 23:07:10 -04:00
Danny Avila
6965f8e7d3
🛂 fix: Back Off MCP OAuth Discovery (#15783)
* fix: Back Off MCP OAuth Discovery

* fix: harden MCP discovery recovery state

* fix: synchronize MCP authorization recovery

* fix: fence MCP discovery authorization state

* fix: retain recovery generation through cache outages

* fix: close MCP authorization fence gaps

* fix: complete MCP authorization lifecycle

* fix: close MCP authorization recovery races

* fix: centralize MCP recovery lifecycle

* fix: fence ephemeral MCP catalog observers

* fix: close MCP authorization recovery races

* test: cover Redis token settlement race

* fix: prefer authoritative token settlement

* fix: harden MCP authorization retry recovery

* fix: back off stalled OAuth refreshes

* fix: bound durable authorization retries

* test: isolate authorization retry adapter

* fix: close MCP authorization recovery boundaries

* fix: defer agent authorization observers

* fix: close OAuth fence race windows

* fix: keep retry deferrals monotonic

* chore: sort startup hook imports
2026-09-09 22:21:34 -04:00
Danny Avila
442d477acf
🛎️ fix: Preflight MCP Readiness for Scheduled Chats (#15782)
* fix: Validate Scheduled MCP Readiness 🕰️

* fix: Keep Schedule Permission Store Failures Retryable

* perf: Parallelize Scheduled MCP Preflight

* fix: Preserve Scheduled MCP Invariants

* fix: Close scheduled MCP recovery gaps

* fix: harden scheduled MCP recovery

* fix: bound scheduled MCP validation

* fix: harden scheduled MCP admission bounds

* fix: align scheduled MCP graph admission

* fix: bound scheduled MCP admission

* fix: align scheduled MCP preflight with runtime

* fix: persist scheduled MCP failure outcomes

* fix: match scheduled MCP runtime semantics

* fix: parallelize scheduled MCP admissions

* fix: mirror scheduled subagent traversal

* fix: enforce scheduled subagent config limits

* fix: bound scheduled MCP initialization

* fix: mirror lazy subagent metadata budgets

* fix: complete scheduled MCP recovery

* fix: attribute missing MCP tools

* fix: harden scheduled MCP admission

* fix: preserve scheduled admission invariants

* fix: retain inaccessible MCP requirements

* fix: make MCP admission recovery durable
2026-09-09 22:18:45 -04:00
Danny Avila
ac2307b2ef
🕳️ fix: Clear Nullable Queue Anchor (#15794)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
2026-09-09 15:51:47 -04:00
Danny Avila
f0c9dee669
🫆 fix: Preserve Durable Parents for Queued Turns (#15787)
* fix: resolve queued turn placeholder anchors

* fix: anchor queued turns to durable message parents

* fix: preserve durable queued turn anchors
2026-09-09 14:54:54 -04:00
Danny Avila
6cb0499319
🌳 fix: Guard Ambiguous BYOM Workspace Selection (#15785)
* fix: Preserve BYOM workspace selection state

* 🧭 fix: Centralize Workspace Error Serialization

* 🎨 style: Format Workspace Error Helper
2026-09-09 14:27:54 -04:00
Danny Avila
559fd7d607
🪓 feat: Cancel Background Tool Invocations (#15773)
* ✨ feat: Cancel ordinary background tools

* 🛡️ fix: Keep cancellation receipts rollout-safe

* 🛡️ fix: Harden Background Tool Cancellation

* 🧪 test: Cover cancellation config wiring

* 🎨 style: Sort cancellation imports

* 🧪 test: Align Cancellation Claim Result

* 🛑 fix: Complete Background Cancellation Lifecycle

* 🎨 style: Align Cancellation Test Formatting
2026-09-09 09:06:26 -04:00
Danny Avila
2c07e28311
🪴 fix: Restore Native Workspace Selection (#15771) 2026-09-09 02:37:52 -04:00
Danny Avila
a8087ce454
🏕️ feat: Select Attached Code Workspaces (#15768)
* feat: Select Attached Code Workspaces

* fix: Preserve Workspace Boundaries Across Agent Graphs

* fix: Validate Lazy Agent Workspace Bindings Before Persistence

* fix: Include Handoff Environments in Workspace Selection

* fix: Close Workspace Admission and Remote Ingress Gaps

* fix: Preserve Workspace Selection In Chat Runtime Envelopes

* fix: Authorize Deployment Workspace Status And Match Readiness

* fix: Preserve Ephemeral Chats And Pin Runtime Worker Identity

* test: Complete Deployment Pairing Fixtures
2026-09-09 02:14:50 -04:00
Danny Avila
af6e97f0ae
🏠 fix: Keep MCP Caches Fresh on Demand (#15765)
* fix: stop refreshing MCP caches on every chat message

* fix: reconcile MCP caches independently of chat turns

* fix: scope MCP polling to visible controls

* fix: refresh status in the unpinned MCP submenu
2026-09-09 00:36:04 -04:00
Danny Avila
ec15075dc8
🚚 feat: Route Attachments and Provision Tools Lazily (#15763) 2026-09-08 23:28:52 -04:00
Danny Avila
fd229fe478
👯 fix: Collapse Radix Layer Packages to One Copy (#15742)
* 🧬 fix: Collapse Radix Layer Packages to One Copy

Radix coordinates nested layers and focus scopes through module-level state,
so a dialog and a popover inside it cooperate only while they import the same
copy of `react-dismissable-layer` / `react-focus-scope`. This tree had four
and three of them:

  dialog -> react-dialog/node_modules/…  1.0.2   (exact pin)
  select -> react-select/node_modules/…  1.1.10
  menu   -> react-menu/node_modules/…    1.1.0
  hover  -> hoisted                      1.0.5

Split that way, a popover never learns the dialog disabled body pointer
events and the dialog's focus trap is never paused, so in-dialog selects and
hover cards are inert and keyboard-dead (#15738). The exact `1.0.2` pin on
`react-dialog` and `react-alert-dialog` came from #11023, which downgraded
them from ^1.1.15 to fix modal tooltip and dropdown regressions — the same
split seen from the other side, when the dialog was the new package and
everything else was old.

Unpinning both and refreshing the other Radix packages inside their existing
carets collapses the tree to one copy of each. No `overrides` entry: the
resolution stands on its own, and pinning transitive versions would only hide
the next split. `radixLayers.spec.ts` reads the lockfile and fails if either
package is ever nested again; `dialogPopoverFocus.spec.tsx` asserts the
behaviour that invariant exists for — a portaled option holding focus inside
a dialog, which fails on the old tree and passes on this one.

Verified with a real install in a worktree: one copy of each resolved from
dialog, select and hover-card alike; `packages/client` 46 suites / 476 tests
and `client` 323 suites / 3201 tests green; both workspaces typecheck.

Needs a manual pass over the app's modals before merge — what #11023 was
guarding cannot be proven by jsdom.

* 🍞 fix: Give Escape Back to the Dialog Under a Toast

Radix routes Escape to the highest dismissable layer only, and `Toast.Root`
registers one — mounted after whatever dialog is already open. Splitting
`react-dismissable-layer` into per-package copies hid this: toasts and dialogs
were never in the same stack. Collapsing them to one copy puts a status toast
above every open dialog, and it eats the Escape meant for the dialog beneath.

Measured in the running app (mock e2e, instrumented): the dialog's own
`onEscapeKeyDown` was never called, the layer above it was
`<li class="toast-root" data-radix-collection-item>`, and a SECOND Escape
closed the dialog. That is `agent-skills.spec.ts:709`, which failed
deterministically here across three attempts.

The frontmost open dialog now takes Escape back while a toast is present,
closing through a hidden `Dialog.Close` so controlled and uncontrolled dialogs
behave alike. Scoped tightly: no toast on screen leaves Radix's arbitration
untouched, and only the frontmost dialog acts, so an inner dialog still closes
alone.

The toast is matched whatever its `data-state`. A toast that has begun closing
keeps its layer registered until the exit animation ends, and that is exactly
the case that failed — the first attempt keyed on `[data-state="open"]` and
missed it, which the instrumentation caught (`FB toast= null allLis= 1`).

`agent-skills.spec.ts` now passes locally on the deduped tree: 4 passed.
Regression test verified to fail with the fix reverted.

* 🚪 fix: Close the MCP Menu With the Dialog It Opened

Ariakit takes Escape for a menu only when the event target is the menu, its
trigger, or `body`:

    if (event.key !== "Escape") return;
    if (event.defaultPrevented) return;
    ...
    if (isElement(target) && target.tagName === "BODY") return true;
    if (contains(dialog, target)) return true;
    if (contains(disclosureElement, target)) return true;
    return false;                                  // ariakit dialog.tsx:496-517

While the MCP config dialog holds focus none of those is true, so the Escape
that closes the dialog leaves the menu open behind it — and `disabled={isOpen}`
on the trigger then makes it unclickable. The reader is stranded with a menu
they cannot reach and a button they cannot press; `mcp-oauth-readiness` times
out clicking it, three tests over.

Keyed on the dialog CLOSING, not opening. The first attempt closed the menu as
the dialog opened and broke a fourth test that reads the server rows from the
still-mounted menu underneath (`unmountOnHide` deletes them):
`element(s) not found`. Closing on the way back out leaves that untouched.

Local mock e2e on the deduped tree: `mcp-oauth-readiness` 5 passed (was 2/5),
`agent-skills` + `mcp` 5 passed, `client` 3204 tests green, typecheck clean.

* 🛡️ fix: Keep the Escape Fallback Inside Its Lane

Codex found three, all real.

**P1 — the fallback overruled the guards it should obey.** Any Escape while a
toast was up clicked the dialog's close button, including when a select inside
the dialog owned that Escape (WCAG 2.1.1) or when another layer had already
answered it. A reader closing a listbox would have lost the whole dialog and
anything unsaved in it. It now bails on `event.defaultPrevented` and on the
same popup conditions the Radix-provided handler honours — extracted into one
`escapeBelongsToPopup` helper both call, so they cannot drift apart.

**P2 — the frontmost check read inline z-index only.** `ImagePreview` is a raw
`DialogPrimitive.Content` carrying `z-[250]` as a CLASS, so it scored zero and
the My Files dialog underneath was mistaken for the frontmost — Escape in the
preview would have closed it too. Ranking now reads the resolved
`getComputedStyle().zIndex`.

**P2 — the published contract did not carry the singleton.** `@librechat/client`
still admitted `react-toast@1.1.5` and `react-popover@1.0.7`, which depend on
the older dismissable-layer/focus-scope line, so a consumer could reassemble
the very split this PR removes. Radix minimums raised to the versions the
lockfile resolves; the tree still holds exactly one copy of each.

Three regression tests, each verified to fail against the pre-fix component.
`packages/client` 484 tests, `client` 3204 tests, both typecheck clean, local
mock e2e `agent-skills` + `mcp-oauth-readiness` 9 passed.

* 🎚️ fix: Let the Consumer and the Alert Dialog Have Their Say

Two more from codex, both real.

The fallback never ran the dialog's own `onEscapeKeyDown`. Radix calls that
only for the highest layer, which the toast is — so a dialog whose consumer
cancels Escape (`event.preventDefault()`) closed anyway, taking whatever was
in it. The fallback now invokes the supplied handler and honours the
cancellation, exactly as the Radix path does.

The frontmost ranking looked only for `role="dialog"`. `OGDialogContent` is
also used as an alert dialog — the shared-link delete confirmation
(`SharedLinkButton.tsx:426`) — so its content was never found, `frontmost`
stayed null, and the fallback declined to act: that confirmation still needed
two Escapes. Alert dialogs are ranked too.

Two more regression tests, both verified to fail against the previous version.
`packages/client` 486 tests, `client` 3204 tests, typecheck and static checks
clean.
2026-09-08 16:00:27 -04:00
Danny Avila
ab52730582
🫣 fix: Hide Scroll-to-Bottom Under Composer Panels (#15746)
* 🎯 fix: Keep Scroll-to-Bottom Clear of Composer Panels

The `ask_user_question` popover and the tool-approval review float up from
the composer (`bottom-28`, measured from the composer's bottom) while the
scroll-to-bottom control floats up from the thread's edge (20px above the
composer's top), so the two meet on the panel's footer whenever the composer
is taller than 92px — it is 96px empty. Each panel now registers itself as
an open composer overlay for exactly as long as it renders, and the control
stands down while any is open. The in-flight steer stack keeps its existing
lift: it publishes its height and stays short enough for that to read well.

The overlap also exposed a stagger that was there all along: the control sat
flush with the column edge at 40px, while every composer control is 36px on
the `theme-control` tokens and Send is inset `mr-2`. It now shares Send's
inset and geometry, so the two read as one rail rather than two edges.

`ScrollButton` moves out of `MessagesView` into its own module so the gate
can be exercised against a stubbed IntersectionObserver.

* 🎯 refactor: Keep the Scroll Control on the Shared Button and Host Surface

Codex round 1. The control goes back on the shared `Button`, which gains the
composer row's geometry as `size="icon-theme"` (`size-theme-control p-0`)
and `shape="round"` (`rounded-theme-control-round`) instead of a feature-
local class list. The overlay count and its registration hook move out of
the global store into `Chat/Input/overlay.ts`, since only chat panels write
it and only the chat thread reads it. The extracted `ScrollButton` and
`ScrollToBottom` no longer read `showScrollButton` / `maximizeChatSpace`
from the app store: `MessagesView` takes both from the host's `ChatSurface`
and passes them down, and the subagent activity host does the same for the
column width.
2026-09-08 13:33:44 -04:00
Danny Avila
3bff323ac8
🧘 fix: Settle Stale Response Parts (#15743)
* 🕰️ fix: Settle Parts the Response Has Moved Past

Two live treatments outlived what they were reporting on: a reasoning block
kept shimmering with its thought peek scrolling, and a question group kept
reading "Asking 1 question", both long after the response moved on.

**Reasoning.** Activity phases split one response into several bodies, and
`PartWithContext` handed `Part` the per-body `isLastPart` as `isLast` — while
`showCursor` was correctly the body-level `isLast` AND'd with it. So every
settled phase's trailing part claimed to be the live one, and `Reasoning`
shimmers on `isSubmitting && isLast`. Both props now carry the same verdict:
the part holds the message's cursor. Grouped and parallel-lane paths already
AND'd the two, so only the phase path changes; `ToolCallGroup`'s own `isLast`
gets the same treatment for consistency.

**Questions.** `ask_user_question` writes no output onto its `tool_call` part
until the turn finalizes, so `allCompleted` stayed false and the header held
the present tense for the rest of the turn. Position cannot settle this one:
a LIVE pause appends its interactive card AFTER the group, so the group is
not the message's last part exactly while the question is open — the three
label tests that failed when I tried it that way are what caught it. The
answer itself is the signal, read through the same locally-recorded fallback
the durable record card uses, because the streaming handler's message copy
can overwrite the optimistic output stamp mid-stream.

Both regression tests were verified to fail with their fix reverted.

* 🫥 fix: Settle the Group Glyph With Its Label

The header's glyph and stacked icons pulsed on their own
`!allCompleted && isSubmitting`, so an answered question group would read
"Asked 1 question" while still pulsing beside it. Label, glyph and icon
animation now read one `isGroupLive` verdict — they are a single control.

Found by auditing the rest of the class rather than stopping at the two
reported symptoms. The other live treatments in message content are gated on
a per-part signal that does settle: `Summary` on its own `summarizing` flag,
the interim skill cards on `hasRealContent`, `SubagentCall` on its progress
status, and every tool card on `resolveToolCallPhase`, whose whole-message
`isSubmitting` fallback only applies where no `runStepStatus` was emitted.
2026-09-08 11:43:38 -04:00
Danny Avila
2577324343
🛄 fix: Clear MCP Connection State Before Catalog Refresh (#15741)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
2026-09-08 11:23:22 -04:00
Danny Avila
1dfefc3037
🪹 fix: Attach Ready OAuth MCP Servers With Empty Catalogs (#15727) 2026-09-08 07:14:13 -04:00
Danny Avila
f50c40e2f5
🧰 feat: Move Code Settings Into Run Code (#15722)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
Docker Dev Images Build / publish (push) Waiting to run
Sync Helm Chart Tags / Ignore non-main push (push) Waiting to run
Sync Helm Chart Tags / Sync chart tags (push) Waiting to run
2026-09-07 23:13:39 -04:00
Danny Avila
69889210d2
💠 style: Unify Code Approval With Composer Controls (#15721)
The code approval selector was the only chat control built on the shadcn
`DropdownMenu` primitives — a borderless ghost button and default radio
dots beside a row of bordered composer pills, with per-item text styled
by hand.

- Rebuild the control on the composer's own menu language (Ariakit menu +
  `TooltipAnchor`), matching `MCPSelect`: a pill trigger with a rotating
  chevron, and a `bg-presentation` popover whose options carry an icon,
  a description and a check on the selected row, as the model and MCP
  menus already do.
- Extract the pill appearance into `composerControlClasses()` beside
  `composerSurfaceClasses()` in `@librechat/client`, and consume it from
  `CheckboxButton` and `MCPSelect`, which each carried their own copy of
  the same border/radius/height/elevation decision.
- Replace the raised hand with a pair that reads as one question — a
  document with a question mark for "ask", a document with a pen for
  "accept edits" — leaving the shield to the pending review button that
  sits in the same row.

Roles, keyboard behaviour and the stored `codeApprovalMode` are
unchanged: the trigger keeps its `code-approval-mode` test id and
`aria-expanded`, and the options stay `menuitemradio`.
2026-09-07 23:13:27 -04:00
Danny Avila
25fcd12ad4
🏁 style: Align Streaming Elapsed Reading With Footer Start (#15720)
The retry navigation reserves its width in the message footer whether or not
hover has revealed it, so a response with siblings rendered the elapsed reading
indented past the column the streaming dot had just vacated. Rendering the
reading ahead of the navigation in all three row renderers puts it back on that
column start, in the streaming footer and in the flat thread alike.
2026-09-07 22:58:58 -04:00
Danny Avila
5ca1093ed9
🛫 feat: Enable Full Access for BYOM Coding (#15718)
* feat: Enable Full Access for BYOM Coding 🛫

* test: Preserve endpoint policy under Full Access

* fix: Gate Full Access on expected root agent metadata
2026-09-07 22:46:01 -04:00
Danny Avila
6f05678bfc
🧐 feat: Restore Interactive Tool Approval Review (#15717)
* 🧐 feat: Review Pending Tool Actions in the Composer (#15714)

* feat: add interactive approval review to the composer

* fix: Harden interactive approval boundaries

* fix: Bound every approval display label

* test: exercise composer approval review in BYOM acceptance

* fix: reveal all directional approval controls

* fix: canonicalize code approval targets across replicas

* style: sort resumable approval test imports

* test: Exercise Coexisting Approval Surfaces

* Revert "🧐 feat: Review Pending Tool Actions in the Composer (#15714)"

This reverts commit 5f79ded9553405b697e837e1976a70accbfc3fc3.

* Reapply "🧐 feat: Review Pending Tool Actions in the Composer (#15714)"

This reverts commit 52c7d9c7453da0168338bcf79494927f561a92a0.

* chore: bump agents sdk to v3.8.2
2026-09-07 22:02:56 -04:00
Danny Avila
3e2a6f333b
🪗 feat: Compact Context in a Summarize-Only Turn (#15690)
* 🗜️ feat: Manual Context Compaction as a Summarize-Only Turn

Adds a user-triggered "Compact context" action that summarizes the active
branch on demand. The compaction is an ordinary agent turn: the client
submits it through the normal chat pipeline with `compact: true`, the
controller hangs it off the branch's leaf instead of creating a user
message, and the agent client runs the graph summarize-only (the SDK's new
`summarizeOnly` input), so the summary streams into the response
placeholder under the leaf exactly like the automatic detour's and is
persisted as the boundary every later turn starts from.

Nothing new is needed for job registration, billing, abort, persistence,
or the usage snapshot: the run emits the same summary step and post-summary
context snapshot the automatic path already emits, and the response message
carries the summary part plus the `summaryUsedTokens` baseline the gauge
reads. The controller validates the request (existing conversation, a real
leaf, summarization enabled, no edit/regenerate/continue combination) and
answers 409 when the leaf is already a bare summary.

Client-side the submission borrows the regenerate shape — no new user
bubble, the placeholder parents onto the leaf — while the wire payload
drops `isRegenerate` so the server never treats it as a regenerated user
turn. The action sits in the context-usage popover, gated by the same
`summarization.enabled` switch as the automatic detour.

* 🗜️ fix: Localize a Compaction That Cannot Run

A compaction the graph could not attempt (summarization disabled, the
instructions already exceeding the budget, or an explicit recency window
covering the whole conversation) rejects with the SDK's
`ManualSummarizationSkippedError`, which rendered as the generic admin
error. It now maps to a typed `compaction_skipped` payload with the reason,
and a run that ends with neither a summary nor a recorded error fails as
`compaction_failed`; the Error component localizes both. A run that already
recorded why it stopped keeps that error part instead of failing twice.

* 🗜️ fix: Anchor a Compaction on the Leaf Everywhere It Is Read

Review round 1.

- The client sent the leaf's parent as `parentMessageId`, which the
  controller treats as the anchor, so the summary would have skipped the
  latest reply and landed as its sibling. The leaf's own id is now both the
  placeholder's parent and the server-side anchor.
- A compaction has no user message of its own, and every consumer of the
  job's user-message slot now knows it: the error path parents its row on
  the loaded anchor and never upserts the leaf, and the job records the
  regenerate shape so a reconnecting client rebuilds the turn under the
  leaf instead of recreating it as a user message.
- The controller no longer reads the anchor before the branch is loaded;
  `BaseClient` validates it against the history it loads anyway and
  answers 404 for a missing leaf or a typed `nothing_to_summarize` for a
  finished compaction. That predicate is shared through the data provider
  and ignores a summary still streaming or one that failed, so an
  interrupted compaction can be retried.
- A compaction never consumes files staged in the composer, the action is
  shown only when the server advertises `compactionEnabled`, and the
  in-flight marker is feature-local Jotai state rather than a read of the
  Recoil submission store.

* 🗜️ fix: Keep a Compaction Turn to Its Summary

Review round 2, plus the class it belongs to. A compaction submits no user
turn, so nothing that keys off one may run: the memory pass no longer runs
over the history (it would have spent a model call and could repeat memory
writes), and skill primes are no longer injected into the transcript the
run is about to summarize.

The client's in-flight marker is also reconciled on mount: a compaction
that finished while the view was away left the marker set, and the next
ordinary turn in that conversation would have shown as compacting.

* 🧹 chore: Sort Imports in the Compaction Hook Spec

* 🔧 chore: Update @librechat/agents dependency to version 3.8.1 in package-lock.json and package.json files
2026-09-07 21:51:54 -04:00