LibreChat/packages/api/src
Danny Avila 59ab01339d
🔎 fix: Report Measured Skill Catalog Truncation (#15590)
* 🔎 fix: Report Measured Skill Catalog Truncation

The catalog truncation warning assumed `SKILL_CATALOG_MAX_ENTRY_CHARS` was
the delivered length. It is only the first rung of the SDK's ladder:
`formatSkillCatalog` applies the per-entry cap, then truncates further
against its own context budget, and finally falls back to names-only.

Two consequences, both silent:

- A description under the 250-char cap can still be cut — no warning fired
  at all. Measured: 8 skills x 200 chars at a 20k context window reach the
  model at 85 chars each.
- When the ladder does engage past the cap, the warning overstated what
  landed — reporting 250 where the true figure was 60.

Measure the emitted catalog instead of assuming the cap held, and warn
separately when descriptions are dropped entirely.

`formatSkillCatalog` is no longer stubbed in the spec. The passthrough mock
never truncated, which is why no test could observe this class of defect.

* 🔁 fix: Measure Duplicate-Named Catalog Entries Positionally

Keying delivered lengths by skill name collapsed duplicates: the catalog
keeps every invocable duplicate as its own entry, so a name-keyed map held
only the last one's length and reported it for all of them.

A 400-char and a 100-char description sharing a name warned "truncated to
100 of 400" when the first entry actually reached the model at 250.

Match positionally instead. Entry order is the order passed to the
formatter, and the names-only fallback drops from the tail, so a skill the
catalog never reached keeps its 0 and reads as dropped.

* 🧵 fix: Detect Catalog Truncation By Containment, Not Line Parsing

Nothing strips newlines from a skill description — validateSkillDescription
checks type, length and trim-emptiness only — so a catalog entry is not one
physical line, and parsing it as one misreports three ways:

- a multiline description the catalog kept intact was measured from its
  first line alone and flagged as truncated
- a description starting with a newline measured 0 and read as dropped
- a continuation line imitating the next entry's marker desynchronized
  every measurement after it (a 400-char entry measured 8)

Entry boundaries are not recoverable from the emitted text, because a
description may contain the exact byte sequence that starts the next entry.
So stop parsing it. A description the catalog kept appears verbatim, and
containment detects truncation from any rung of the ladder without needing
boundaries at all — including the duplicate-name case, which the positional
pass already handled and which this preserves.

Drops the delivered-length figure from the warning. That number is what kept
being wrong, and the actionable signal for an author is that their
description is being cut, not by precisely how much.

* 🎯 fix: Scope Catalog Containment To The Matching Entry

Matching the description alone missed a drop whenever that text occurred
anywhere else in the catalog. The sharp case is the names-only fallback: a
one-word description like "research" collides with a skill *named* research,
so containment held and the warning was skipped for a description that had
been dropped entirely.

Match the whole `- name: description` rendering instead. That is still
containment — no entry parsing, so multiline descriptions, duplicate names
and continuation lines imitating the next marker all stay correct — but a
collision now has to reproduce the entry's full rendering rather than just
its text.

Skips empty descriptions, which render without the `: ` separator and have
nothing to truncate.

* 🔬 fix: Measure Catalog Truncation On A Length-Equivalent Probe

Matching the rendered entry still had a hole: when a multiline description is
cut immediately before text like "\n- next-skill: next description" and the
following entry is exactly that, the catalog holds the full rendering across
two entries and the check passes for a description that was truncated.

That is the fourth variant of one problem — the real catalog cannot be parsed
or matched, because descriptions are arbitrary text that can imitate any
structure the check relies on.

So measure somewhere unambiguous. Every decision in the truncation ladder
reads description `.length` and never description content, so formatting a
probe whose descriptions are same-length filler reproduces the real cuts
exactly, and the probe is parseable by construction: filler carries no
newline and no entry marker, and skill names are validated to
`^[a-z0-9][a-z0-9-]*$`.

This closes the class rather than the instance, and restores the delivered
length to the warning — verified against all six adversarial cases raised in
review, correct on 6/6.
2026-09-04 09:20:02 -04:00
..
acl 🕹️ feat: Configure BYOM Tool Permissions (#15504) 2026-09-02 10:38:00 -04:00
actions 🔑 fix: Decode Action OAuth Credentials After Decryption (#14698) 2026-09-01 18:42:28 -04:00
admin 🛞 feat: Manage Personal Code Environment Lifecycles (#15369) 2026-09-01 21:10:05 -04:00
agents 🔎 fix: Report Measured Skill Catalog Truncation (#15590) 2026-09-04 09:20:02 -04:00
apiKeys 🛎️ fix: Enroll Remote Agent Runs in the Generation Lifecycle (#15349) 2026-08-30 07:14:13 -04:00
app 🚰 fix: Record the Provider Drain When Shutdown Cuts a Generation Short (#15532) 2026-09-03 07:11:38 -04:00
artifacts
assistants
auth 📮 fix: Validate Invite Email Claims (#15542) 2026-09-03 22:27:49 -04:00
cache 💓 fix: Detect Silently Dead Redis Sockets With Deadline-Bounded Heartbeats (#15539) 2026-09-03 09:45:16 -04:00
cdn
cluster
code 🕹️ feat: Configure BYOM Tool Permissions (#15504) 2026-09-02 10:38:00 -04:00
conversations
crypto
db
endpoints ⚡ feat: Add Gemini 3.8 Flash Support (#15519) 2026-09-02 15:06:40 -04:00
favorites
files 🖼️ fix: Stop Reporting a Failed Sandbox Image Read as an Unreadable Format (#15453) 2026-09-01 09:08:01 -04:00
flow
html
images
insights
langfuse
mcp 🛞 fix: Re-Exchange Rejected OBO Tokens (#15577) 2026-09-04 00:06:44 -04:00
memory 🧲 fix: Anchor Memory Partitions to Accessible Agents (#15475) 2026-09-01 18:37:52 -04:00
middleware 🔐 feat: Add M2M Authentication for Agent Management (#15555) 2026-09-03 20:07:00 -04:00
modelSpecs
oauth 🔑 fix: Decode Action OAuth Credentials After Decryption (#14698) 2026-09-01 18:42:28 -04:00
plugins
projects 🗜️ fix: Bound Conversation Page Size (#15576) 2026-09-03 23:52:36 -04:00
prompts
protection 🔭 feat: Audit PII Filter Findings (#15508) 2026-09-02 10:36:06 -04:00
rum
schedules
security
shared-links 🔭 feat: Audit PII Filter Findings (#15508) 2026-09-02 10:36:06 -04:00
skills
storage
stream 💓 fix: Detect Silently Dead Redis Sockets With Deadline-Bounded Heartbeats (#15539) 2026-09-03 09:45:16 -04:00
telemetry 🪵 feat: Add OpenTelemetry Logs Pipeline via Winston Bridge (#15565) 2026-09-03 21:16:09 -04:00
tools 🔭 feat: Audit PII Filter Findings (#15508) 2026-09-02 10:36:06 -04:00
types 🧊 feat: Persist Context Fading Tier Across Agent Runs (#15505) 2026-09-02 20:29:43 -04:00
user
utils 🗜️ fix: Bound Conversation Page Size (#15576) 2026-09-03 23:52:36 -04:00
web
credentials.spec.ts
credentials.ts
imports.spec.ts
imports.ts
index.ts 🧳 feat: Register Principal-Owned Code Environments (#15365) 2026-08-30 19:33:19 -04:00
telemetry.ts