Commit graph

113 commits

Author SHA1 Message Date
Danny Avila
fad2c51da4
🏇 feat: Register SDK-Backed Agents for Native Chat (#18114)
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: register SDK-backed agents through agent management

* fix: gate SDK binding writes and preserve native lifecycle
2026-11-13 13:02:53 -05:00
Marco Beretta
ddbff5ac81
🪶 perf: Load Math, Highlighting, Side Panels and RE2 Only When Needed (#18108)
- perf: Stop Shipping the Node Crypto Polyfill to the Browser
- perf: Keep the Query Devtools Out of the Boot Chunks
- perf: Load Side Panel Tabs When They Open
- perf: Keep the RE2 Engine Out of the Browser Bundle
- perf: Load KaTeX and highlight.js Only for Math and Code
- test: Cover Code That Loads on First Need
- fix: Apply Loaded Math and Highlighting Whatever the Load Trigger Matched
- test: Assert Rendered Formulas Without Assuming Display Math
- fix: Retry a Failed Math and Highlighting Load While Mounted
- fix: Always Load Highlighting Where the Language Is Guessed
- fix: Register the PII Sizer Wherever Config Loads
- fix: Load Preview Math From the Filled-In Prompt and Keep Dollar Signs Literal
- test: Register the PII Sizer Where the Filter Harness Validates Config
- test: Preserve Side Panel Layout During Lazy Loading
2026-11-13 17:21:50 +01:00
Danny Avila
adcb19fff8
🔌 test: Keep Harness Connections Open for Playwright's Idle Sockets (#18070)
Playwright sends route.fetch(), the request fixture and page.request through one
keep-alive agent per worker with no idle timeout, and Node's agent ignores a
server's Keep-Alive hint without one. LibreChat and the fixture servers closed
idle sockets after 6 s, so a request reusing a socket at that moment was reset
(read ECONNRESET) or dropped (socket hang up): the remaining retried passes in
wrapping.spec.ts and thread-fold.spec.ts.

Run LibreChat with HTTP_KEEP_ALIVE_TIMEOUT_MS=0 and pass every fixture server
and the replica proxy through keepIdleConnections(), and check in
fixtures.spec.ts that each harness server answers without an idle deadline.
2026-11-12 07:19:46 -05:00
Danny Avila
0fdabfe283
🧪 test: Close Three Timing Gaps Behind Intermittent Mock E2E Failures (#18067)
Some checks are pending
Channel Gateway / gateway (push) Waiting to run
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (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/chat (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
Frontend Unit Tests / frontend (push) Blocked by required conditions
Playwright E2E Tests / Codegraph select (push) Waiting to run
Playwright E2E Tests / e2e () (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 1) (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 2) (push) Blocked by required conditions
Playwright E2E Tests / MCP Apps (browser and server) (push) Waiting to run
Playwright E2E Tests / e2e (push) Blocked by required conditions
Main Promotion Policy Tests / Main promotion denial and fast-forward tests (push) Waiting to run
* 👋 test: Wait for the Header Selector Before Counting Agent Names on the Greeting Landing

The greeting scenario read how many header controls named the agent with a
one-shot `count()` and then expected the same number of mentions inside
`main`. The header selector takes the agent's name after the welcome screen
paints, so when the name landed between those two reads the first said 0 and
the second saw the selector's own label, which sits inside `main`. When both
reads ran before the name landed the check passed without the selector ever
naming the agent.

Wait for the selector to show the name, then expect that label to be the only
mention inside `main`.

* 🗂️ test: Keep the Sidebar Open When Chat History Is Already Showing

On desktop `openChatHistory` clicked the Chat History rail button
unconditionally. The rail button of the panel already showing collapses the
sidebar, and Chat History is the panel every document starts on, so after the
reload in the subagent activity scenario the helper closed the conversation
list it was meant to show. The assertions that follow only passed while the
list was still mounted during the collapse.

Open the sidebar first on both layouts and press the rail button only when
another panel is showing, the guard `openPanel` already uses.

* 🚦 test: Hold the Mock Suite Until the Server Reports Ready

Playwright starts the suite once the base URL answers, which the server does
as soon as it listens. It keeps initializing after that and refuses chat
starts and schedule writes with a 503 until `/readyz` turns 200, so a spec
that runs first against a slow start got `SCHEDULES_NOT_READY`. The
two-replica wrapper already waits on `/readyz` before exposing its proxy; the
single-process server had no such gate.

Poll `/readyz` in global setup before authenticating.
2026-11-11 17:54:25 -05:00
Danny Avila
d30577e946
🧾 test: Bill Detached Subagents Their Own Prompt in the Mock Model (#18050)
* 🧾 test: Bill Detached Subagents Their Own Prompt in the Mock Model

The mock model computes the input tokens it reports from the agent context of the graph it was built for. A subagent model override shares that one model with child graphs, so a detached child of the same agent was billed the parent's system prompt and tool definitions for as long as the parent run had not been disposed, and only its own messages afterwards.

When the child's first call returned before that disposal, the inflated report pushed the SDK's calibration ratio to its cap, the pruner cut the 24 KB tool result to 4,912 characters, and the retained-history fixture stopped the child before signalling ready. On the Redis transport lane the two events land within a few milliseconds of each other, so the child wins that race in about one run in six; on the memory lanes the disposal is comfortably first.

The agent view now reads a graph's agent contexts only for streams of that graph's own run. The history fixture records why it stopped a task, so a waiter fails with that reason instead of a 45-second timeout.

* 🧪 test: Cover Detached Child Billing Through the Real SDK

The regression test drove the mock model directly with run ids it chose itself, so it assumed the relationship the ownership check depends on instead of observing it.

It now builds a real SDK run with a self subagent, a real task store and tool node, applies the real hook, and spies on what each stream reports. The parent run is never disposed, so its graph holds its agent context for the child's whole life: on dev's mock model the child stops with the lost-results failure the Redis lane hits, and here it reaches ready with every child stream billed for the messages it was sent and both parent streams billed their system prompt under the graph's own run id.
2026-11-11 10:29:38 -05:00
Marco Beretta
ac1de5a606
📎 fix: Keep Lazily Provisioned Attachments for Code Calls After read_file (#17942)
* fix: Keep Lazily Provisioned Attachments for Code Calls After read_file
* test: Scope the read-then-bash completion text to the message view
2026-11-10 09:03:47 +01:00
dvorak33
a3868fdbe8
🖼️ fix: Bound Flux Tool Images and Preserve Original Attachments (#13749)
Bound model-facing Flux images to the 5 MiB base64 budget for standard and finetuned generation. Preserve original image data for attachment storage under the existing resolution policy.

Fixes #6954.
2026-11-09 22:41:29 +01:00
Marco Beretta
dc646c3880
🎚️ fix: Forward Selected Gemini Thinking Levels as reasoning_effort on Custom Endpoints (#17951) 2026-11-09 17:41:23 +01:00
Marco Beretta
bffa50e7a8
🚦 fix: Keep the Gateway Message on Classified Rate Limit Errors (#17903)
* fix: Keep the Provider Message on Classified Rate Limit Errors

* fix: Honor maxProviderErrorChars for Classified Generation Errors

* test: Cover Classified Gateway Errors in the Mock Harness

* test: Cover a Zero Provider Detail Limit on Generation Errors

* refactor: Resolve Classified Provider Errors in the TypeScript Backend

* fix: Redact Provider Details Before Truncating Them
2026-11-09 15:44:02 +01:00
Marco Beretta
337c566dc3
📬 fix: Require a Click to Submit Email Verification Links (#17905)
* fix: Require a Click to Submit Email Verification Links

Mail security scanners (Microsoft Defender Safe Links, Sophos, Hornetsecurity)
open links in incoming mail and run the page's scripts, so the verify page
submitted the single-use token on load and the user's own click then failed.
The page now waits for an explicit confirm button for both sign-up
verification and email-change confirmation.

* test: Cover verification links opened before the user clicks

* test: Isolate the verify click scenario from the submission limiter

* test: Confirm the sign-up link in the email e2e setup

* test: Exercise the shared Button in the verify page spec
2026-11-08 23:39:26 +01:00
Marco Beretta
c3d5815d50
🛰️ fix: Poll the Flux Cluster Returned by the Global Endpoint (#17907)
* fix: Poll the Flux Cluster polling_url Returned by the Global Endpoint

* fix: Only Forward the Flux Key to Same-Origin or BFL Polling URLs

* test: Cover Flux polling_url Routing in the Mock Harness
2026-11-08 22:25:36 +01:00
Marco Beretta
ea584cd519
🧾 fix: Count Google Native Media Blocks in Precomputed Token Budgets (#17890)
* fix: Count Google Native Media Blocks in Precomputed Token Budgets

* test: Cover Gemini PDF context accounting in the mock harness
2026-11-08 15:01:26 +01:00
Marco Beretta
24322e6f21
🧾 test: Bill Advertised Tool Definitions in the Mock Model's Input Tokens (#17897) 2026-11-08 14:30:46 +01:00
Marco Beretta
bc1b574a2d
🩺 fix: Report Union, Object, Array and Later Fields in Tool Validation Feedback (#17885)
* fix: Report Union, Object, Array and Later Fields in Tool Validation Feedback

Type checks now cover integer, array, object and null, accept any member
of a declared type union, and scan every schema property. The cap of 8
applies to reported fields instead of inspected properties, so a mismatch
past the eighth property is still named.

Related to #17875

* fix: Read anyOf, oneOf and nullable Types in Tool Validation Feedback

Pydantic and zod describe an optional object as an anyOf of object and null,
and the Gemini sanitizer collapses unions into a type plus nullable: true.
Both shapes now report the field, and a valid null is no longer flagged.

Adds a mock MCP tool with a nullable object after its eighth property and a
scenario that checks the model receives the field name but not the value.
2026-11-08 00:00:58 +01:00
Marco Beretta
d452d1e636
🚨 fix: Show a Failed Assistants Run's Error on a New Chat (#17703)
Some checks are pending
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 Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (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/chat (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
* test: Show a Settled Assistants Error Lost to New-Chat Recovery

* fix: Keep a Failed Assistants Run's Error on the New-Chat Pane

* fix: Skip New-Chat Recovery for Any Error Turn the Server Did Not Save
2026-11-02 18:38:38 +01:00
Marco Beretta
b81458e1bb
🛰️ refactor: Stream Assistants Turns Through @librechat/chat (#17697)
* refactor: Move the Assistants Stream Hook into @librechat/chat

* refactor: Stream Assistants Turns Through the Package Legacy Stream

* test: Cover Assistants Send, Stop and Failure Through the Legacy Stream

* test: Give the Test Stream Hosts the Legacy Services Member

* test: Keep the Assistants Failure Case for Its Own Fix

* test: Give the Consumer Spec Host the Legacy Services Member
2026-11-02 18:36:32 +01:00
Marco Beretta
5b8bb3c31f
⏱️ fix: Bound Remaining Outbound Calls With Timeout Budgets (#17468)
* fix: Bound outbound HTTP calls that had no timeout

Add timeouts.toolsMs, speechMs and imageGenerationMs to the timeouts block and apply the
existing budgets to the RAG delete paths, built-in tool APIs, TTS/STT providers (TTS also
aborts when the client closes), Stable Diffusion, Firebase reads and Mailgun. Calls made
before app config exists (remote config, RAG health, service key URL, Google refresh) get a
fixed 10 second budget.

* fix: Honor configured budgets for RAG deletes and per-chunk TTS deadlines

* refactor: Share one budget helper between speech and image CJS callers

* test: Cover a stalled RAG delete with a mock scenario

* test: Wait for the RAG embed before stalling the delete

* test: Embed at upload so the stalled delete has a vector to remove

* fix: Close a started TTS response on a late chunk timeout and share the service budget helper

* fix: Fail startup when the remote config fetch times out
2026-10-29 09:55:18 +01:00
Marco Beretta
cd6edcea74
⏎ fix: Restore Enter to Send as the Default (#17374)
Some checks are pending
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 (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (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/chat (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
* fix: Restore Enter to Send as the Default Composer Behavior

* test: Cover the Enter to Send Default in E2E Scenarios
2026-10-23 00:10:44 +02:00
lia-by-librechat[bot]
ff962fcaa2
📔 fix: Recover Subagent Content With Shared Chat Rendering (#17290)
* test: cover retained subagent chat history parity

* feat: Define Task-Scoped Subagent Content Recovery Contract

* style: Format Retained History Regression Tests

* feat: Add Task-Scoped Subagent Public Content Recovery Foundation

* feat: Render Subagent Turns With Standard Chat Content

* fix: Bound Recovery Capture and Keep the New Writer Opt-In

* feat: Recover Subagent Chat Content From Committed Task History

* fix: Preserve Recovered Metadata and Shared Reader State

* fix: Preserve Journal Retry Bytes, Unicode and Recovered Phases

* fix: Catch Up Terminal Child Content Beyond Pinned Pages

* fix: Bound Child Content Settlement and Restore Preparation Timing

* fix: Preserve Retained Child History After Late Append Completion

* fix: Reconcile Late Child Commits and Preserve Terminal Content

* fix: Retain MCP Scope While Detached Children Execute

* test: Assert Shared Task Ownership Across Request Adapters

* fix: Preserve Subagent Recovery Across Flush and Deletion Races

* test: Enforce Indexes in Subagent Deletion Regressions

* fix: Respect Revoked Recovery When Cached Content Exists

* fix: Honor Recovery Revocations and Hide Read-Only Approvals

* test: Type Captured Tool Metadata in Approval Regressions

* fix: Keep Recovery Fallbacks Read-Only

* fix: Bound Subagent Recovery Work and Preserve Terminal Answers

* fix: Reconcile Late Content Writes and Preserve Selected Outcomes

* fix: Preserve Durable Outcomes Independently of Capture Completeness

* fix: Reconcile Serialized Subagent Text Blocks Without Duplicate Outcomes

* fix: Preserve Journal Cleanup Scope Before Conversation Erasure

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-22 15:32:40 +02:00
Marco Beretta
8718338728
⏱️ fix: Bound Outbound Calls Made Inside a Request (#17263)
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/chat (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
* fix: Bound Outbound Calls Made Inside a Request

RAG queries for file search and message context, OCR provider calls,
action HTTP calls, the moderation check, the stored-image fetch for
base64 providers, and Flux result polling had no timeout. A stalled
upstream hung the chat turn, the upload or the tool call indefinitely,
and Flux kept polling forever on statuses that never become Ready.

Each now runs under a budget from a new librechat.yaml timeouts block
with finite defaults (getOutboundTimeoutMs in @librechat/api). Action
calls also receive the run's abort signal, so stopping a run closes the
socket.

* test: Cover a Stalled RAG Query in the Mock Harness

* fix: Share One Flux Budget Across Submit and Polls, Bound the Vertex Token Exchange

* refactor: Poll Flux Results Through pollUntilSettled

* refactor: Leave Flux Polling for a Separate Migration

* fix: Cap Configured Timeouts at the Node Timer Limit

* fix: Bound the Action Token Refresh and the Whole Image Download

* fix: Cap Every Outbound Budget by Wall-Clock Time

Axios's timeout only fires on an idle socket, so a RAG, OCR, moderation,
action or token response that keeps trickling bytes never ended.
outboundRequestBudget pairs each timeout with an AbortSignal deadline, and
action calls combine it with the run's own signal.

* fix: Name the Budget That Ran Out and Give Actions Five Minutes

The actions default rises to five minutes, since action endpoints are
arbitrary third-party APIs and the old minute could cut off legitimately
slow ones after an upgrade.

A budget overrun now fails with an error naming the timeouts key and its
value, whether it was the idle timeout or the wall-clock deadline, and
logAxiosError logs it as a warning so operators know what to raise. A
deadline cancellation is no longer read as a user stop, so an action that
runs out of time reports a timeout instead of looking like a stopped run.

* fix: Hold Outbound Deadlines Weakly So Finished Requests Leave No Timers

* fix: Check the Budget Before Reading an Error Message

* fix: Report a Wrapped Deadline as a Failure, Not a Stop

* fix: Bound the OAuth Code Exchange and Keep the OCR Budget Hint When Protected

* chore: Sort Imports in axios.ts After Rebase
2026-10-21 19:10:13 +02:00
Marco Beretta
f7b053789e
🔐 feat: Defer MCP OAuth Sign-In Until a Deferred Tool Is Used (#17225)
* feat: Defer MCP OAuth Sign-In Until a Deferred Tool Is Used

Adds an oauthPrompt server option (on_start by default, or on_use) and an
operator-declared oauthToolCatalog. With on_use, an operator-configured
OAuth server whose selected agent tools are all deferred no longer prompts
at turn start: tool search offers the declared catalog (or the user's own
cached catalog), and sign-in happens on the first tool call through the
existing in-run OAuth step. Without a declared catalog the turn-start
prompt is kept. Both fields are operator-only.

Related to #16765

* test: Cover MCP OAuth Sign-In on First Deferred Tool Use

* fix: Bound the Declared OAuth Tool Schema to Non-Recursive Types

* refactor: Move MCP OAuth Deferral Orchestration Into packages/api

* refactor: Move the Cached-Catalog OAuth Prompt Branch Into packages/api

* fix: Defer MCP OAuth Only When the Offered Catalog Covers the Selection

* fix: Cover Runtime OAuth, Background Tools, and Tokenless Discovery in Deferral

* fix: Match Legacy Keys, Honor Background Capability, and Reject Unsupported Schema Keywords

* fix: Resolve Wildcard Background Opt-In and Tighten Declared Catalog Matching

* fix: Validate Declared Tool Schema Types and Enums

* fix: Accept Canonical Catalog Keys the Definitions Loader Accepts

* test: Pin the Declared Catalog Requirement for Cached User Catalogs

* fix: Resolve Deferred Tool Options Across MCP Spelling Aliases
2026-10-21 18:18:42 +02:00
Marco Beretta
698ee25fea
🧯 fix: Close Abandoned Download and Speech Streams and Cap Speech Input (#17270)
* fix: Contain Download and Speech Stream Failures and Cap Speech Input

The code output download piped the Code API stream with .pipe, which adds no
error listener, so a body that failed mid-stream (a bad gzip body, a reset)
became an uncaught exception and the process exited. pipeToResponse uses
stream.pipeline, ending the response and destroying the upstream when the
client leaves.

Text-to-speech piped provider streams the same way and waited only for
'end', so a provider error was uncaught and a client disconnect left the
chunk loop waiting. pipeSegment resolves on end and rejects on an error or
a disconnect, which ends the loop.

A speech request had no length cap, so one request could fan out into
thousands of serial paid provider calls. speech.tts.maxInputChars bounds it
(default 20,000 characters).

* docs: Document the Speech Input Cap in the Example Config

* fix: Reject a Speech Segment When the Client Already Left

* fix: Tear Down Both Ends of a Failed Speech Segment and Cap Streamed Speech

A failed provider segment now destroys the response as well as the source,
so a half-written answer cannot hang the client, and a response-side error
rejects the segment instead of going unhandled. Automatic playback reads a
message only up to speech.tts.maxInputChars, so long messages cannot fan
out past the cap either.

The download scenario now checks the behavior .pipe lacked: leaving a code
download closes the upstream connection right away.

* fix: Keep a Late Response Write Error From Going Unhandled

* test: Key Slow Code Downloads by File and Send a Browser User Agent

* fix: Read Speech Up to the Cap Instead of Refusing It

Manual speech now synthesizes the text up to speech.tts.maxInputChars, the
same as automatic playback, through capSpeechInput, so the CJS service only
passes the capped text along and the request keeps its existing error
contract. A streamed message that reaches the cap exactly now finishes, and
a segment that fails before any audio went out leaves the response open for
the caller's HTTP error.

* fix: Count Only Text Against the Speech Cap
2026-10-19 22:20:40 +02:00
Marco Beretta
9649541971
💠 feat: Add Gemini 4 Argon Support (#17200)
* feat: Add Gemini 4 Argon Support

Registers gemini-4-argon (GA 2026-10-13) for both the Gemini API and
Google Cloud Gemini Enterprise Agent Platform, following the Gemini 3.8
Flash integration.

- Model dropdown (config.ts) and both GOOGLE_MODELS examples
- Shared 1,048,576-token context window in googleModels; output stays
  capped at the 65,535 synchronous limit by googleSettings
- Thinking rule: medium default, minimal substituted with low, ignored
  sampling params and rejected thinkingBudget stripped; the allowlisted
  cyber-permissive variant defaults to high
- Introductory rates ($2 in / $10 out / $0.10 implicit cache read per
  1M) with the 2026-12-01 revert to $4 / $20 / $0.20 noted at both
  call sites; no long-context premium tier
- Tests: thinking default and levels, minimal substitution, legacy param
  strip, Vertex eu multi-region, OpenAI-compatible addParams strip,
  context window, value key and rates

Refs #17074

* test: Cover Gemini 4 Argon Request Shape and Billing End to End

Adds a Gemini-compatible mock endpoint whose addParams carry sampling
params, an E2E_REPORT_LLM_CONFIG fake-model marker that reports the
resolved agent request, and scenarios asserting that an Argon turn sends
no ignored sampling params (with gemini-2.5-pro as the control) and is
billed at the Argon rates.

* test: Read the Resolved Agent Request From the Graph in Argon Scenarios

The hook's agents are the unresolved agent configs, so the report now
reads the graph's agent context. The scenarios select the Gemini model
explicitly and key billed rates by model so a mismatch names the model.

* test: Match the Mobile Model Option Name in Argon Scenarios

* fix: Route Gemini 4 Argon to a Multi-Region Vertex Endpoint by Default

Argon is served only from the global, us and eu multi-regions, so with
GOOGLE_LOC unset a Vertex request now uses global instead of the
us-central1 regional default; a configured location is kept as is.
Argon also rejects a candidate count, so candidateCount, candidate_count
and its OpenAI alias n are stripped for Argon on the native and
Gemini-compatible paths.

* chore: Bump @librechat/agents to 4.0.6 for Gemini 4 Argon Input Rules

* fix: Move Regional Vertex Locations to Their Multi-Region for Gemini 4 Argon

A configured regional location such as europe-west1 does not serve
Argon, so it now resolves to the multi-region that contains it (europe-*
to eu, us-* to us) wherever the location comes from, GOOGLE_LOC or
addParams. A region outside us and eu is kept rather than sent to
global, so data never leaves the configured geography silently.

* fix: Route Gemini 4 Argon Past Regional Vertex Endpoint Overrides
2026-10-17 21:44:44 +02:00
Marco Beretta
8fab21d882
🧬 fix: Skip Re-Embedding Legacy File Search Files After Upgrade (#17206)
* fix: Skip Re-Embedding Legacy File Search Files an Agent Already Holds

Files embedded before per-namespace tracking carry no embeddedEntities, so
lazy provisioning treated them as unembedded and embedded them a second
time on the first search after upgrading, duplicating every passage.

A legacy record in the agent's own file_search resources was embedded for
it, so trust its embedded flag there instead of re-queueing it.

* fix: Adopt Legacy Search Embeddings Only for Their Sole Holder

Trusting the embedded flag for every legacy File Search file left an agent
that inherited one querying a namespace without its vectors. Legacy files
held by no other agent now record the active agent as their namespace, a
one-time write, and are not embedded again; a file another agent also
holds keeps the per-namespace re-embed.

Adds an e2e scenario that reshapes an uploaded agent file into the v0.8.7
record and checks that search queries it without a second embed.

* test: Cover Legacy Search Files Shared With Another Agent

* test: Read the Stored File Id in Legacy Search Scenarios

* fix: Pin Legacy Search Adoption to Loaded Records and Wire Every Agent Init

file_id is not unique, so adoption now matches each record by its owner and
tenant as well, and only rewrites the records priming loaded. The added
conversation and client agent initializations receive the dependency too,
so their sole-holder legacy files are not embedded a second time.

* fix: Adopt Each Legacy Search Record in One Conditional Write

* fix: Count a Concurrent Same-Agent Adoption as Adopted

* fix: Run Legacy Search Adoption Beside the Liveness Probe and Fall Back on Failure

* fix: Keep Committed Legacy Search Adoptions When a Sibling Write Fails

* fix: Confirm Legacy Search Embeddings With RAG Before Adopting Them

Inferring the embedding agent from current File Search holders could adopt a
file for an agent whose namespace held none of its vectors, for example after
the agent that embedded it was deleted. Priming now asks RAG for one chunk of
each legacy file under the agent's entity_id and records the namespace only
on a hit; a miss or an unreachable RAG keeps the file queued for embedding.

The data-schemas method no longer scans agents and matches untenanted records
as untenanted. The fake RAG server answers these presence checks from the
embeds it stores.

* fix: Require the Entity's Own Chunks and Keep Confirmed Vectors

RAG also returns chunks owned by the requesting user, so a presence check now
counts only chunks recorded under the agent itself. Once vectors are
confirmed, the turn skips the re-embed even if recording the namespace fails.

* fix: Bound the Legacy Search Check and Keep the Fake RAG Query Shape

The RAG presence check now times out (fileConfig.legacySearchProbeTimeoutMs,
5s by default) and falls back to embedding, so a stalled RAG cannot hang
priming. The fake RAG server records presence checks in their own list and
keeps the file_search query records it already returned.

* fix: Check Any Unrecorded Namespace Before Embedding a Search File

A file another agent embedded first lists only that agent, so the agent
whose older vectors went unrecorded skipped the check and embedded a second
copy. Priming now asks RAG for every agent File Search file that records no
embedding for the active agent, and recording adds the namespace to the ones
already there.

* fix: Ask RAG for Several Chunks So a User Copy Cannot Hide the Agent's

RAG ranks chunks across every owner of a file_id and, once the top one is
authorized, returns them all. A copy of an agent file embedded for the
requesting user could rank first with k: 1 and hide the agent's own chunks,
so the presence check now asks for ten and checks every owner.

* fix: Confirm Setup Embeddings in Shared-File Runs and Log Safely

The run-file host primes an agent's setup files on its own, so it now
receives the RAG presence check and the namespace recorder too; without
them a shared-file run could embed a legacy setup file a second time.
Failed checks are logged with getSafeErrorMetadata rather than the raw
error, which carries the vector store's response body.
2026-10-17 19:19:14 +02:00
Marco Beretta
472d29a3ee
🪙 fix: Price 1-Hour Prompt Cache Writes at the 1-Hour Rate (#17208)
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/chat (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
* fix: Price 1-Hour Prompt Cache Writes at the 1-Hour Rate

* test: Cover 1-Hour Cache Write Pricing End to End

* test: Price Cache Scenario on the Configured Mock Model

* fix: Accept a 1-Hour Cache Write Rate in Endpoint Token Configs
2026-10-17 15:43:57 +02:00
Dustin Healy
f757a673aa
🐛 fix: Restore MCP App Rendering and Actions (#16382)
* 🐛 fix: Restore MCP App Rendering and Startup

* 🐛 fix: Sort MCP App Bridge Imports

* 🐛 fix: Scope MCP App Validation to Current Role

* 🐛 fix: Keep MCP App Frames Mounted Through Layout Changes

* 🐛 fix: Reuse Principals for MCP App Validation

* Revert "🐛 fix: Keep MCP App Frames Mounted Through Layout Changes"

This reverts commit 54152c2ec5.

* 🧪 test: Preserve Dev MCP App Rendering Coverage

* fix: Restore Stable Inline MCP Apps and Queued Actions

* fix: Preserve MCP App Resource Owners Through Content Shifts

* fix: preserve message attribution and sources across MCP Apps

* test: separate MCP App detach and navigation revocation

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-16 13:27:29 -07:00
Marco Beretta
a06ee14b75
🔐 fix: Encrypt User Plugin Credentials With Random-IV v3 Format (#16996)
* fix: Encrypt User Plugin Credentials With Random-IV v3 Format

* test: Cover Credential Encryption Formats in Mock E2E Scenarios

* test: Round-Trip Real Credential Helpers in PluginService Spec

* 🙈 fix: Remove SharePoint Picker Payload Logging (#16997)

* fix: Add credentials.writeFormat to Gate v3 Credential Writes During Rollouts

* test: Expect 201 When the Legacy Write Format Override Is Created

* 🔊 fix: Clear TTS Audio Cache On Session End and Hash Its Keys (#16998)

* fix: Clear TTS Audio Cache On Session End and Hash Its Keys

* fix: Read Manual TTS Replays From the Hashed Cache Key

* fix: Purge Legacy TTS Cache Keys and Fence Writes Across Logout

* fix: Keep TTS Cache Writes Off the Playback Path

* test: Expect Hashed Keys in the StreamAudio Cache Lookup

* test: Use a Single-Token Reply Label in the TTS Cache Scenario

* fix: Settle TTS Cache Clear Before IdP Logout and Across Tabs

* test: Cover the TTS Cache Fence When Another Tab Logs Out

* test: Wait for the Second Tab Before Logging Out in the TTS Scenario

* fix: Latch TTS Cache Writes Shut Until the Tab Authenticates Again

* fix: Reopen TTS Cache Writes When Authentication Completes In Place

* fix: Leave for the IdP Even When TTS Cache Cleanup Fails

* fix: Retry a Failed Legacy TTS Purge and Fence Other Tabs on Manual Clear

* fix: Rerun the Legacy TTS Purge After Each Clear and Sign-In

* fix: Rerun the Legacy TTS Purge When Another Tab Clears

* fix: Fence Pre-Auth TTS Writes, Retry Failed Clears, and Fall Back to Storage Events

* fix: Version the Hashed TTS Cache Key Path

* fix: Move TTS Audio to a New Cache and Keep It Closed Until a Failed Clear Succeeds

* fix: Persist a Pending TTS Cache Delete Across Navigation

* fix: Reopen TTS Caching Only on Session Start and Fence Cache Reads

* fix: Keep the TTS Delete Fence in Cache Storage and Close Reads After Logout

* refactor: Keep Read-Aloud Audio in Tab Memory Instead of Cache Storage

* test: Return to the Conversation After Re-Login in the TTS Logout Scenario

* test: Close the Phone Sidebar Before Replaying in the TTS Logout Scenario

* fix: Bound the In-Memory TTS Cache by Size as Well as Count

* fix: Scope Cached TTS Audio to the Signed-In User

* fix: Keep the Settings Cache Delete Available While Legacy Audio Remains

* fix: Recheck Legacy TTS Audio After a Settings Clear and on Unowned Handoff

* fix: Fence TTS Writes Started Before an Account Signs In

* test: Opt the Fresh TTS Account Into Enter-to-Send
2026-10-12 16:33:08 +02:00
Marco Beretta
5de60f36b9
🪣 feat: Look Up Bitbucket Cloud Pull Requests (#16987)
* feat: Look Up Bitbucket Cloud Pull Requests

* fix: Keep the Pull Request Host Out of Overrides and Per-Host Keys

A role, group, user or tenant override can no longer change or remove pullRequests.host, so feature gating and link recording see the operator's host. Links are recorded only from the configured host, and the batch share key and the rate limit cooldown are scoped by host.

* fix: Compare Pull Request Link Hosts Through the Host Resolver

* test: Add Pull Request Scenarios Against a Fake GitHub Enterprise Host

* fix: Keep the Pull Request Provider Out of Overrides and the Batch Share Key

A role, group, user or tenant override can no longer change pullRequests.provider, so feature gating and link recording agree with the lookup, and a batch lookup for one provider is never joined by a request for another.

* fix: Read GitLab History Apart From Open Merge Requests

Merged and closed merge requests are listed on their own, so open fork merge requests on the branch name cannot crowd them out. Rate limit cooldowns are scoped by provider, and a workspace repository with a dot segment is rejected.

* fix: Revalidate Bitbucket Pull Requests and Skip Ones Without a Source Commit

Read a full closed page so a newer closed fork cannot hide an older pull request from the repository, recheck the source branch and fork status on the detail, and treat a pull request without a source commit as unmatchable instead of failing the lookup.

* fix: Follow Bitbucket's Next Link When Listing Pull Requests

* fix: Record the Lane Pull Request Without an Aggregation Pipeline Update

* fix: Match an Empty Lane Repository as Unknown

* fix: List Locked GitLab Merge Requests With the Open Ones

* fix: Replace an Expiring Fake Git Host Certificate
2026-10-12 07:34:51 +02:00
Marco Beretta
5ee091e99d
⌨️ feat: Change Default Chat Preferences (#16932)
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/chat (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
Main Promotion Policy Tests / Main promotion denial and fast-forward tests (push) Waiting to run
2026-10-12 00:55:36 +02:00
lia-by-librechat[bot]
abeb255a96
⏹️ fix: Reconcile Stopped Generations Before Detaching the Stream (#16788)
* fix: Reconcile stopped generations before detaching the stream

* test: Cover immediate Stop and delayed terminal reconciliation

* test: Accept both terminal outcomes of an immediate Stop

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-06 07:40:59 -04:00
Marco Beretta
7faba8b03e
🎛️ fix: Smooth, Compact Code Workspace, Checkout and Approval Selectors (#16789) 2026-10-06 09:59:02 +02:00
lia-by-librechat[bot]
d55dbc3bd8
🔱 feat: Simplify Steering Controls to Three Modes (#16759)
* 🔱 feat: Simplify Steering Controls to Three Modes

* Preserve Admitted Artifacts During Interrupts

* Preserve Result Admission Across Interrupts

* Gate Interrupt for Provider-Hosted Tools

* Match Interrupt Hints to Availability

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-05 06:46:59 -04:00
lia-by-librechat[bot]
19092e55bd
🖲️ fix: Enable Running Chat Menus and Preserve Renamed Titles (#16697)
Reconciles current dev while preserving manual title ownership, existing menus, and configuration regressions.

Co-authored-by: Lia <lia@librechat.ai>
2026-10-03 23:17:15 -04:00
Marco Beretta
fc05ea3946
🙋 feat: Refine the Ask Question Card and Smooth Batched Question Steps (#16641)
* feat: Refine the Ask Question Surfaces and Drop the Stop Shortcut Hint

* feat: Smooth Step Changes in Batched Questions With Numbered Option Rows

* fix: Swap Batched Question Answers Instantly While the Height Eases

* fix: Keep the Batch Card's Place in the Thread and the Answer Placeholder While Locked

* feat: Instant Option Row Hover and Typed Answers Replace Choices

* style: Fade Option Rows Slowly When They Lock

* feat: Swap Batched Questions Instantly While Only the Height Eases

* fix: Ease the Batch Status Lines and Keep Question Controls Unselectable

* fix: Stop the Batch Answer Area From Showing a Scrollbar

* fix: Keep the Locked Composer Placeholder Out of Text Selection

* feat: Check Mark on a Chosen Single-Select Answer

* feat: Turn the Question Move Chevron During the Composer and Chat Morph

* fix: Ease Only the Batch Card's Outer Height When Switching Questions

* fix: Pin the Batch Header and Buttons to the Card Edges While Its Height Eases

* fix: Confirm Batch Answers on Enter, Bound Long Prompts, and Keep the Form on Jotai

* test: Scenarios for Batched Ask Question Answers

* test: Pause the Fake Model on a Real Question Batch for the Ask Scenarios

* test: Run the Ask Scenarios in a Desktop Context

* fix: Cap the Batch Question Popover to the Viewport

* fix: Scroll the Capped Batch Card, Guard IME Enter, and Keep Focus on the Next Question
2026-10-02 23:14:08 +02:00
lia-by-librechat[bot]
73d704656e
📔 feat: Preserve Owner Text During PII Redaction (#16311)
* 📔 feat: Preserve Owner Text During PII Redaction

* 🧵 fix: Keep Ordinary Chat Views Outside Private Text Provider

* 🧷 fix: Preserve Owner Text Across Copy and Edit Paths

* 🔏 fix: Protect PII on Denial and Abort Paths

* fix: preserve protected text through denial, stop, and owner reload

* test: cover preliminary private metadata in disconnect fixture

* test: carry preliminary metadata in resume controller fixture

* test: preserve Stop prerequisite identity in tenant fixture

* fix: keep protected owner text out of search and exports

* fix: preserve trusted PII placeholders through provider inspection

* fix: coordinate protected turns across Stop and native sharing

* fix: Preserve Private Text Admission and Query Lifecycles

* fix: Track Private Query Effect Dependencies

* fix: Fence Protected Admission and Screenshot Targets

* fix: Share Protected Admission and Preserve Native Token Trust

* test: Wait for Private Message Concurrency Indexes

* fix: Preserve Protected Admission Across Recovery and Titles

* fix: Coordinate Protected Root Admission and Early Stop

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-02 11:43:10 -04:00
Marco Beretta
345a20fe3a
🪟 feat: Undock the Artifacts Pane into Its Own Window (#15911)
* 🪟 feat: Undock the Artifacts Pane into Its Own Window

The artifacts pane could only live in the chat's side panel, so viewing an
artifact meant giving up half the conversation and there was no way to put it on
a second screen. A header action now moves the pane into a separate browser
window and back.

The pane stays in the chat tab's React tree and is portaled into the popup's
document, so artifacts keep streaming into it and docking back is a re-render
rather than a reload. Everything a portal does not carry is mirrored: the host
stylesheets (re-synced for lazy chunks, HMR and CSSOM-only rules), the resolved
theme, a base URL for relative assets, and Sandpack's frame messages, which
would otherwise never reach the listener the opener installed.

* 🪟 fix: Keep the Artifacts Pane Whole When It Changes Windows

Review of the undock change surfaced one cause behind most of its findings: the
pane is a new component instance in every host, so anything a mount decides was
lost or wrongly reset when it moved.

- The code editor buffer now carries the artifact it belongs to, so a remount
  restores unsaved text instead of falling back to the persisted content, and
  the edit the debounce never got to send is handed to the mutation on mount.
  The share hosts take one provider around every branch for the same reason.
- The artifact registry is cleared by the host that owns it: the pane keeps it
  while it only changes windows, and leaving the route wipes it, so no artifact
  follows the user to a shared conversation.
- Fullscreen exits through the document that owns the container, Mermaid pan
  listens where its canvas lives, and Copy reports success only once the write
  resolves, with a toast when it does not.
- Style mirroring compares what a sheet actually contains: rules a page inserts
  through the CSSOM are serialized, and a rewrite the observer saw refreshes its
  clone even when nothing measurable changed.
- A child-activity panel opened while the pane is undocked stays open; the two
  panels are exclusive only while they compete for the side panel.

Adds the scenario suite for the window behaviors (`@scenario:` tagged) plus unit
coverage for the registry lifetime, the panel slot and buffer ownership.

* 🧭 fix: Carry the Artifacts Tab Across a Window Change

The pane's active tab lived in the component instance, so undocking from the
code tab landed the user back on the preview — with their unsaved text out of
sight, which reads as losing it. The tab is pane state now, next to the editor
buffer it belongs with, and the scenario asserts both survive the move.

* 🧹 chore: Drop Unused Imports From the Presentation Spec

* 🎯 fix: Bound the Artifacts Pane's Shared State to Its Session

The second review round found the cost of state that outlives an instance, all
in the seams the first round opened.

- Download now reads the editor buffer only when it belongs to the artifact on
  screen, so selecting another artifact cannot export the previous one's edits.
- The active tab is reset when the pane session ends — close or conversation
  change — instead of following a later artifact onto the code tab.
- A mutation started by a previous pane instance can no longer report back, so
  the mount releases the stale "mutating" flag before handing over the restored
  text; otherwise the edit queued behind a completion that never arrives.
- The undocked window's size and position are read while it still has them, in
  its `pagehide`, so closing through the browser remembers the bounds too.
- Docking from the window moves focus to the control that replaces the one the
  user pressed, which a keyboard user otherwise loses to the document.
- The share host keeps one `EditorProvider` mounted across the closed and open
  branches, so opening the overlay no longer remounts the transcript.

* 🎨 fix: Paint the Undocked Window Before Its Sheet Arrives

A mirrored stylesheet is a fetch, so the popup showed its default white canvas
for that moment — plain against a dark app, and visible to the scenario as a
transparent pane. The host's resolved surface colour is now the `var()`
fallback in the popup's own layout sheet, so the window opens on the app's
canvas and the real token takes over when it lands.

The two scenarios that read settled state — the painted canvas, and a keyboard
Enter that closes the window it was pressed in — now wait for it instead of
sampling the first frame.

* 🔭 fix: Focus the Dock Target Once the Pane Has Mounted\n\nThe focus handoff ran before the pane rendered its toolbar, so the control it\nwas meant to focus did not exist yet and the request was never spent. It now\nwaits for the mount that creates that control.

* 🧩 fix: Give the Edit Pipeline and the Transcript One Owner Each

Round three found the same shape three more times: work that belongs to a
session was still decided by an instance or by a branch.

- The editor no longer infers whether a previous instance's save is running.
  React Query keeps a mutation's callbacks on the mutation, so that request
  settles the shared flag itself; the new instance waits for idle and submits
  the restored buffer once, instead of clearing a flag it does not own and
  resubmitting against an `original` the earlier request may have replaced.
- The shared conversation keeps its transcript in one place — always the first
  panel of the resizable group — so opening the pane, undocking it or docking
  it again changes only the pane's host, not the transcript's ancestry.
- The clipboard fallback runs in the pane's own document, so an undocked pane
  on a deployment without the Clipboard API can still copy instead of only
  reporting failure.

* 🧷 fix: Tie the Editor Buffer and Focus to the Pane Session

Round four found the last places where the retained buffer and the focus
handoff were decided by a code path rather than by the session boundary.

- Closing the pane discards the buffer, the tab and any pending focus request,
  so reopening an artifact starts from what is saved instead of restoring — and
  silently resubmitting — text the user abandoned.
- Only the buffer an instance inherits at mount is drained. Navigating back to
  an artifact restores its own unsaved text in the editor instead of writing
  the persisted content over it, which used to queue that content behind the
  edit and undo it.
- Closing the window through the browser hands focus back exactly as the Dock
  control does, rather than leaving a keyboard user on the document body.
- The clipboard fallback restores focus by capability rather than `instanceof`,
  which never matches across the popup's realm.

* 🔐 fix: Make Undocking Configurable and Its Saves Session-Bound

- `interface.artifactUndocking` is a `configSchema` field, default enabled, so a
  deployment that cannot use popups keeps the docked pane. The hosts resolve it
  — the chat host from the startup config, the shared host from the shared-link
  config, which now carries the flag — and hand it to the pane through the
  context it already takes, rather than the pane reading config itself.
- A save carries the editing session it was started in. React Query keeps its
  callbacks after the editor is gone, and those callbacks used to write the
  buffer a closed session had just cleared and submit its queued edit; they now
  stop at a session boundary, so a closed pane mutates nothing and leaves no
  text behind for the next one.

* ✂️ fix: Stop the Editor from Overwriting Another Artifact's Unsaved Text

- A write this component makes into the Monaco model comes back through
  `onChange` exactly like a keystroke. Restoring an artifact's text therefore
  looked like typing and keyed the shared buffer to the artifact now on
  screen — so selecting another artifact before the debounce fired replaced
  the text the first one was still holding, and returning to it showed the
  persisted content. The value written here is now recognised and consumed,
  and the retained buffer is sent deliberately when its artifact comes back,
  which is where its cancelled debounce finally becomes a save.
- The save lock is the session's, not a request's. A save that outlives its
  session no longer clears the lock or the failure notice a later session
  took, and ending a session releases it — while an edit typed behind a lock
  whose owner is gone is sent by the editor holding it as soon as the lock is
  free, instead of waiting for the user to type again.

* 🔔 fix: Report Failures in the Window the User Is Looking At

The app's toast surface is mounted once in the chat tab, so a notice raised
from the undocked pane — a copy that no clipboard path accepted, for
instance — appeared in a document nobody was looking at. The window now
carries a Radix toast provider and viewport of its own around the portaled
pane; the toast state is shared, so the same notice is shown wherever the
user is rather than routed by hand at each call site.

* 🚧 fix: Offer Undocking Only Once the Deployment Has Answered

An absent config read as enabled, which is the default, but a config request
in flight reads the same way: a user could undock during that window and the
arriving answer would then take the Dock control away with it. Both hosts now
treat an unanswered config as no capability, and the pane keeps the control
that docks it whenever it is undocked, so a capability that disappears cannot
strand the pane in a window with no way back.

* 🎯 fix: Land Queued Edits, the Config Toggle and Focus on the Window

- A queued edit is sent against the content the artifact actually holds. The
  save that held the lock has already replaced what that edit was typed
  against, so submitting the captured `original` had the endpoint reject the
  newest text and leave it in the buffer alone.
- `interface.artifactUndocking` now survives interface loading:
  `loadDefaultInterface` rebuilds the object property by property, so the flag
  never reached `/api/config` or the shared-link payload and a deployment that
  set `false` still saw the control.
- Undocking hands focus to the pane the way docking already did. The control
  the user pressed goes away with the docked toolbar, so a keyboard user was
  left on the empty document of the window that had just opened; the focus
  request is now a move in either direction, which is what it is named after.

* 🔓 fix: Let the Request Own the Save, Not the Session

The save lock was a flag the editor set and cleared, which gave two ways to
be wrong: a callback whose session had ended cleared a lock the next session
was waiting on, and ending a session released a lock whose request was still
running — so a pane reopened mid-save could start a second read-replace-save
against content the first request was about to change.

The state is now the request's. The artifact save carries a mutation key and
`isMutating` is read from React Query's mutation cache, so it is true exactly
while a save is in flight, whoever started it: nothing to release, nothing to
leave behind, and an editor that appears mid-save queues its edit and sends it
— rebased on the content that landed — once the request settles.

* ⏱️ test: Give the Undocked Preview Time to Compile

* 📌 fix: Rebase a Queued Edit on What the Save Actually Wrote

The artifact registry catches up when the edited message propagates, not when
the save returns, so an edit sent in between was rebased on content the server
had already replaced and the endpoint rejected it. The text the last save wrote
is on the request itself: the drain reads it from the keyed mutation in React
Query's cache and falls back to the registry only when there is no save to
speak of. The same applies to a buffer inherited at mount, which is submitted
against that record too.

* 🧷 fix: Keep the Pane's Tab and Its Storage Off the Instance

Both findings of the review at a03ee0f7 are the same shape as the ones before
them: something the pane needs was reached for where it does not survive.

- The tab is pane state, but the reset that keeps it honest was an instance
  ref. A host change mounts a new pane, so that ref started empty, read the
  artifact already on screen as freshly opened and wrote `preview` back —
  undocking and docking both returned the user to the preview, which reads as
  the code they were editing having been thrown away. The marker moves to the
  atom beside the tab it guards, and ends with the pane session like the rest
  of it. Opening a *different* artifact still returns to the preview.

- `localStorage` was reached for at the call site. A policy that denies Web
  Storage throws from the getter itself, before the guard around `getItem`
  could run, so undocking threw instead of falling back to default bounds and
  the redock and teardown paths threw on their way home — stranding the pane in
  a window whose control the user had just pressed. Both helpers take the window
  and touch storage inside their own guard.

The scenario that should have caught the tab defect asserted `aria-checked`
once, which matches the frame before the reset lands, so it is polled now.

* 🧪 test: Drop the Denied-Storage Scenario the Shell Cannot Support

Verification at c94e5ef showed the scenario asserting a capability LibreChat
does not have: denying Web Storage in the browser replaces the page with the
error boundary ("denied") before the pane's controls are reachable, so the
popup never opened and the test timed out in all three projects.

The finding behind it was about one call site — the pane reaching for
`source.localStorage` outside the guard around its `getItem` — and that stays
fixed and covered by the unit tests in `undockedWindow.spec.ts`, which
reproduce the throwing getter and fail without the fix.

Surviving denied storage app-wide is the shell's problem, not the pane's, and
is tracked at berry-13/LibreChat#41. The spec says why the scenario is absent
so it is not added back.

* 🔗 fix: Match the Artifact Trigger's Name as Dev Now Builds It

The scenarios opened the artifact by its full accessible name, spelled out as
"<title> Click to open". Dev's "Unify Artifact Triggers as Tool Rows" (#15915)
folded the format badge and whether the row renders a preview into that name,
so it now reads "E2E HTML Artifact HTML Opens as a rendered preview Click to
open" and an exact match finds nothing. Every scenario in the file failed at
its first click, three retries deep, which is what pushed the e2e shard past
its 30 minute ceiling.

This did not show up locally because the mock harness serves `client/dist`,
and mine was built before the rebase. The old bundle still rendered the old
name, so the stale locator passed here and failed in CI — and dev's own
`plain-text-artifact-row` spec failed locally for the mirror-image reason.
Both pass against a freshly built client.

The trigger is matched on its title now, the way dev's spec does it, so the
badge and the preview hint can change again without breaking the file.

* 🍞 fix: Share One Toast Viewport Between the App and the Window

The undocked artifacts window needs a toast viewport of its own, and it carried its own copy of the app shell's class list — so any change to toast placement, stacking or width would have had to be made twice, or the popup's notices would drift from the app's.\n\nThe viewport is now one composition in \, rendered by both hosts. It keeps the class list it always had and still takes a \, so the popup can adjust its own placement without forking the primitive.

* 🚫 fix: Keep a Rejected Edit Rejected Across a Host Change

A save the endpoint answers with 400 is deterministic, and the editor already refuses to send that exact text again. The refusal lived in the editor instance while the text itself lives in the shared buffer, so moving the pane to another host — which remounts the editor — dropped the marker and the inherited-buffer drain immediately sent the rejected text back, against the same original that produced the 400. Every dock or undock cost another rejected request, with no new edit from the user.\n\nThe marker now sits beside the buffer it describes, in the editor session, and names the artifact it was recorded for. A remount inherits it; a successful save clears it; ending the session clears it with the buffer. Returning to an artifact no longer resends its rejected text either, for the same reason. A genuine new edit still saves.

* 🧭 fix: Key the Artifact Registry to the Host's Conversation

The guard that bounds the artifact registry to one conversation decided that the conversation had changed by reading the chat tab's Recoil slot, which the shared route never sets. A shared conversation's host stays mounted while the reader moves between shared links, so on that route the change was invisible and only the unmount cleanup ever fired: artifacts from the previous link stayed in the registry, and opening an artifact in the next one could list and navigate back to the previous share's content.\n\nThe identity is now the host's to supply — the chat tab passes its Recoil slot, a shared conversation passes its own id — which is also what keeps the hook from reaching into app-global state for something only its caller knows. The first observed identity still does not wipe, so the loading transition into a shared conversation keeps the artifacts that belong to it.

* 🧪 test: Cover the Shared Host, a Blocked Popup and a Rejected Save

Three paths the pane reaches that no scenario exercised: a shared conversation, whose host resolves the undock capability from the shared-link config; a browser that refuses the popup, where the pane has to stay put and say so; and an edit the endpoint rejected, which must not go back on the wire because the pane changed hosts.

* 📝 docs: Document the Artifact Undocking Toggle in the Example Config

\ reached the schema and the shared-link config without ever appearing in the example file a deployment copies, so the lever existed but was undiscoverable. Documented with the default that reproduces today's behavior.

* 🔐 fix: Make the Undock Capability the Host's Answer, Not a Default

\ filled \ with \ when a host left it out, so a host that forgot would offer a window the deployment may have turned off — the one field in that context with no sensible fallback. It is now required, which makes forgetting it a compile error instead of a capability grant.

* 🕰️ fix: Read an Absent Conversation as Loading, Not as a Switch

The registry guard normalized a missing identity to a sentinel and stored it, so a host that reported nothing for a render — a shared link whose data refetches, a chat tab reading its slot before it is filled — looked like a move to another conversation. The reader lost the artifact they had open, and the same conversation coming back read as a first sighting.\n\nAn absent id is now no news at all: the last real identity stays the one the next id is compared against, so returning to it changes nothing and a real switch still wipes. Reported by Devin review of 097f9bfadd (BUG-0002), which also caught that ShareArtifactsContainer's comment already promised this behavior.

* 🏷️ fix: File a Refused Save Under the Artifact That Was Refused

The rejection marker was written with whichever artifact the pane happened to be showing when the 400 landed. A save answers after the user may have moved on, so a refusal for artifact A filed under artifact B left A free to send the same refused text again as soon as the user came back to it — and cleared B's own marker on A's next success.\n\nThe artifact a save was started for is captured when the request goes out, and both callbacks use it: the refusal names that artifact, and a success clears only that artifact's marker. Reported by Codex on 097f9bfadd.

* 🖥️ fix: Do Not Reopen the Pane on a Monitor That Is Gone

Remembered bounds are coordinates, and they outlive the monitor arrangement that produced them. Undocking takes the pane out of the page along with the only control that docks it, so a window reopened onto a display that no longer exists takes the artifact somewhere the user cannot reach.\n\nThe remembered rectangle is now used only when it can still be reached: it either overlaps this display's work area, or the browser says another display is attached, which is the case the feature exists for. A desktop reporting exactly one display is the only one where the rectangle is provably gone, and there the pane opens at the default bounds. A browser that does not report other displays keeps the user's placement. Reported by Devin review of a85d5c348e (BUG-0001).

* 🪞 fix: Follow a Stylesheet the Host Switches, Not Only Rewrites

The style mirror watched for nodes and text, so a sheet whose attributes changed — a \ switch, a \ flag, a \ that stops it being a stylesheet — left the popup showing styling the host had moved on from, with nothing to bring it back into line.\n\nThose attributes are part of the signature now, the observer watches them, and an update applies them to the clone alongside its content. Reported by Devin review of a853d48c90 (BUG-0002).

* ♻️ fix: Rebase Every Resubmitted Edit on What the Last Save Wrote

An edit replaces whatever the last save wrote, and the artifact registry only catches up when the edited message propagates. Three separate paths resubmit retained text — a queued edit, a buffer inherited at mount, and the edit restored when the user comes back to an artifact — and each had to learn that separately; the restore path had not, so it sent \ as the original, the endpoint refused it with a 400, and the text the user typed never landed.\n\nThe rebase now happens once, where the request is built: \ resolves the original from the save's own record unless a caller overrides it, so no path can forget — including the ordinary keystroke debounce, which had the same gap right after a save. Reported by Codex on a7c047cc2a, and the third finding in this family.

* 🧪 test: Let the Shared-Link Dock Click Race Its Own Window

Docking closes the window the click was made in, so the click can resolve against a page that has already gone — the same race the focus scenario already tolerates. The assertion that matters, the pane arriving back in the shared page, is unchanged. Seen once on desktop-dark while verifying a7c047cc2a.

* 🪞 fix: Clone a Stylesheet in the State the Host Has It

The attribute mirror kept a sheet current once the window was open, but the clone was built without those attributes — so a sheet the host had already switched off, or aimed at another medium, arrived in the popup switched on. Its signature matched from that moment, so the sync had nothing to correct.\n\nThe clone now carries the same attributes the sync keeps current. Reported by Devin review of c5d51b85fb (BUG-0002), and the same cause as its predecessor in that round.

* 🧪 test: Match the Blocked-Popup Notice Where It Is Shown

The notice is rendered in the toast and repeated in the live region, so the text matched two nodes and the assertion tripped strict mode on the slower mobile project. Either node proves the user was told; the assertion now takes the first.

* 🗑️ fix: Never Let a Cleared Editor Save Itself as a Deletion

Typing has always refused to save an empty editor: a user who selects all and deletes is mid-edit, not asking for the artifact's content to be removed. The paths that resubmit retained text did not know that, so a buffer holding an empty string was sent the moment the pane changed hosts or the user came back to the artifact — persisting a deletion nobody confirmed.\n\nThe rule now sits with the other decisions about whether a request goes out, in \, so the debounce, the queued edit, the inherited buffer and the restore all share it. Reported by Codex on a9a51439a5 (P1).

* 🧹 fix: Retire the Inherited Buffer Once a Newer Edit Is in Play

A host change hands the replacement editor the text its predecessor never sent, and the drain submits that once the save pipeline is idle. If the user kept typing in the replacement, the newer text queued behind the running save — and when it landed, the drain still had the older buffer in play and sent it, putting the artifact back the way it was.\n\nAnything an instance submits or queues now retires the buffer it inherited at mount, so the newest text is the last word. The drain passes the inherited text itself, which is how it stays exempt. Reported by Codex on 04a9f685b6 (P1).

* 🎨 style: Satisfy the Tailwind v4 Class Order From Canary

* 🧺 fix: Retain a Displaced Buffer Under the Artifact That Owns It

Editing one artifact evicted another's unsaved text from the shared code
buffer: the selection change had cancelled that edit's debounce, so the
overwritten copy was the only place it lived and coming back to the
artifact fell through to its persisted content. A buffer another artifact
displaces is now retained under its owner, and the editor restores and
sends it from there on the way back. Reported by Codex on 591ab13c96 (P1).

* 🧪 test: Key the Tabs Spec's Mocked Buffer to Its Artifact

The pane-wholeness change gated the preview on the buffer naming the
artifact on screen, but the spec's useCodeState mock never set
codeArtifactId, so the edited preview never applied. The mock now carries
the owner the component reads, and the editor spec's mock grows the
retained-buffer field the component destructures.

* 🧪 test: Prove a Displaced Edit Returns With Its Artifact

The displaced-buffer scenario gets its contract-level coverage: an edit
the user leaves on one artifact, an edit that displaces it on another,
and a return that has to land on the first artifact's own unsaved text.
The fake model grows a reply carrying two artifacts so both trigger rows
exist in one conversation, and its one nested ternary is unrolled so the
file lints under the repo rules CI applies to staged files.

* fix: Resolve Every Artifact Surface and Refusal Per Artifact

Preview, download and the Mermaid host now read an artifact's retained buffer the same way the editor does, rejection markers are kept per artifact so one refusal no longer overwrites another, and the saved-content history is only preferred while the registry still sits on this session's chain of saves.

* fix: Hold an Inherited Edit Until the Editor Can Save It

A buffer inherited across a host change while a response was generating was marked drained before the read-only guard dropped the save, and the read-only transition then replaced it with persisted content. The drain now waits for editing to return and writes the inherited text back after that transition.

* chore: Sort the Presentation Spec's Imports After the Canary Rebase

* test: Prove Each Artifact Surface and Save Path End to End

Covers the download of a displaced edit, a refusal per artifact, an edit after another session changed the artifact, and an edit carried through a response by a host change.

* test: Give the Undocked Presentation Case the Canary Query Client

* test: Start Artifact Scenarios From a Settled Reply on the Desktop Layout

* test: Stub the Command Executor Stamp in the Callbacks Spec Mock

Canary's #16556 calls stampCommandExecutor from callbacks.js, but this spec's @librechat/api mock predates it, so three cases failed on canary itself. The mock now carries the real helper, as it already does for isCodeArtifactToolOutput.

* fix: Track What the Server Holds Per Artifact Instead of Inferring It

The editor reconstructed the server's content from the mutation cache and treated every buffer as unsaved. A save now records what it wrote in a per-artifact ledger that the registry retires once it catches up, so a change made elsewhere (including a revert to an earlier value) wins over this tab's history, and text this tab already saved is never sent again by a host change or a return to the artifact.

* fix: Hide the Undocked Pane While Its Conversation Route Is Pending

The route keeps the previous conversation mounted but hidden while another one loads or fails to, and the undocked portal escaped that ancestry. The host now passes its pending state down and the window hides the pane with it.

* fix: Mark the Saved Buffer Copy and Retire Lag the Registry Has Passed

A buffer is saved only while it is the copy a save wrote, so editing away and back to the same text is still sent. Lag values the registry has already moved past are dropped in order, so a later change back to one of them is read as a change made elsewhere.

* test: Drop the Callbacks Mock Stub Canary Now Carries

* perf: Prune Settled Save Records When the Editing Session Ends
2026-10-01 18:41:18 +02:00
Lia
9dc8db0ea8 🛶 fix: Preserve Canary Sync Resolutions (#16361)
Retain the tracked-file integration outcomes recorded by original canary sync PR #16361.

No new implementation is introduced. Shared and ambiguous corrections are carried by the final sync-resolution commit so the resulting tracked tree equals frozen canary f66ad88e1c.

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16361
Resolution-Sources: 6d7ba72b89, 241c692b63, 6113242b7b, 3c8a5703e7, a45be88578, 3789cbf590, 81e038972f, c505db2256, 420760d8b2
2026-10-01 03:46:19 +00:00
Marco Beretta
e1e1d1b19d 🎒 feat: Carry Project Context Across Conversations (#15684)
* 🎒 feat: Carry Project Context Across Conversations

* fix: fail a project attach whose upload hold cannot be released and keep file deletes independent of project cleanup

- Attaching a project file now fails, with nothing attached, when the file's
  temporary upload hold cannot be released, instead of attaching a file that
  can still expire.
- A failed project cleanup after a file delete is logged rather than failing a
  delete that already happened, and a user-wide delete clears that user's
  project references without reading every file first.
- Both resize handles share the orientation-aware grip, so a primary handle in
  a vertical group renders a rotated grip like the alternate one.

* fix: treat an empty tenant id as no tenant in the project file picker

* fix: attach nothing when a project file is deleted while the attach is in flight

* fix: localize project file association failures instead of showing server text

* test: expect a localized reason for a rejected project file association

* fix: scope project file listing to the caller's tenant and name the file limit when attaching an existing file

- Listing a project's attached files now returns not found when the project
  belongs to another tenant, matching the available-file listing and the
  chat context resolver.
- Choosing an existing file for a full project now names the project file
  limit instead of the generic attach error, like the upload path.

* fix: treat an empty tenant id as no tenant in every project tenant check

A caller whose tenant id is an empty string was refused its own tenantless
project when listing attached or available files, because the handlers
compared '' with null. The project handlers and the chat context resolver now
share one comparison that treats an empty tenant id as no tenant, the rule the
project file queries already follow.

* test: wait for the workspace layout swap and the mobile drawer before acting in the long-metadata spec

The desktop title was measured while the phone layout could still be the one
rendered, and the sidebar row menu was opened before the mobile drawer
committed its open state, which closes a menu opened ahead of it. The spec
now waits for the workspace's phone-only sidebar toggle to leave and for the
drawer to drop inert, the same drawer signal the agents helpers use.

* fix: keep the agent context fingerprint of a turn outside any project unchanged

Every turn now passes a project context key into the agent context
fingerprint, and a turn outside any project passed the no-project sentinel,
which changed the digest of every existing no-project checkpoint. An agent
event conversation written before this change then cold-started and reloaded
its history on its next event. The fingerprint now hashes the no-project key
as absent, so those checkpoints keep matching.

* test: load the long-metadata spec at phone width before driving the mobile drawer

The spec crossed back from desktop to phone width without a reload, which
leaves the drawer on the desktop toggle path whose delayed focus handoff to
the close button dismissed the row menu roughly 200ms after it opened. The
spec now reloads at phone width, as a phone arrives, and waits for the
drawer's own focus handoff before opening the menu.

(cherry picked from commit 4062bc3c00)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/15684
2026-10-01 03:46:19 +00:00
Dustin Healy
7b27e7941e 🧩 feat: MCP Apps support (#13831)
* feat: add MCP Apps support

* fix: preserve MCP App results and enforce sandbox policy

* fix: bind persisted MCP Apps to their server configuration

* fix: complete MCP Apps runtime integration

* fix: type the optional MCP App binding codec explicitly

* test: provide MCP Apps policy in bridge mocks

* fix: pass admitted App policy to the tool call owner

* fix: align MCP Apps CI contracts

* test: preserve MCP abort reasons in recovery mocks

* fix: preserve MCP compatibility across policy profiles

* test: use profiled MCP catalog generations

* test: expect the standard MCP session profile

* fix: remove the unused MCP abort import

* test: expect profiled MCP fixture arguments

* test: seed profiled MCP manager fixtures

* Fix request-header bearer resolution after canary merge

* Preserve MCP App views across canary message updates

* Document message-owned MCP App placement

* ci: Recheck MCP Apps Against Canary Base

---------

Co-authored-by: Lia <lia@librechat.ai>
(cherry picked from commit a98d40f61c)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/13831
2026-10-01 03:46:16 +00:00
Marco Beretta
4ffe3825ec 📧 feat: add email address change (#14597)
(cherry picked from commit 9ff251dd96)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/14597
2026-10-01 03:46:16 +00:00
lia-by-librechat[bot]
5f4d96c49b
🧘 fix: Keep Prose Mounted While Activity Labels Update (#16531)
* 🧘 fix: Keep Prose Mounted While Activity Labels Update

* test: Advance Activity Ticker in Prose Identity Regression

* test: Cover Activity Prose Fade Stability in Browser

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-09-29 21:06:37 -04:00
Marco Beretta
3c72c3fb4a
🐢 perf: Collapse Settled Reasoning Text in AnimatedText (#16403)
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
* perf: Collapse Settled Reasoning Text in AnimatedText

AnimatedText re-split and re-classified the entire accumulated reasoning
string on every streamed token and rendered one element per word, making
a long reasoning stream quadratic. Classification is now append-only: the
leading run of words that finished fading is committed as a single text
node and never re-split, and only the unsettled tail is classified.

* perf: Probe the Settled Reasoning Prefix Instead of Rescanning It

The append check compared the whole settled prefix on every token, which
kept the stream quadratic in character comparisons. It now probes the
prefix head and the region at its boundary, and the settled region is
rendered from the current text so a rewrite can never show stale
characters. Adds a long reasoning stream scenario to the mock harness.

* perf: Settle Spaceless Reasoning Runs Before Their Final Segment

A CJK or Thai reasoning stream never reaches whitespace, so the settled
prefix could not advance and the whole run was re-segmented per token.
Inside a spaceless last word everything before its final segment is now
treated as stable; re-segmenting there only changes fade granularity.

* perf: Bound the Unsettled Reasoning Tail by Length

Settling at part boundaries left any run that never reaches whitespace
(unspaced Hangul, a spaceless script without Intl.Segmenter, long URLs)
in the tail, re-classified on every token. The unsettled region is now
capped at 64 characters regardless of segmentation, replacing the
spaceless-specific rule; only non-animated text is ever cut, so a cut
inside a part is invisible. Tests measure the classified length per
render instead of the DOM shape.

* fix: Keep the Settled Reasoning Cut on a Glyph Boundary

The length cap could cut inside a surrogate pair or a combining or ZWJ
sequence, splitting one glyph across two text nodes. The cut now steps
back past continuation code units.

* fix: Cut the Settled Reasoning Prefix at Grapheme Boundaries

Code-unit rules missed emoji modifiers and regional-indicator flags. The
cut now takes the last grapheme boundary from Intl.Segmenter over the
unsettled tail, which starts at a committed cluster boundary and is
bounded by the cap; the code-unit rule remains as the fallback.

* fix: Skip the Reasoning Tail Cap Without a Grapheme Segmenter

The code-unit fallback could still split emoji modifiers and flags. With
no Intl.Segmenter there is no safe cut, so the cap is not applied and the
tail stops at the last word, as it did before.

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-09-26 22:08:22 -04:00
Danny Avila
0c47ce92a8
💭 feat: Bring the Streaming Thought Peek Back Under a Collapsed Live Card (#16394)
* 💭 feat: Bring the Streaming Thought Peek Back Under a Collapsed Live Card

#14546 previewed streaming reasoning as its trailing sentences in a short
fading window under the thought's header. The live fold (#16118) put that
thought inside a collapsed card, which unmounts its rows, so the peek went
with them and one throttled sentence on the header stood for a paragraph
of live reasoning.

A collapsed live card whose tail is a streaming thought now renders the
same peek under its header, outside the fold, in the cursor's place. It
gives way to the rows when the card opens and to the cursor when a call,
not a thought, is at the tail.

* 🧪 test: Watch Live Reasoning Stream Through the Real App

A mock-lane scenario streams three sentences of reasoning at a readable
pace; the spec samples the collapsed card's header and asserts every line
was the generic one or a whole sentence, sees the thought peek under the
card, opens the card mid-stream and checks the header became a title, then
checks the settled thought's header sits at the shared row scale.

The peek strips the thought's tags itself: handed the stream straight from
a live card, it had shown a literal `<think>` before the first words.

* 🎨 style: Sort Activity Phase Imports After Branch Rewrite

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-09-26 22:00:24 -04:00
Danny Avila
a047548fa7
🪜 feat: Title an Open Activity Fold and Reach Failed Calls in One Click (#16390)
* 🪜 feat: Title an Open Activity Fold and Reach Failed Calls in One Click

An open phase or tool group now reads as the title of the rows under it:
the header steps up to primary semibold, pins the stable label instead of
the live line, and sticks to the top while its rows scroll. Rows step in
24px under a hairline rail hung from the header glyph, one level per fold.

A failure is one click away from anywhere. A "N failed" pill beside the
header opens the fold and every failed row's output; a collapsed card peeks
its first failed call and error line under the header; the failed row
carries a red stripe, the error's first line as its subtitle, and names its
subject by the model's intent as the live header and peek already do.

The reveal travels down a FailedRevealContext counter that a group relays to
its own rows only once they have mounted, so a request made on a closed
card reaches a row three lazy disclosures below it.

* 🧪 test: Drive the Activity Fold Through the Real App and Fix What It Showed

A mock-lane spec runs a phase whose middle batch holds a call that failed
schema validation beside a slow one, watches the fold stream, then reaches
the error from the peek, from the pill, and again after a reload, in both
themes, with no console or page errors.

Three things the real app showed that the harness had not:

- The client counted only two of the server's three failed-output shapes,
  so a schema-validation failure that the server labelled `partial` rendered
  as a completed card with no pill. `isError` now mirrors
  `completedToolExecutionStatus`.
- A row's label lost its last letters to an ellipsis whenever its subtitle
  overflowed: the weighted shrink left the label a fraction of a pixel short.
  The subtitle now takes all of the shrink and the label caps at the row.
- The peek named an MCP call by its server while the row named the tool.
  Both now name it the way the row does, and the error line drops its bare
  `Error:` prefix the red glyph already speaks for.

* 🎯 fix: Answer a Failed-Call Reveal From Every Card's Disclosure Control

The reveal was consumed by the generic ToolCall row alone, so a failed
bash, code, memory, file or skill card, each rendered through its own
component, opened its group and stopped. The consumer now lives in
ProgressText, the disclosure control every card renders: a failed, openable,
closed row opens through the card's own toggle, and the one row the request
lets take focus lands the reader on its labeled button rather than on an
unnamed wrapper. The request carries a one-shot focus claim, relayed
through nested providers, so a phase with several failures opens all of
them and focuses only the first in document order, the one its peek named.

Also from the same review: an error line is derived only from output that
is an error, so a step failed by its run status or a status attachment no
longer shows ordinary output in red; a standalone group shows its failure
count once, on the pill, keeping the text for the accessible name; and the
label and subtitle share one shrinking box so the verdict, duration and
chevron after them never lose width.

* 🎯 fix: Make Failed Activity Cards Reachable From Fold Controls

* 🛡️ fix: Keep Legacy Search Errors Hidden Outside Failure Summaries

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-09-26 21:25:30 -04:00
Danny Avila
402c19ce32
🧪 ci: Count System Instructions in Mock Model Usage (#16350)
The e2e fake model reported input tokens for the chat messages alone, because the SDK hands a test override model the pruned messages without the systemRunnable pipe. Once #16301 gave every memory-enabled chat a system prompt, the calibrated context snapshot put used tokens below the instructions and the gauge dropped its Messages row. Count input over the complete prompt, as a real provider bills it.
2026-09-24 21:50:50 -04:00
Marco Beretta
14d8bb8d3c
⚡ perf: Throttle Code Highlighting While a Message Streams (#16073)
* ⚡ perf: Throttle Code Highlighting While a Message Streams

* fix: harden streamed code highlight throttling

* test: cover wall clock changes during highlighting

* style: tidy highlight regression test

* fix: restart highlight work across lifecycle changes

* style: avoid nested highlight timing ternary

* fix: propagate highlight throttle to startup config

* fix: share and validate highlight throttle

* fix: keep streamed code visible during highlighting

* test: stream highlight tool arguments

* fix: preserve highlights when cadence config resolves

* fix: reschedule highlights when cadence changes

* test: preserve default fake tool chunking

* fix: prevent stale streamed highlights

* test: open the tool pane before asserting streamed highlights

Every scenario in this file waited for highlight tokens without opening the
card. Dev's #16143 stopped passing a closed pane any code at all, so the four
runs polled a card that renders raw text and had nothing to find: the failed
traces show the disclosure at aria-expanded="false" for the whole run, with no
click against it and no tokens in the code element.

Highlighting is now asserted through the card's disclosure, which ProgressText
owns and which carries an aria-expanded state only once the card has input to
show, so waiting on it also waits for the first streamed argument chunk. The
open happens inside expectHighlightedCode, so a scenario cannot assert tokens
without it, and it lands while arguments are still streaming, which is the only
window where the throttle is under test at all.

* test: reopen the rebuilt card for the settled highlight

Opening the pane got the streaming assertions passing and the traces show 240
highlight spans mid-stream, so the throttle itself lands. The settled check
still failed because persisting the streamed message rebuilds the card, and a
rebuilt card starts closed while autoExpandTools is off: the disclosure goes
back to aria-expanded="false" and a closed pane renders raw text.

The settled and cancelled states now assert through the same open-then-wait
helper, so each one measures the card the reader would actually be looking at
instead of the tokens the streaming card happened to leave behind.

* test: leave a window to cancel a streaming highlight

With the settled assertions fixed, the cancellation scenario timed out on the
Stop button instead: it waited for a highlight before stopping, and the ~40
argument chunks it streams at 35 ms are gone in under two seconds, so the run
had already finished and there was nothing left to cancel. It failed on all
three attempts.

The card is now opened and the run stopped before any token is awaited, since
tokens after cancellation are what the scenario is about, and the cancel
variant streams its arguments at a wider cadence so the window does not depend
on how loaded the runner is. Only that label changes cadence; every other
scenario keeps the timing it had.

* fix: preserve initial highlights and honor shared-page cadence

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-09-21 07:15:32 -04:00
Marco Beretta
9cd1de30f6
⚡ perf: Split Streaming Markdown Blocks Incrementally (#16071)
* ⚡ perf: Split Streaming Markdown Blocks Incrementally

* test: cover streamed markdown block rendering

* fix: isolate streamed markdown splitter caches

* fix: satisfy markdown splitter static checks

* test: mock isolated markdown splitter

* test: isolate markdown splitter spies

* test: cover concurrent streamed markdown messages

* fix: preserve provisional streaming markdown boundaries

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-09-20 19:26:38 -04:00
lia-by-librechat[bot]
d281c31d54
🫛 test: Separate an Authoring Run From a Skills-Off Run (#16128)
Co-authored-by: Lia <lia@librechat.ai>
2026-09-20 08:25:07 -04:00
Dustin Healy
ec1304f684
🛅 fix: Preserve Agent Management Upload IDs (#15840)
* fix: preserve agent management upload IDs with E2E coverage

* test: clean up agent management upload fixtures
2026-09-14 15:24:47 -04:00
Marco Beretta
b204216c64
🧷 fix: Keep a Failed Summary From Bounding the Conversation History (#15913)
* 🧷 fix: Skip Failed Summaries When Resolving the Conversation Checkpoint

* 🧷 fix: Keep a Failed Summary Out of the Model-Facing History Boundary

* 🧭 refactor: Own the Summary Checkpoint Predicate in packages/api

* 🧯 fix: Reject Unfinished Summaries Everywhere and Recount Stripped Turns

* 🧬 fix: Version Event-Actor Summary State So Legacy Prefixes Cannot Warm

* 🏷️ fix: Stamp Inherited Summaries Where Actor State Is Assembled

* ⚖️ fix: Drop Unusable Summaries While Building the Prompt

* 🧷 fix: Repoint Prompt Content Instead of Splicing Stored Parts

* 🧭 fix: Treat a Streamed Summary Without a Boundary as Unfinished

The server has stamped `failed` on an errored summarize round only since
#14546, and `summarizing` never reaches storage, so every round that errored
on v0.8.7 or rc2 was persisted as a plain summary holding its partial deltas.
The flag checks cannot tell that row from a checkpoint, so upgraded
conversations kept losing the history before it.

The aggregator settles it structurally, identically in every SDK release
that has shipped compaction (3.1.63 through 3.8.6): deltas stream `content`
blocks into the part, and only a completed round replaces the part with the
final block, which is the sole writer of `boundary`. A `content`-block summary
without a boundary therefore never finished. `isUsableSummaryPart` and the
shared `isCompactedLeaf` both apply that rule; bare-`text` rows predate the
aggregator and stay governed by the flags.

Fixtures that stand for completed summaries now carry the boundary a real
run writes, and the flag fixtures keep one so they still test the flags.

* 🔁 fix: Strip Unusable Summaries From Responses API Continuations

`previous_response_id` loads the stored conversation and hands each message's
`content` array straight to `formatAgentMessages`, whose summary scan takes
the last summary part carrying text as the history boundary. The chat client
strips unusable summaries before that scan; this entry point did not, so a
conversation continued through the Responses API still lost everything before
a failed round. The same packages/api helper now runs ahead of the formatter.

* 🧭 refactor: Own Event-Actor Summary Selection in packages/api

`getLatestEventActorSummary` decides which summary a warm continuation
carries forward, how a missing token count is recorded, and how the state is
stamped. That is compaction behavior, and every helper it relies on already
lives in `packages/api/src/agents`, so it moves beside `isUsableSummaryPart`
and the controller imports it.

* 🧪 test: Give the Finished Compaction Leaf the Boundary a Completed Round Writes

`isCompactedLeaf` now requires the boundary only a completed summary block carries, so the client fixture for a finished compaction needs one, and a boundaryless leaf joins the interrupted compactions that can be retried.

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
2026-09-14 10:22:47 -04:00