* perf: Async Local File Saves and Compile Hot-Path Regexes Once
* perf: Check Closing Code Fences Without a Per-Length Regex Cache
* test: Build the Delivery Route Config Before Routing Instead of Mutating It
mergeFileConfig now memoizes by config identity, so the CSV fallback tests
must set textFallbackWithoutTools when they build the request config rather
than mutate the object after the agent's routing already merged it.
* fix: Write Local Buffers Atomically So Concurrent Saves Cannot Interleave
Async writeFile calls to one deterministic path (OpenID and SAML avatars)
could truncate and interleave each other. Write through a temp file and a
rename instead, and add scenario specs for local saves and longer closing
fences.
* refactor: Move Local Save Logic Into packages/api
saveLocalBuffer, the temp-upload move and the atomic directory writes now live
in packages/api/src/storage/local.ts and receive their paths from the caller;
the Local strategy in /api keeps its logging and calls through. The traversal
check now runs before any directory is created.
* fix: Copy Moved Uploads Through a Temp File and Rename Into Place
Concurrent async copies to one destination could interleave just like direct
writes, so moveLocalFile now fills a sibling temp file and renames it.
* fix: Contain Every Local Write and Move Inside Its Target Directory
The traversal check that guarded saveLocalBuffer now runs in writeLocalFile
and moveLocalFile too, before any directory is created, and the buffer
save accepts only the images and uploads base paths.
* test: Define the Success Assertion Inside the Local File Saves Scenario
* fix: Give Atomic Write Temp Files a Fixed-Length Name So Long Targets Still Fit
* test: Send Image Dimensions and Read the Message Array in the Local Saves Scenarios
* feat: Return a Navigable Progress Tree When Checking a Running Subagent
check_background_task on a running or finished-but-undelivered subagent now
returns an activity digest: the child's turns, tool calls, and replies folded
to one line each and addressed by stable positional paths. Callers expand one
node or range with expand, and page with since against a settled-node cursor.
The owning process folds the child's update stream into a bounded tree that
keeps only tool names, the model-authored intent label, the tool-authored
outcome label, statuses, timings, and sizes. Routed claims carry the tree to a
poll on any replica, lists carry counts and the node in flight, and a finished
child whose owner is gone is rebuilt from its durable public projection.
The background-task card renders the digest as a foldable tree and links the
existing subagent activity panel.
* fix: Tighten Progress Digest Verdicts, Overflow Bounds, and Rebuilt Trees
Failed reply steps and schema-rejected calls now record as errors, and an
overflowed call is counted once without retaining it in the lookup maps.
A tree rebuilt from the durable projection re-checks completed calls with the
shared failure verdict, carries the projection's truncation, and tells the
caller its paths are a reconstruction. The card localizes folded summaries
instead of rendering the server's English tally.
* fix: Measure Single-Part Message Deltas in the Progress Digest
* fix: Scope Nested Progress Ownership by Run and Count Overflow Once
Nested runs now attach to the call recorded by their own spawning run, since
provider call ids repeat across runs. Only the step that announces a call can
count it as overflow, so later sightings of an unretained or evicted call never
re-count it or reopen history. A zero-valued since cursor is rejected, and the
card labels MCP tools with the configured server names.
* 🔭 feat: Recover Stale Chunks Without the Error Page and Ship Client Logs to RUM
Stale chunks: a tab left open across a deploy that opens a code-split panel
requests a hashed chunk the new deploy removed. Vite's preload handler hands
the failure to the stale-asset recovery, which reloads, but the import then
resolves to `undefined` and `React.lazy` throws a TypeError into the route
error boundary, so the error page flashes before the reload. Lazy imports now
go through `lazyWithRecovery`/`importWithRecovery`, which turn that result into
a `ChunkLoadError`; the route boundary recognizes chunk failures (and any error
while a recovery reload is underway), asks the page recovery once, and renders
a localized "Updating to the latest version…" status. When the loop guard
declines, the normal error page with its reload action shows instead. The
page recovery is now idempotent within a page, so concurrent callers join the
in-flight reload rather than tripping the guard.
Client logs: with RUM in proxy mode, the client logger's warn/error calls,
error-boundary catches and stale-asset recovery events are exported as OTLP
log records through the authenticated `/api/rum/v1/logs` proxy. Records carry
allowlisted, scrubbed fields only, follow RUM session sampling, dedupe repeats
with a count, are budgeted per minute and per page, batch with backoff, flush
with keepalive on page hide, and stop after persistent failures. The proxy
now refuses non-OTLP content types and applies a per-user rate limit.
`RUM_CLIENT_LOGS=false` turns the export off.
* 🔒 fix: Keep Client Logs Opt-In and Drop Application Error Messages
- RUM_CLIENT_LOGS now defaults to off, like console capture, so enabling
RUM proxy mode never starts a new log stream on its own.
- Error messages are exported only for engine, browser and library
generated types (TypeError, SyntaxError, DOMException, AxiosError,
chunk failures); application errors keep type, status and stack only,
since their messages can echo prompt or response text. All quoted
fragments are now redacted.
- Batches are measured in encoded UTF-8 bytes of the exact request body,
and page hide drains every queued record that fits the keepalive quota.
- Queued stale-asset events are delivered as soon as the log exporter
starts, independent of the RUM SDK loading, and marked so they are
never logged twice.
* 🔒 fix: Export Only Known Generated Error Messages and Ack Queued Events
- Error messages are exported only when the whole text matches a known
engine, browser or library message shape (property access on
undefined, "x is not a function", fetch/abort/axios status, chunk and
CSS preload failures). The error class alone no longer qualifies, since
any code can throw a TypeError carrying arbitrary text.
- Queued stale-asset events are marked logged only after the collector
accepts the record carrying them, so an undelivered event replays on the
next page; in-flight events are skipped by the SDK path.
- A fractional RUM_PROXY_USER_MAX below one falls back to the default
instead of flooring to a limit of zero.
* 🔒 fix: Hold Unacknowledged Asset Events, Re-send In-Flight Logs on Hide
- The RUM SDK flush no longer drops queued stale-asset events whose client
log record is still unacknowledged: they stay queued and persisted,
flagged so their SDK action is not repeated, and leave the queue once
the collector accepts the record.
- Page hide re-sends the records of an unanswered regular request with
keepalive; each record belongs to the latest request carrying it, so a
late response to the original request neither marks nor requeues it.
- Client-log export stops when the authenticated layout unmounts.
- The proxy refuses /v1/logs while client logs, console capture and replay
are all off, so turning RUM_CLIENT_LOGS off also stops tabs that still
hold an older startup config.
* 🔒 fix: Export Only Complete Stack Frames, Never the Message Header
Stack reduction now strips the V8 `name: message` header (including every
line of a multi-line message) and keeps only lines with a complete V8,
Gecko or WebKit frame shape that ends in a URL or absolute path with a
line number. A message ending in a source-position-like suffix can no
longer pass as a frame.
* fix: centralize RUM delivery and asset recovery lifecycle
* fix: preserve RUM page lifetime and collector acknowledgements
* fix: retain page transport quotas and recover functional chunks
* fix: scope RUM client sessions to authenticated identity
---------
Co-authored-by: Lia <lia@librechat.ai>
* fix: Separate workspace admission and transport budgets
* fix: Validate workspace run reserves and retry test types
---------
Co-authored-by: Lia <lia@librechat.ai>
Each mirrored skill now records a sync fingerprint in its sourceMetadata, hashing the mapping version, the upstream identity (source coordinates, skill path and SKILL.md blob id) and the stored definition. When a later run finds the fingerprint still matching and the stored files matching the discovered blobs, it neither downloads SKILL.md nor re-reads and updates the skill; the public viewer grant, name-conflict cleanup, stale-skill reconciliation and status counts run as before. Mirrors without a fingerprint take the full path once and record it.
* fix: Warn When interface.webSearch Blocks Native Search in Model Specs
interface.webSearch syncs the WEB_SEARCH permission, which also gates
provider-native search since #15875. A deployment that set it to false to
hide LibreChat's search tool silently lost native search on its model
specs. Startup now names the affected specs, describes the native-only
configuration, and notes that removing the key keeps the stored permission.
Related to #16673
* fix: Warn When a Stored Role Denies Native Search With interface.webSearch Unset
* fix: persist approval provenance in the resume claim and publish the pre-claim paths from any unapplied abort
The claim CAS now records the provenance it replaces. An abort that lands
before the resumed provider crosses its start CAS publishes those paths, so
schedule deletion, account deletion and user stops no longer label
model-authored chunks as user-submitted.
* test: add approval provenance scenario on the shared approval e2e helpers
* test: seed an earlier started segment before the unapplied abort case
* fix: label abort provenance by the published content and persist the same selection
A path the approval claim added is user-authored only once its tool call
carries output in the abort content, so an abort between the provider
start CAS and the resumed tool keeps the pre-claim labels, and an ask
answer stamped by the abort route keeps its own. AbortResult.jobData
carries the selection so the persisted row matches the final event.
* fix: keep claimed non-tool provenance paths on an abort
Only tool-call paths wait for their resumed call to complete; a steer the
claim already found in the seed content needs no decision to apply.
* fix: count a completed tool call with an empty output as applied in abort provenance
* fix: check abort provenance on the unfiltered content and remap it onto the published parts
* test: type the abort provenance overrides with the job store field names
* test: assert the preserved paths when an unanswered ask aborts
* 📍 feat: Show the Current Text Where a Missing Workspace Edit Belongs
Render the current-text excerpt that LibreChat-AI/code-interpreter#300 workers append to a missing edit's EDIT_CONFLICT diagnosis: a strict parse keeps it only when every row is well formed (contiguous numbers matching the stated range, a known mark, a bounded single line), and LibreChat renders it as a numbered block under its edit with a summary of which lines differ. The excerpt passes the file-content policy like a read_file result and reaches only the model; logs keep the excerpt-free message.
Also stop rendering every 409 as a text mismatch: a Code API rejection such as WORKSPACE_QUARANTINED now passes through with its own reason, and the worker's repetitive-candidate refusal is recognized.
* 🔒 fix: Name Other Attached Edit 409s by Code Instead of Forwarding Their Body
A 409 whose code is not EDIT_CONFLICT (a quarantined workspace) now gets a host-worded message naming only its validated code, with recovery guidance for WORKSPACE_QUARANTINED, and logs keep a body of just that code.
* 🧾 fix: Present Quoted Edit Excerpts as Partial Context, Not Text to Copy
A worker excerpt can window a long region and shorten wide lines with an ellipsis, so the guidance now asks the model to correct old_text against it and use read_file for lines it leaves out or shortens, here and in the attached edit_file descriptions.
* 🔐 fix: Quote Edit Excerpts Only Where the Workspace Allows read_file
A workspace that offers edit_file without read_file now never receives the worker's current-text excerpt, so a failing edit cannot read file content the operation policy withholds.
---------
Co-authored-by: Lia <lia@librechat.ai>
* feat: Remember Tool Approvals Per Conversation
Adds an opt-in "Always allow" choice to the tool approval card. When
endpoints.agents.toolApproval.allowAlways is true, the server marks eligible
paused calls with allow_always; approving with scope "session" stores that
exact tool name on the conversation, and later runs in the same conversation
fold the stored names into the policy as exact-name allow entries.
The server enforces every step: the resume route rejects a session scope the
pause did not offer, eligibility is rechecked against the live policy before
storing, the list is written only through an owner-scoped bounded method, and
generic saves and imports cannot set or clear it. Admin deny and ask rules and
programmatic hooks still win, stored names are ignored under dontAsk or when
the flag is off, and native code tools stay under the code approval picker.
The flag defaults to false, so existing deployments keep prompting.
* fix: Share the Effective Approval Policy and Persist Allows After Resume Fences
Offering, resume re-check, scheduled admission and createRun now read one
policy from buildEffectiveToolApprovalPolicy: endpoint rules healed against
MCP alias spellings, then the conversation's remembered tools. A call held by
a healed ask rule is no longer offered "Always allow", and a scheduled fire
whose known tools are all remembered is no longer rejected as pause capable.
The remembered-tools cap and name length cap move to
toolApproval.allowAlwaysMaxTools and allowAlwaysMaxToolNameLength (defaults
64 and 256). The card stops offering the choice for new tools once the cap is
reached instead of silently approving once.
The resume route stores remembered tools only after the schedule and project
context fences pass; a storage failure still approves the call once.
* fix: Offer Always Allow Only When It Will Hold
Offer allow_always only when storing the name would auto-approve the next
identical call on the run's own path: every MCP spelling of the tool passes
the healed static policy and no programmatic or plugin approval hook can
apply to it (the pause payload does not record which hook asked).
Remembered names now expand to every alias spelling of the same tool, and a
deny or ask on any spelling keeps the tool ineligible. A table-driven spec
walks the invariant through the real hook wiring.
* fix: Recheck Approval Hooks Before Remembering a Resumed Approval
The resume-time eligibility recheck now applies the same programmatic and
plugin PreToolUse hook check as marking, with a hook context built from the
resume request and the live plugin hook source. A hook registered after the
pause turns the choice into a one-time approval: nothing is stored and the
resume continues.
Document that toolApproval.allowAlways should be enabled only once every
replica supports it, since older replicas ignore the choice.
* fix: Judge Always Allow Offers Against the Run's Live Aliases and Active Cap
* fix: Charge Only New Tool Names Against the Remembered Approval Cap
* fix: Recheck Remembered Approvals Against the Paused Run's Aliases
* chore: Sort Imports in Agent Run After Rebase
* 📝 docs: Describe Attached-Workspace Lanes, Sandbox Scratch, and Skill Files in Tool Descriptions
- Lane-mode `cwd` now states that any call outside `.worktrees/<name>` (with or
without cwd, and file tools on such paths) is checkout-wide: it waits for
running worktree calls and blocks new ones until it finishes, so checkout-wide
calls are reserved for creating, pruning or removing worktrees.
- `command`/`cwd` state that the command starts in cwd, so the model does not
also cd into it; the lane-mode cd hint says the call ran checkout-wide.
- Workers advertising the native SRT sandbox profile (`anthropic-srt`,
`anthropic-srt:<preset>`) get a bash bullet that / and /tmp are read-only and
scratch files belong in $TMPDIR or the workspace. Carried as
`codeWorkspace.nativeSandbox` into tool definitions and the bash tool.
- The attached skill-aware `read_file` description says skill files are not on
the attached machine and must be written into the workspace to run there.
- Tightened the attached bash description so the native variant stays within
the 1024-character tool description limit.
* 📝 fix: Keep the Skill-Copy Warning on the Command-Only Workspace's Skill read_file
A workspace that offers execute_command but not read_file falls back to the
skill-only read_file definition. It now carries the same sentence as the
attached skill-aware definition, so the model knows bash_tool cannot reach
skill files by path there.
* 📝 fix: Name bash_tool in the Skill-File Warning Only When It Is Registered
The skill-copy sentence on attached read_file definitions now depends on the
attached bash_tool being registered beside it (includeBash and an advertised
execute_command), for the attached skill-aware definition, its custom
line-limit variant, and the skill-only fallback. Workspaces without commands
keep the plain skill description.
Attached workspace file tools now append a short, specific explanation when
the worker rejects a path with 422:
- NOT_FOUND from a current worker, or INVALID_PATH carrying its
"Workspace path does not exist" message through an older Code API, says
the path does not exist: wait for a command still writing it, or list the
directory to find the right path. For create_file it names the missing
parent directory.
- An older worker's bare INVALID_PATH on read_file, create_file or
edit_file, which it also returns for a missing file, lists the possible
causes: not written yet, a directory or symlink, or a missing parent
directory for create_file.
Other rejections are unchanged.
A conditional generation create that loses its predecessor fence is an expected admission outcome: the store rejects before replacing anything, an automatic continuation defers without consuming an attempt, and a client restores its queued turn. Sibling background-tool wake-ups for one conversation race this fence by design, which logged every lost race as an initialization error with a stack.
Route the controller's initialization-failure log through a typed packages/api helper that logs a predecessor mismatch as a concise warning with the stream, conversation, continuation flag, and whether the current generation is active, and keeps every other failure at error level as redacted text.
* 🔐 fix: Authenticate Code Session Probes the Way Their Route Expects
The liveness probe for previously uploaded code-env files ran with no request from
agent initialization and no route identity, so against an attached or stateful
route it fell back to the managed X-API-Key, which a worker-bound route rejects
with 401. It now mints the bearer for the route's worker and sends the route's
profile and worker headers, exactly as that route's uploads and reads do. The
managed key is reserved for the default Code API and is not even loaded for other
routes; when a route needs a bearer that cannot be minted, its refs are left
unverified without sending a request.
* 🔐 fix: Gate the Session Probe on a Credential Source, Not the Global Auth Mode
* ✅ feat: Default Machine Selection and Linked-Worktree Lanes On
Per-chat machine choice from an agent's saved allowlist and linked-worktree
lane routing were both opt-in, so neither worked until a deployment found and
set its flag. Both are now on unless set to false: machine choice still only
applies to agents with a saved allowlist, and lanes still require a worker
that advertises git_linked_worktree. One helper per flag in data-provider
decides the default for every server reader and the advertised client config.
* feat: Advertise the Code Environment Decision Protocol by Default
Per-chat machine choice needs the conversation decision protocol, which the
client requires before offering allowlisted machines, but the protocol was
only advertised when CODE_ENVIRONMENT_DECISION_VERSION=1. With selection on
by default, authors could save an allowlist the composer never offered.
An unset or blank value now advertises protocol v1; any other value, such as
0, keeps the legacy-safe path.
* fix: Turn Machine Choice Off With the Decision Protocol Opt-Out
CODE_ENVIRONMENT_DECISION_VERSION=0 stopped advertising the protocol but
routing still accepted a non-default machine, so a cached tab or a direct
client could persist a choice during a mixed-version rollout. Machine choice
is recorded through that protocol, so isCodeEnvironmentSelectionEnabled now
requires both, for routing and for the advertised endpoints config. The
protocol resolver moves to code/protocol.ts (re-exported from code/config)
so execution and endpoints can use it without an import cycle.
* style: Format checkout routing regression cases
---------
Co-authored-by: Lia <lia@librechat.ai>
* 🛖 fix: Scope OAuth Binding Cookies to the Public API Path
* fix: Canonicalize OAuth Callback and Cookie Paths Together
---------
Co-authored-by: Lia <lia@librechat.ai>
* ♻️ refactor: Native prompts behind a shared service and adapter
* test: Bound Slow Mongo Fixture Startup and Guard Cleanup
---------
Co-authored-by: Lia <lia@librechat.ai>
* feat: Serve Built-In Endpoint Model Lists From Config So Principal Overrides Can Narrow Them
OpenAI, Google and Anthropic model lists came only from *_MODELS env vars,
which are global, so a role or group override could not narrow them. A
configured endpoints.<name>.models list now replaces the env list and is read
from the per-request config, matching Bedrock.
* fix: Skip OpenAI and Anthropic Model Discovery When a List Is Configured
* feat: enforce required two-factor authentication
Require local and LDAP accounts to enroll in TOTP before they can use the
app when ENFORCE_TWO_FACTOR_AUTHENTICATION is set. Sign-in, refresh, bearer
verification, optional share auth and image authorization all route an
unenrolled account into a staged setup flow, and every bearer credential
minted before enrollment or a password reset is retired.
Password reset retirement uses the existing credentialsChangedAt stamp, and
commitPasswordReset clears any staged enrollment in the same write. Passkey
sign-in follows the same enrollment gate as password sign-in.
* test: cover passkey sign-in handing off to required enrollment
* refactor: keep Mongoose user types out of two-factor auth contracts
* fix: withdraw a minted session when its retirement recheck fails
* fix: hold Agent API keys and the reset CLI to the required two-factor policy
* fix: adopt a setup token handed off after the setup screen mounted
* fix: move every tab that receives an enrollment hand-off into setup
* fix: read the enrollment gate's retirement cutoff in system scope
* fix: clear minted session cookies before the fallible session deletion
* fix: adopt a setup token persisted before the setup screen subscribed
* 🪟 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
* feat: add ephemeral retention mode for forced temporary chats
Adds RetentionMode.EPHEMERAL, which forces every newly saved chat
temporary: hidden from history and search, given the temporary-chat
expiration, and with the toggle locked on.
Forces isTemporary and applies the temporary expiration in the normal
conversation and message save methods, routes Assistants/Threads
messages through the normal message save, applies the all-data
retention policy to file uploads and shared links, and stamps imports,
forks, and duplicates. Locks the frontend toggle and keyboard shortcut
behind an administrator-enforced badge.
The default temporary mode and the existing all mode are unchanged.
* fix: enforce ephemeral retention when resuming paused chats
* fix: preserve forced retention across pauses and assistant turns
* test: Use Real Module IDs for Installed Package Mocks
* test: Wait for Resumed Retention Persistence
* test: Control Mongo Index Setup in OpenID Fixture
* test: Close Mobile Drawer Before Retention Resume Scenario
* fix: Store Responses API Messages Under the Retention Write Context
Input and output messages were saved with the raw request, so under
ephemeral retention they missed the forced-temporary classification the
conversation received. Route both through getConversationWriteContext
and announce the stored reply as saved.
* fix: Align Resumed Responses With the Parent Retention Deadline
A resumed response was saved with a fresh forced-temporary window while
the re-stamp kept the conversation's earlier deadline, so a chat that
paused again could leave its response stored after the conversation
expired. Stamp the saved response with the parent's deadline.
* fix: Clear Released Bookmark Tags When Forcing a Chat Temporary
stampForcedRetention released a converted chat's bookmark counts but
kept its tags, so deleting that chat before TTL removal decremented the
same tags again and reduced counts owned by other visible chats. Clear
the tags in the conditional conversion update that releases them.
* fix: Store No Bookmark Tags on Forced-Temporary Imports
An ephemeral import, fork or duplicate skipped its tag count increment
but kept the source tags, so deleting the copy before TTL removal
decremented counts owned by other visible chats. Store the same tags the
import counts, which is none for a forced-temporary copy.
* test: Provide the Forced-Temporary Retention Helper to the Header Stacking Mock
* test: Reuse One Admin Login per Worker in Ephemeral Retention Scenarios
* fix: Keep Legacy Temporary Chats Temporary When Forking Under All-Data Retention
* fix: Convert a Resumed Chat Under Ephemeral Retention Before It Can Re-Pause Empty
* fix: Treat a Reloaded Pre-Policy Run as Temporary Once Retention Is Forced
* fix: Stamp Messages with the Deadline a Concurrent Retention Stamp Stored
* fix: Wait for the Startup Config Before Rebuilding a Resumed Submission
* test: Wait for the Resumed Response Row in the Ephemeral Resume Scenario
* test: Provide the Real Command Executor Stamp to the Callbacks Mock
(cherry picked from commit 02a70e9c58)
Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/13811
* feat: Show Exit Status for Attached Workspace Commands
Parse the exit trailer the attached-workspace bash_tool writes so the card
fails a non-zero exit, a signal or a timeout, names the reason beside the
failure suffix, and renders stderr distinctly. The group outcome reads the
same parser so its failed count matches the card. Sandbox output without the
trailer keeps the existing heuristics.
* fix: Parse Exit Status Only for Attached Workspace Calls
The sandbox and attached-workspace tools are both named bash_tool, and the
sandbox output is trimmed, so a sandbox command that printed
"[exit code: 1]" last was read as a failed attached-workspace run by the
card and the group outcome.
The execute handler now records a run step when the resolved tool instance
is the one createAttachedWorkspaceBashTool built (tracked by object
identity), and the step-completed handler stamps executor:
'attached_workspace' on the streamed tool call and the aggregated part.
Redis replay and the client SSE merge carry the field through. BashCall
and outcome.ts parse the trailer only when the marker is set.
* fix: Count Styled Terminal Lines Like Plain Ones When Output Ends in a Newline
(cherry picked from commit abc9285523)
Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16556
* 🎒 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