Librechat-Mobile/VERSION_GATES.md
Garfie abde86ca4e chore(sync): sync to upstream LibreChat v0.8.5
Targets upstream tag v0.8.5 (commit 9ccc8d9be). Bumps the supported
backend version constant, advances the upstream submodule pin, and
adds wire-protocol parity for new server features.

Wire protocol
- Add ContentType.SUMMARY enum value and flat sibling fields on
  MessageContentPart (content as JsonElement to absorb array/string/
  legacy-text variants per BaseClient.getSummaryText).
- Add Anthropic effort.xhigh dropdown value, ThinkingDisplay (Opus 4.7
  reasoning visibility), and Message.contextMeta pass-through.
- Add allowAccountDeletion to StartupConfig (defaults to true to
  preserve older-server behavior).
- Drop unused instanceProjectId from StartupConfig and from
  ConfigRepositoryImpl.isValidLibreChatConfig.

New endpoints / features
- Favorites: UserFavorite DTO + FavoritesApi + FavoritesRepository,
  Settings -> Favorites sub-screen (list/unpin), pin icons in chat
  model selector. Repository owns the canonical list as a StateFlow
  guarded by Mutex.withLock so chat-side toggles and settings-side
  bulk-unpin can't drift apart and concurrent writes can't lose each
  other.
- Prompt-group usage telemetry (POST /api/prompts/groups/:id/use,
  fire-and-forget on prompt insertion).
- Summarize SSE events (on_summarize_complete -> StreamEvent.ContextSummary)
  and a collapsible "Summarized earlier messages" card rendered from
  the persisted SUMMARY content part. Forward-compat else-arm preserved
  on both LangGraph and legacy SSE mappers.

Backward compatibility
- BackendVersion.isCompatibleOrNewer helper added; documented fail-open
  contract for callers that have already null-checked
  detectedBackendVersion.
- New VERSION_GATES.md catalog at repo root tracks every code path that
  branches on server version. Initial entries:
  - isCollaborative agent toggle (hidden on v0.8.5+; full-ACL UX deferred)
  - xhigh effort dropdown value (filtered out on <v0.8.5 to avoid
    server-side enum rejection)

Defensive hardening
- ChatApi.startChat asserts Content-Type: application/json before
  decoding ChatStartResponse and catches NoTransformationFoundException
  as a backstop, translating both to a friendly ApiException. Observed
  during testing on v0.8.5-rc1 with summarization enabled, where the
  agents chat-start endpoint returned 200 OK with no Content-Type and
  Ktor leaked a NoTransformationFoundException stack trace into the
  chat surface. Belt-and-suspenders against future backend regressions
  or unsupported-server pointing.

Documentation
- DISCOVERY.md updated for the v0.8.5 surface: /api/endpoints now
  requires JWT, /api/config pre-auth/post-auth split, allowAccountDeletion,
  instanceProjectId removal, favorites endpoints (with all three XOR
  variants: agentId | model+endpoint | spec), prompt-usage endpoint,
  /api/admin/** marked out-of-scope. Plus a new MessageContentPart +
  SUMMARY wire-shape section.

iOS
- Swift SharedFrameworkTest.swift updated for the new
  StreamEvent.ContextSummary variant and Message.contextMeta
  constructor argument.

Out of scope (by design)
- /api/admin/** route family - web-only feature.
- Full ACL migration for agent sharing - replaced by version-gating
  the legacy isCollaborative toggle.
- Spec-pinning UI on mobile - UserFavorite.spec round-trips for
  fidelity with web-authored pins, but mobile does not yet surface
  a spec picker.
2026-04-26 23:48:14 -06:00

2.8 KiB

Version Gates

LibreChat Mobile supports a range of backend server versions. This file catalogs every place in the codebase where behavior branches based on the detected server version so the compatibility surface is auditable. When the minimum supported server version is raised, entries here can be simplified or removed.

The canonical API for version comparisons lives in core/common/src/commonMain/kotlin/com/garfiec/librechat/core/common/BackendVersion.kt:

  • BackendVersion.parse(version) — parse a loose semver string ("v0.8.5", "0.8", …).
  • BackendVersion.isCompatible(supported, actual) — same-major.minor check (patch ignored).
  • BackendVersion.isCompatibleOrNewer(actual, minimum)actual ≥ minimum by (major, minor).
  • BackendVersion.extractVersionFromFooter(footer) — fallback parse from customFooter.

The detected server version is exposed via ConfigRepository.detectedBackendVersion (populated once checkBackendVersion() runs on app startup / server-switch).

Catalog

Feature Gated since Behavior on older Behavior on newer File:line Safe to remove when min supported server ≥
isCollaborative agent toggle v0.8.5 (2026-04-23) Toggle visible; mobile sends isCollaborative + projectIds to server Toggle hidden; inline hint "Access permissions are managed server-side in this version" rendered instead; fields not sent feature/agents/.../components/AgentSharingSection.kt + feature/agents/.../viewmodel/AgentEditorViewModel.kt (observeServerVersion, save) v0.8.5
xhigh reasoning-effort dropdown value v0.8.5 (2026-04-25) xhigh filtered out of reasoning_effort and effort dropdowns (older Anthropic/Bedrock/OpenAI schemas reject the unknown enum) xhigh shown alongside low/medium/high/max core/ui/.../components/EndpointParameterRegistry.kt (getDefinitions(xhighEffortSupported)) + feature/chat/.../viewmodel/ChatViewModel.kt (xhigh observer in init) v0.8.5

Guidelines for adding a new gate

  1. Call BackendVersion.isCompatible(...) or BackendVersion.isCompatibleOrNewer(...) — never parse versions ad hoc.
  2. Default to older-server behavior when the version is unknown (detectedBackendVersion == null). The server may not advertise its version; failing open avoids hiding features from self-hosted installs with stripped customFooters.
  3. Add a row to the table above. Include file + line anchors and the concrete minimum version at which the gate becomes dead code.
  4. If the gated field is a request DTO field, omit it (send null) rather than sending a value the server will silently drop — unless you can verify round-trip parity. Silent drops lead to UI state that disagrees with server state.
  5. Never gate on patch versions; the version detection is best-effort and the compat check is minor-version-only.