Repository navigation
feat(chat): remove the builtin chat engine, OpenCode only - #666
Merged
Merged
Conversation
The builtin agent loop could run one turn per container: chat-store kept a single isStreaming flag, so a new conversation inherited the running turn's Stop button, and ChatTurnManager cancelled the running turn when another started. OpenCode, the default since #403, already runs each conversation as its own concurrent session (verified in a live pod through /api/opencode and the LLM gateway), so the loop is retired instead of fixed. Removed: the loop and its endpoints in routers/chat.py (/stream, /stop, /permission, /turn, /turn/events, /feedback, /history, /agents), services/chat_turn.py, the per-turn approval futures in chat_permissions, llm/model_limits.py, the chat history models and DB accessors, the builtin panel/input/stream hook, the engine switch and its broadcast channel, and the chat_engine UI preference. chat-store keeps only the conversation list (persist version 2 drops the old transcripts from localStorage). Kept for OpenCode: /api/chat/scope-block, /api/chat/command-approval, services/chat_tools.py (MCP). The chat_messages table stays and is still pruned at startup; dropping it is a separate decision. Closes #664
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.
Closes #664
Why
User feedback: while one conversation is answering, a new one can't be started. That limit exists only on the builtin engine:
chat-store.isStreamingis a single flag, so a new conversation inherits the running turn's Stop button and the input refuses to send.ChatTurnManagerholds one turn per container and cancels it when another starts.OpenCode, the default since #403, already runs each conversation as its own session, and the sessions run concurrently. Verified in a live pod through
/api/opencodeand the LLM gateway: a second session was created in about 1 s and answered while the first was still busy. So the builtin loop is retired rather than fixed (#367 step 5).What changed
Removed
routers/chat.py: the agent loop and its endpoints (/stream,/stop,/permission,/turn,/turn/events,/feedback,/history,/agents)services/chat_turn.pyservices/chat_permissions.pyllm/model_limits.py(only the loop used it)chat-panel.tsx,chat-input.tsx,chat-engine.tsx,use-chat-stream.ts,chat-engine-channel.tschat_engineUI preferencechat-storenow holds only the conversation list. Its persisted version goes from 1 to 2, which drops old builtin transcripts from localStorage; the conversation list carries over.Kept, because OpenCode uses them:
/api/chat/scope-block,/api/chat/command-approval, andservices/chat_tools.py(the MCP tools).Not dropped: the
chat_messagestable. It stays and is still pruned at startup, because deleting old transcripts should be its own decision. The one-timechat_enginemigration from #403 also stays (harmless).Compatibility: a stored
chat_engine, or an old cached page still sending one on PUT, is ignored; a new test covers it.Docs updated:
CLAUDE.md,SPEC.md,README.md,studio-api/README.md,studio-web/README.md.Testing
pytest -q: 1060 passedtsc --noEmit: cleannpm test: 94 passedNot yet clicked through in a browser. Worth a check on
:develop: New chat while a reply is streaming, conversation switching, Settings → Chat engine, and the JupyterLab-iframed/chat.