mirror of
https://github.com/open-webui/computer.git
synced 2026-11-05 01:17:24 +00:00
[GH-ISSUE #199] bug: native-agent sessions start with no prior chat history when a chat is switched to a workspace model #118
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/computer#118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @penradioGables on GitHub (Jul 28, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/199
Summary
Hold a conversation in a chat using a stateless API model, then switch that same chat to a Claude Code / Codex workspace model. The agent starts with no knowledge of anything discussed earlier, and nothing indicates this to the user.
This is a follow-up to #152 (closed). Moving native-session adapters onto the backend's own session continuity — rather than replaying a flattened transcript every turn — was the right call and fixed the runaway behaviour there. This issue is the gap that remains on the first turn, before any session exists to continue.
Verified still present in v0.9.15 — both
cptr/utils/agents/prompts.pyandcptr/routers/gateway.pyare byte-identical between thev0.9.10andv0.9.15tags.Root cause — two layers, both needed for a complete fix
Layer 1 — the adapter. Native-session adapters intentionally send only the current turn (
prompts.py::latest_user_text, L17–23), relying on the agent's own resumable session for continuity:That is correct once a session exists. But on the first turn after a switch there is no
session_idinchat.meta["agent_sessions"]yet, so the agent starts cold and never sees anything earlier in the chat.Layer 2 — the gateway. Open WebUI does send the full conversation as
body.messageson every request, butgateway.py::_resolve_messagesextracts only the latest user turn from it and otherwise reconstructs history from cptr's own persistedChatMessagerows. For a chat whose earlier turns were answered through a different OWUI connection, cptr has no rows at all — so fixing Layer 1 alone leaves it with nothing to render. The data has to be captured here, at the moment OWUI hands it over, or it is gone.Suggested fix
current_message_id) andmessagescontains prior turns, persist them as plainChatMessagerows before creating the new user/assistant pair.session_idto resume, seed that first prompt with a rendered transcript of the prior turns (capped, oldest-truncated) instead of only the latest message.Worth being deliberate about the seeding format given #152 — the failure there was an in-band
[role]transcript with no turn-boundary stop, replayed every turn. Seeding only on the first turn of a session, and only when there is no session to resume, avoids that: it is a one-time cold-start payload rather than a per-turn replay.Happy to open a PR if the two-layer split above matches how you'd want it structured.
@tjbck commented on GitHub (Jul 31, 2026):
Should be addressed!