Repository navigation
fix(chat-ui): architectural fixes, LLM backend improvements, and UI rendering fixes - #561
Merged
Merged
Conversation
Concurrency & correctness fixes: - Serialize chat requests (Semaphore 2→1) to prevent _TOOL_REGISTRY cross-request data contamination - Use setdefault for atomic per-session lock creation - Replace unreliable locked() check with wait_for timeout → 409 - Hold session lock through full streaming response duration - Save user message inside the streaming lock scope - Clean up session locks on session delete to prevent memory leak - Guard _transaction() against use-after-close (RuntimeError) - Add cancelled event to SSEOutputHandler; check in producer between phases; set after consumer loop for clean thread teardown - Restrict _compute_allowed_paths to document dirs only (home dir added as fallback when no docs, not unconditionally) - Convert SSE streaming buffer Cases 1b/2/3 to elif chain to prevent double-processing on multi-match buffers - Remove dead _fence_start variable in agent.py LLM backend improvements: - _ensure_model_loaded: pass ctx_size from MODELS registry to load_model - _try_reload_with_ctx: auto-reload model with larger context window when requested ctx_size exceeds current; prevents infinite reload loop by always updating cls._context_size - LemonadeProvider: fall back to reasoning_content when content is empty - ChatAgentConfig: base_url defaults via env var LEMONADE_BASE_URL - AgentSDK: forward max_tokens to generate() calls - Strip Qwen3 <think> tags before JSON parsing in agent response handler Test fixes: - Update load_model assertions for new ctx_size parameter - Update print_context_message assertions to reflect _context_size update behavior after reload attempt
itomek
marked this pull request as ready for review
March 17, 2026 13:53
kovtcharov
approved these changes
Mar 17, 2026
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Agent,ChatAgent, andAgentSDKwith better LLM backend handlingLemonadeManagerfor robust model loading lifecycle management; fixes toLemonadeClientandlemonadeproviderchat.pyrouter, fixed SSE handler, session management improvements, and database schema updatesMessageBubble.tsxand improved file list tool summariesTest plan
python -m pytest tests/unit/— all unit tests passgaia chat --uilaunches and renders code blocks correctlyLemonadeManager🤖 Generated with Claude Code