Skip to content

chore(sync): upstream LibreChat v0.8.4 → v0.8.5#61

Merged
garfiec merged 1 commit into
developfrom
chore/sync-upstream-v0.8.5
Apr 27, 2026
Merged

chore(sync): upstream LibreChat v0.8.4 → v0.8.5#61
garfiec merged 1 commit into
developfrom
chore/sync-upstream-v0.8.5

Conversation

@garfiec

@garfiec garfiec commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Brings the mobile client into wire-compatibility with LibreChat v0.8.5 while keeping support for v0.8.4 servers via runtime version gates.
  • Adds support for the new SUMMARY content type, xhigh reasoning effort value, user favorites (agents + models with spec round-trip), permission gates, the allowAccountDeletion config flag, and isCollaborative deprecation handling.
  • Hardens POST /api/agents/chat/{endpoint} against backends that return 200 without a Content-Type header (observed on v0.8.5-rc1 with summarization enabled).

What changed

Wire protocol

  • SUMMARY content typeMessageContentPart flat-sibling shape; extractSummaryText() handles all three runtime variants (Array<{type:"text", text}>, string, legacy text field) per upstream BaseClient.js:831-839. SSE mapper handles the on_summarize_* lifecycle events with else -> null forward-compat preserved.
  • xhigh reasoning effortEndpointParameterRegistry filters xhigh from the reasoning_effort / effort dropdowns when xhighEffortSupported = false; defaults to false (older-server-safe) until BackendVersion.isCompatibleOrNewer(version, "0.8.5") returns true.
  • isCollaborative deprecation — Agent Editor's collaborative toggle is hidden on ≥0.8.5 servers (server-managed) and shown on older versions (legacy field still respected).

Favorites

  • core/data/.../FavoritesRepository{,Impl}.kt — single source of truth via MutableStateFlow + Mutex; optimistic publish + server-rollback pattern.
  • feature/chat/.../delegate/FavoritesDelegate.kt — chat-side toggle and observe.
  • feature/settings/.../FavoritesScreen.kt + FavoritesViewModel.kt — settings-side list/manage UI.
  • New API + DTO at core/network/.../FavoritesApi.kt and core/model/.../UserFavorite.kt (with spec: String? = null for round-trip fidelity).

Permission gates

  • ChatViewModel.kt:1443-1453 reads role permissions via RoleRepository.userPermissions and propagates 11 boolean gates into ChatUiState. Default-permissive on cold start; hasAccessOrPermissive (extension on UserRolePermissions?) fails open for unknown permission types (forward-compat).

Config / version detection

  • StartupConfig.allowAccountDeletion: Boolean = true (NEW v0.8.5 key, default-true preserves older-server behavior).
  • instanceProjectId removed from StartupConfig (REMOVED in v0.8.5).
  • BackendVersion.SUPPORTED_BACKEND_VERSION = "0.8.5"; extractVersionFromFooter() parses the customFooter, isCompatibleOrNewer() powers feature gates.
  • VERSION_GATES.md catalog added at repo root for auditable backward-compat branches.

Defensive hardening

core/network/.../api/ChatApi.ktcatches a chat-start response shape we hit during testing of v0.8.5-rc1 with summarization: enabled: true: backend returned 200 OK with no Content-Type header, leaking a Ktor NoTransformationFoundException stack trace into the chat surface.

The fix:

  1. Pre-decode Content-Type guard — rejects null or non-application/json Content-Type before .body() decode.
  2. NoTransformationFoundException catch — backstop for the case where Content-Type lies.

Both paths surface a clean ApiException: "Server returned an unexpected response when starting the chat. This usually indicates a backend version incompatibility — please check that the server is running a supported LibreChat release."

Belt-and-suspenders, not bug-fix code. The underlying backend defect is fixed in v0.8.5 final (we tested the upgraded image — bug is gone). This guard is only exercised against future backend regressions or users on unsupported servers; the cost is modest (+37 lines, one file) and the failure mode is now actionable instead of a Ktor-internal stack trace.

Submodule + tracking files

  • upstream/ advanced to v0.8.5 (9ccc8d9b)
  • UPSTREAM_VERSION updated
  • DISCOVERY.md — appended new endpoints and revised response shapes
  • VERSION_GATES.md — new catalog file

Backend version range supported

  • v0.8.5 (target): full wire compatibility — SUMMARY rendering, xhigh, favorites, etc.
  • v0.8.4 (existing): all gated features fall back to older-server behavior; no regression.

Known gaps (not blocking)

  • Logout cleanup: this PR adds favorites without user-scoped cleanup, following the existing architectural pattern. The dedicated logout-cleanup work covers this systemically — out of scope here.
  • iOS device test: deferred to manual validation per repo convention.

Test plan for reviewers

  • Build and install on Android device/emulator
  • Connect to a v0.8.5 server and verify the model selector shows agents, the effort dropdown includes xhigh, and the agent editor's Sharing section shows the server-managed text
  • Star/unstar agents and models, verify cross-screen sync between selector and Settings → Favorites, force-stop+relaunch and confirm persistence
  • Connect to a v0.8.4 server (if available) and confirm xhigh is filtered out and the Collaborative toggle is shown
  • Stream a long chat and confirm no Unknown event / NoTransformationFoundException in logcat

@github-actions

github-actions Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Android debug APK

Artifact: librechat-android-debug-61
Download: librechat-android-debug-61.zip
Retention: 90 days
Commit: abde86ca4ed70554582f891bd5cf30d6ca4a2b95

Download requires a GitHub login. Installs over previous debug builds without uninstalling (stable signing key).

@garfiec garfiec self-assigned this Apr 27, 2026
@garfiec garfiec force-pushed the chore/sync-upstream-v0.8.5 branch from c1686ca to 3846b7c Compare April 27, 2026 00:23
@garfiec garfiec force-pushed the chore/sync-upstream-v0.8.5 branch from 3846b7c to 8a0d612 Compare April 27, 2026 05:41
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.
@garfiec garfiec force-pushed the chore/sync-upstream-v0.8.5 branch from 8a0d612 to abde86c Compare April 27, 2026 05:48
@garfiec garfiec merged commit c7b5b7a into develop Apr 27, 2026
5 checks passed
@garfiec garfiec deleted the chore/sync-upstream-v0.8.5 branch May 11, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants