Skip to content

v2.2.10

Choose a tag to compare

@hjxwz123 hjxwz123 released this 14 Aug 07:50
· 90 commits to main since this release

What's Changed

Aivory 2.2.10 completes the context-compaction lifecycle for long conversations and improves the rendering performance of long, actively streaming responses. Compaction now preserves substantially more of the information needed to continue a conversation safely, handles large histories through bounded summarization requests, settles its own usage correctly, and remains consistent across edits, deletions, branches, concurrent requests, and multiple application replicas. On the frontend, completed Markdown blocks no longer repeat expensive rendering work whenever the response tail grows.

Automatic and Manual Context Compaction

  • Automatically compacts older completed conversation history after the configured token threshold is reached while preserving recent messages verbatim.
  • Keeps the complete visible conversation in storage. Compaction changes only the historical context sent to a model and does not delete the user's original messages.
  • Retains both a minimum number of recent user and assistant rounds and the configured percentage of recent messages, keeping current instructions and active work outside the summary.
  • Supports explicit compaction through /compact, with stable results for disabled compaction, insufficient history, an active generation, a changed conversation, model failure, persistence failure, and timeout.
  • Adds real-time started, completed, and failed notifications for automatic compaction instead of allowing background work to appear silent or stalled.
  • Treats abandoned streaming messages with a configurable grace window so a crashed generation cannot block later manual compaction indefinitely.

Summary Quality and Request Limits

  • Replaces a fixed short summary target with an adaptive target based on source size and conversation rounds, preserving more decisions, constraints, unresolved work, and factual detail from long chats.
  • Retries a materially under-produced summary when the source contains enough information to justify the requested target, without padding genuinely short or sparse conversations.
  • Processes oversized summary sources through bounded map-reduce stages rather than sending one request that exceeds the selected model's context window.
  • Adds an administrator-controlled per-request compaction budget with a default of 32,768 tokens and a minimum of 8,192 tokens; longer histories are split and progressively merged within that budget.
  • Enforces the configured summary output ceiling in provider requests. Model reasoning or thinking defaults cannot silently raise the administrator's hard compaction limit.
  • Bounds cumulative summary blocks and folds them in conversation order when their configured merge budget is exceeded.

Complete Tool, Citation, and Attachment Context

  • Recovers complete recognized native tool results from provider data for summarization instead of relying only on the short preview stored in normalized chat blocks.
  • Preserves important conclusions near the end of long search, paper lookup, webpage, database, and other tool results by splitting complete results across bounded map-reduce requests when necessary.
  • Uses a provider-neutral internal tool envelope so OpenAI, Anthropic, and Gemini tool history can be summarized without replaying one provider's native payload through another provider.
  • Adds citation titles, URLs, snippets, attachment metadata, document references, and generated-artifact details to the compaction source so retained references remain understandable.
  • Persists image and hosted-image artifact references across the compaction frontier and rehydrates verified images for compatible vision models within a bounded aggregate byte budget.
  • Keeps complete internal tool output private: normal conversation APIs continue to return the existing bounded preview rather than exposing raw results recovered for summarization.

Billing, Concurrency, and Data Consistency

  • Adds independent credit reservation, settlement, and release for manual and asynchronous compaction, preventing positive usage records that were never deducted from the user's balance.
  • Keeps inline automatic compaction inside the current response settlement while giving background and manual work their own attributable accounting lifecycle.
  • Adds database-backed per-conversation compaction leases across manual, inline, and asynchronous paths, preventing duplicate model calls and duplicate charges across concurrent requests or application replicas.
  • Serializes summary persistence with conversation edits and deletions and verifies source-content fingerprints, preventing stale asynchronous work from writing deleted or superseded content back into a summary.
  • Revalidates the exact source messages immediately before the summary update and uses compare-and-swap protection when the summary state changes concurrently.
  • Includes message-content fingerprints in the token-estimate cache key so equal-length edits invalidate old estimates and do not trigger compaction too early or too late.

