mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 07:46:16 -05:00
[GH-ISSUE #23422] issue: Edited messages are not sent to external APIs - conversation context uses stale data #106973
Reference in New Issue
Block a user
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 @eemartinez97 on GitHub (Apr 5, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23422
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
v0.8.12
Ollama Version (if applicable)
No response
Operating System
macOS
Browser (if applicable)
Chrome
Confirmation
README.md.Expected Behavior
When a user edits a message in the chat:
messagesarray sent to external APIsActual Behavior
Steps to Reproduce
Logs & Screenshots
═══════════════════════════════════════════════════════════════════════════════
STEP 1: User Receives Initial Response
═══════════════════════════════════════════════════════════════════════════════
[2024-04-05 14:32:15.123] ✅ Chat initialized with Claude
[2024-04-05 14:32:20.456] 📤 User sends: "Generate a TypeScript class for user management"
[2024-04-05 14:32:23.789] 📥 Claude responds with ToolRepository class code
Response Content:
┌─────────────────────────────────────────────────────────────────────────────┐
│ import type { User } from "@prisma/client"; │
│ import { prisma } from "../lib/prisma.js"; │
│ │
│ export class UserRepository { │
│ async findAll(): Promise<User[]> { │
│ return prisma.user.findMany({ orderBy: { createdAt: "desc" } }); │
│ } │
│ } │
└─────────────────────────────────────────────────────────────────────────────┘
═══════════════════════════════════════════════════════════════════════════════
STEP 2: User Edits the Message
═══════════════════════════════════════════════════════════════════════════════
[2024-04-05 14:33:10.111] 🖊️ User clicks "Edit" on Claude's message
[2024-04-05 14:33:15.222] ✏️ User adds validation methods to the class:
Added Content (by user):
┌─────────────────────────────────────────────────────────────────────────────┐
│ async findById(id: string): Promise<User | null> { │
│ return prisma.user.findUnique({ where: { id } }); │
│ } │
│ │
│ async validate(id: string): Promise { │
│ const user = await this.findById(id); │
│ return user !== null && user.isActive === true; │
│ } │
└─────────────────────────────────────────────────────────────────────────────┘
[2024-04-05 14:33:45.333] 💾 User clicks "Save" (message edit confirmed)
[2024-04-05 14:33:46.444] ✅ Chat UI displays edited message with new methods
═══════════════════════════════════════════════════════════════════════════════
STEP 3: Open WebUI Internal Processing (✅ CORRECT)
═══════════════════════════════════════════════════════════════════════════════
[2024-04-05 14:33:46.550] 📨 Request received by Open WebUI internal endpoint
URL: http://localhost:3000/api/chat/completions
Method: POST
Content-Type: application/json
REQUEST BODY (Internal - WHAT OPEN WEBUI RECEIVES):
┌─────────────���───────────────────────────────────────────────────────────────┐
│ { │
│ "role": "assistant", │
│ "output": [ │
│ { │
│ "type": "message", │
│ "id": "msg_1c6ebe99b88a4021b208740e", │
│ "status": "completed", │
│ "role": "assistant", │
│ "content": [ │
│ { │
│ "type": "output_text", │
│ "text": "import type { User } from "@prisma/client";\n │
│ import { prisma } from "../lib/prisma.js";\n\nexport class │
│ UserRepository {\n async findAll(): Promise<User[]> {\n return │
│ prisma.user.findMany({ orderBy: { createdAt: "desc" } });\n }\n\n │
│ async findById(id: string): Promise<User | null> {\n return │
│ prisma.user.findUnique({ where: { id } });\n }\n\n async validate(id: │
│ string): Promise {\n const user = await │
│ this.findById(id);\n return user !== null && user.isActive === │
│ true;\n }\n}\n" │
│ } │
│ ] │
│ } │
│ ], │
│ "content": "import type { User } from "@prisma/client";\nimport │
│ { prisma } from "../lib/prisma.js";\n\nexport class UserRepository { │
│ \n async findAll(): Promise<User[]> {\n return prisma.user.findMany({ │
│ orderBy: { createdAt: "desc" } });\n }\n\n async findById(id: string): │
│ Promise<User | null> {\n return prisma.user.findUnique({ where: { id │
│ } });\n }\n\n async validate(id: string): Promise {\n const │
│ user = await this.findById(id);\n return user !== null && user.isActive │
│ === true;\n }\n}\n" │
│ } │
└─────────────────────────────────────────────────────────────────────────────┘
[2024-04-05 14:33:46.651] ✅ ANALYSIS: Both "output" and "content" contain EDITED message
[2024-04-05 14:33:46.652] ✅ Message correctly includes the 3 new validation methods
[2024-04-05 14:33:46.653] ✅ Database updated with edited content
═══════════════════════════════════════════════════════════════════════════════
STEP 4: User Sends Follow-up Question
═══════════════════════════════════════════════════════════════════════════════
[2024-04-05 14:34:20.111] 📤 User sends follow-up: "What do you think of the validate method I added?"
[2024-04-05 14:34:20.222] 🔄 Open WebUI prepares to send request to external API
═══════════════════════════════════════════════════════════════════════════════
STEP 5: Open WebUI Sends to External API (❌ WRONG - STALE DATA)
═══════════════════════════════════════════════════════════════════════════════
[2024-04-05 14:34:20.333] 📨 Request sent to external API
URL: http://localhost:8443/v1/messages
Method: POST
Content-Type: application/json
REQUEST BODY (External API - WHAT OPEN WEBUI SENDS):
┌─────────────────────────────────────────────────────────────────────────────┐
│ { │
│ "model": "claude-sonnet-4-20250514", │
│ "max_tokens": 4096, │
│ "messages": [ │
│ { │
│ "role": "user", │
│ "content": "Generate a TypeScript class for user management" │
│ }, │
│ { │
│ "role": "assistant", │
│ "content": "import type { User } from "@prisma/client";\n │
│ import { prisma } from "../lib/prisma.js";\n\nexport class │
│ UserRepository {\n async findAll(): Promise<User[]> {\n return │
│ prisma.user.findMany({ orderBy: { createdAt: "desc" } });\n }\n}\n" │
│ }, │
│ { │
│ "role": "user", │
│ "content": "What do you think of the validate method I added?" │
│ } │
│ ] │
│ } │
└─────────────────────────────────────────────────────────────────────────────┘
[2024-04-05 14:34:20.444] ❌ PROBLEM DETECTED: Message [1] (assistant message) is INCOMPLETE
[2024-04-05 14:34:20.445] ❌ Missing methods:
[2024-04-05 14:34:20.446] ❌ External API receives ORIGINAL response, not EDITED version
═══════════════════════════════════════════════════════════════════════════════
STEP 6: External API Response (Cannot See Edits)
═══════════════════════════════════════════════════════════════════════════════
[2024-04-05 14:34:23.555] 📥 Claude responds:
"I don't see a validate method in your code. Could you share that again?"
[2024-04-05 14:34:23.666] ❌ BUG CONFIRMED: Claude cannot see the edits made by user
[2024-04-05 14:34:23.667] ❌ User clearly added validate() method but API received original code
═══════════════════════════════════════════════════════════════════════════════
COMPARISON: WHAT WAS SENT vs WHAT SHOULD HAVE BEEN SENT
═══════════════════════════════════════════════════════════════════════════════
❌ SENT TO EXTERNAL API (INCORRECT):
┌─────────────────────────────────────────────────────────────────────────────┐
│ export class UserRepository { │
│ async findAll(): Promise<User[]> { │
│ return prisma.user.findMany({ orderBy: { createdAt: "desc" } }); │
│ } │
│ } │
│ [END OF CODE - MISSING 2 METHODS] │
└─────────────────────────────────────────────────────────────────────────────┘
✅ SHOULD HAVE BEEN SENT (CORRECT):
┌─────────────────────────────────────────────────────────────────────────────┐
│ export class UserRepository { │
│ async findAll(): Promise<User[]> { │
│ return prisma.user.findMany({ orderBy: { createdAt: "desc" } }); │
│ } │
│ │
│ async findById(id: string): Promise<User | null> { │
│ return prisma.user.findUnique({ where: { id } }); │
│ } │
│ │
│ async validate(id: string): Promise { │
│ const user = await this.findById(id); │
│ return user !== null && user.isActive === true; │
│ } │
│ } │
└─────────────────────────────────────────────────────────────────────────────┘
═══════════════════════════════════════════════════════════════════════════════
ROOT CAUSE ANALYSIS
═══════════════════════════════════════════════════════════════════════════════
Timeline:
┌─────────────────────────────────────────────────────────────────────────────┐
│ T1 [14:33:46.550] Open WebUI internal endpoint receives EDITED message │
│ ✅ Both "output" and "content" have full edited code │
│ │
│ T2 [14:33:46.651] Database is updated with edited content │
│ ✅ DB has new validate() method and all additions │
│ │
│ T3 [14:34:20.333] External API request is built │
│ ❌ Message history contains ORIGINAL code (missing edits) │
│ │
│ ISSUE: Between T2 and T3, something reverted to stale data! │
└─────────────────────────────────────────────────────────────────────────────┘
Possible causes:
═══════════════════════════════════════════════════════════════════════════════
REPRODUCTION STEPS
═══════════════════════════════════════════════════════════════════════════════
═══════════════════════════════════════════════════════════════════════════════
TESTED WITH
═══════════════════════════════════════════════════════════════════════════════
✅ Anthropic Claude API
✅ OpenAI GPT-4
✅ Google Gemini
✅ All exhibit same bug: stale data sent to external APIs
═══════════════════════════════════════════════════════════════════════════════
IMPACT
═══════════════════════════════════════════════════════════════════════════════
Breaks workflows:
═══════════════════════════════════════════════════════════════════════════════
Additional Information
No response
@Classic298 commented on GitHub (Apr 8, 2026):
https://github.com/open-webui/open-webui/issues/21564