Skip to content

feat(chat): remove the builtin chat engine, OpenCode only - #666

Merged
kthare10 merged 1 commit into
developfrom
feat/remove-builtin-chat-engine
Nov 10, 2026
Merged

kthare10 merged 1 commit into
developfrom
feat/remove-builtin-chat-engine

Conversation

@kthare10

Copy link
Copy Markdown
Contributor

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.isStreaming is a single flag, so a new conversation inherits the running turn's Stop button and the input refuses to send.
  • ChatTurnManager holds 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/opencode and 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.py
  • The per-turn approval code in services/chat_permissions.py
  • llm/model_limits.py (only the loop used it)
  • The chat history models and DB accessors
  • Frontend: chat-panel.tsx, chat-input.tsx, chat-engine.tsx, use-chat-stream.ts, chat-engine-channel.ts
  • The engine selector in Settings. The engine status and Restart button stay.
  • The chat_engine UI preference
  • Builtin-only tests

chat-store now 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, and services/chat_tools.py (the MCP tools).

Not dropped: the chat_messages table. It stays and is still pruned at startup, because deleting old transcripts should be its own decision. The one-time chat_engine migration 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 passed
  • tsc --noEmit: clean
  • npm test: 94 passed

Not 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.

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
@kthare10
kthare10 merged commit b4602b7 into develop Nov 10, 2026
2 checks passed
@kthare10
kthare10 deleted the feat/remove-builtin-chat-engine branch November 10, 2026 23:20
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.

1 participant