Branch and Model Safety

  • Orders connected summary blocks according to their actual position on the active conversation branch, preserving the sequence of requirements, decisions, and corrections.
  • Protects shared-prefix summaries still required by sibling branches when one branch creates or merges its own summary blocks.
  • Stops an asynchronous task when its explicitly captured branch leaf has been deleted instead of falling back to and compacting the conversation's latest branch.
  • Validates a dedicated compaction model before use. If it is missing, disabled, deleted, or unavailable, Aivory falls back to the current conversation model and then the configured task model.
  • Preserves provider output limits and prompt-tool behavior across fallback attempts without replaying incompatible raw history.
  • Cleans up per-conversation command state when the user navigates away and rejects concurrent /compact requests before they can perform duplicate work.

Administration and Configuration

  • Provides administrator controls for enabling compaction, the global token trigger, the model-level threshold cap, minimum retained rounds, and the percentage of recent messages retained verbatim from 10% to 50%.
  • Provides separate controls for the new-summary output limit, adaptive summary target from 5% to 80%, accumulated-summary merge budget, and per-request input/output budget.
  • Allows administrators to select a dedicated conversation model for compaction or inherit the conversation/task-model fallback chain.
  • Allows a custom compaction instruction to be prepended to Aivory's built-in continuation-summary prompt.
  • Validates the complete compaction configuration atomically so an invalid model, percentage, token budget, or prompt value cannot leave a partially updated settings set.
  • Excludes runtime compaction leases from backup export and import, preventing restored conversations from remaining temporarily locked by state captured on another deployment.
  • Updates the English and Simplified Chinese configuration references and synchronizes administrator and chat messages across English, Simplified Chinese, Traditional Chinese, Japanese, and French.

Long Response Rendering

  • Splits rendered Markdown into independently memoized block views for headings, paragraphs, lists, code, Mermaid diagrams, blockquotes, formulas, separators, and tables.
  • Prevents completed leading blocks from repeatedly running inline or block Markdown conversion, sanitization, and related React rendering work whenever new text arrives at the end of a response.
  • Limits most streaming updates to the trailing block whose content is still changing, reducing avoidable CPU work and DOM updates on multi-section answers.
  • Continues tokenizing the complete Markdown source so block boundaries, incomplete trailing syntax, citations, and final output semantics remain consistent with previous releases.
  • Preserves code controls, preview identities, Mermaid behavior, KaTeX output, tables, citation clicks, line-break preferences, and block-level entrance animations.
  • Keeps the final non-streaming render authoritative when generation completes. This optimization does not virtualize, hide, truncate, or delay visible response content.

Upgrade Notes

  • Database migrations run automatically for SQLite and PostgreSQL; no manual SQL migration is required.
  • The migration adds the conversation_compaction_leases runtime table. Existing conversations, messages, summaries, knowledge bases, files, and embeddings require no rebuild or re-upload.
  • Existing compaction settings remain valid. Administrators should review the new request budget and summary target if longer, more detailed summaries are desired.
  • Compaction applies to eligible older completed history. It does not replace provider context limits or the existing validation, document-routing, RAG, and sandbox paths for one oversized current prompt or attachment.
  • No API, provider, model, billing, permission, or stored-message format change is introduced by the Markdown rendering optimization.
  • For Docker deployments, set IMAGE_TAG=2.2.10 and leave SANDBOX_IMAGE_TAG unset after the matching application and sandbox image workflows complete.

Validation

  • go build ./..., TypeScript type checking, and ESLint passed.
  • Focused Go tests for LLM compaction, task-model fallback, billing, concurrency leases, branches, media recovery, API handlers, storage, backup behavior, and generation configuration passed.
  • All 68 frontend test files and 415 frontend tests passed, including Markdown citations and context-compaction notifications.
  • The production frontend build completed successfully. Existing Vite dynamic-import and large-chunk notices remain warnings rather than build failures.

Release Scope

  • Context-compaction lifecycle hardening is based on 4affeb33f5a85139b55d3341881d9fa9f53c1a42 (fix(compaction): harden context lifecycle).
  • Long-response rendering optimization is based on fbea11b33010438b7d9085cb974c1d2372b00a92 (fix(chat): reduce long response render work).
  • The v2.2.9 release notes focused on the access-control work. The compaction hardening already present in the source history is intentionally documented in full here together with the rendering update.

Full Changelog: v2.2.9...v2.2.10