[GH-ISSUE #3472] [Issue]: New RP chats appear blank with no intro messages after updates #1876

Closed
opened 2026-10-21 05:43:27 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Jul 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3472

Originally assigned to: @SpicyMarinara on GitHub.

Summary

After each new update, new RP chats appear blank with no intro messages for the reporter. The reporter has to ask Professor Mari support AI to redo a fix after every update.

Expected behavior

New RP chats should include their intro messages and should continue working after updates without requiring a repeated support fix.

Actual behavior

New RP chats appear blank with no intro messages, and the user needs Professor Mari to redo a fix after each update.

Steps to reproduce

  1. Apply a new Marinara Engine update.
  2. Open or create a new RP chat.
  3. Observe that the chat appears blank with no intro messages.

Environment

  • Marinara Engine version: Not provided
  • Install type: Not provided
  • OS + version: Not provided
  • Browser or app shell: Not provided

Logs, screenshots, or video

Not provided in the Discord context.

Additional context

Reporter says this may be specific to their setup and that the issue recurs whenever there is a new update.

Discord thread: New rp chats appear blank with no intro messages.
Discord thread link: https://discord.com/channels/1417099416812392641/1525479824565600338
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (1 message)
[2026-07-11T12:32:12.221Z] ꧁༺『-Zuriak-』༻꧂: It may be something only to me specifically- but whenever there is a new update, I need to ask Professor Mari ( the support AI) to redo a fix for me, so I thought its best to make a bug report out of this.
[Discord message: https://discord.com/channels/1417099416812392641/1525479824565600338/1525479824565600338]

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Jul 11, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3472 Originally assigned to: @SpicyMarinara on GitHub. ## Summary After each new update, new RP chats appear blank with no intro messages for the reporter. The reporter has to ask Professor Mari support AI to redo a fix after every update. ## Expected behavior New RP chats should include their intro messages and should continue working after updates without requiring a repeated support fix. ## Actual behavior New RP chats appear blank with no intro messages, and the user needs Professor Mari to redo a fix after each update. ## Steps to reproduce 1. Apply a new Marinara Engine update. 2. Open or create a new RP chat. 3. Observe that the chat appears blank with no intro messages. ## Environment - Marinara Engine version: Not provided - Install type: Not provided - OS + version: Not provided - Browser or app shell: Not provided ## Logs, screenshots, or video Not provided in the Discord context. ## Additional context Reporter says this may be specific to their setup and that the issue recurs whenever there is a new update. Discord thread: New rp chats appear blank with no intro messages. Discord thread link: https://discord.com/channels/1417099416812392641/1525479824565600338 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (1 message)</summary> ```text [2026-07-11T12:32:12.221Z] ꧁༺『-Zuriak-』༻꧂: It may be something only to me specifically- but whenever there is a new update, I need to ask Professor Mari ( the support AI) to redo a fix for me, so I thought its best to make a bug report out of this. [Discord message: https://discord.com/channels/1417099416812392641/1525479824565600338/1525479824565600338] ``` </details> ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:43:27 +07:00
  • closed this issue
  • added the
    in-pr
    bug
    labels
Author
Owner

@SpicyMarinara commented on GitHub (Jul 11, 2026):

Bug Report: New chats are created blank — character greeting (first_mes) is never inserted

App version: 2.1.1 (Windows, packaged install)
Severity: High — affects every newly created chat
Status: Reproduced, root-caused, and fixed locally (patch included below)


Summary

When creating a new chat through the Chat Setup Wizard, the character's greeting (first_mes) is never inserted. The chat opens completely blank, even though the character card's greeting field is fully populated. Users must manually copy-paste the intro from the character info.

Steps to Reproduce

  1. Create (or use) any character with a non-empty first_mes.
  2. Start a new chat with that character via the Chat Setup Wizard.
  3. Observe: the chat is blank. No greeting message appears.

Reproduced consistently with multiple characters (fresh cards and existing ones) and across app restarts.

Root Cause

A race/interaction between two features that don't know about each other:

  1. The setup wizard first creates an empty chat, then PATCHes the chat to add the selected character(s) (PATCH /chats/:id with characterIds).
  2. The server-side chat update handler (packages/server/src/routes/chats.routes.ts, ~line 712) sees characters were added and inserts a system message for each: " has joined the chat." — a feature intended for adding characters to ongoing group chats.
  3. The wizard then calls seedInitialGreetingsIfEmpty (packages/client/src/components/chat/ChatSetupWizard.tsx, ~line 1998), which checks GET /chats/:id/message-count. The count is now 1 (the join notice), so the seeder concludes the chat is not empty and silently skips inserting the greeting.

Result: every new chat contains only a system "has joined" notice (which the UI may not render), and no greeting is ever seeded.

Fix (applied locally, both ends guarded)

Server — suppress the "has joined" system notice during initial chat setup (when the chat previously had zero characters). Join notices still fire when adding characters to a chat that already has some, which is when they're actually meaningful:

--- a/packages/server/src/routes/chats.routes.ts
+++ b/packages/server/src/routes/chats.routes.ts
@@ -712,7 +712,7 @@
-        for (const id of addedIds) {
+        for (const id of previousIds.length > 0 ? addedIds : []) { // skip join notices at setup so greeting seeding isn't blocked
           await storage.createMessage({
             chatId: req.params.id,
             role: "system",

Client — make the greeting seeder ignore system messages when deciding whether the chat is empty, so it's robust even if a system notice slips in:

--- a/packages/client/src/components/chat/ChatSetupWizard.tsx
+++ b/packages/client/src/components/chat/ChatSetupWizard.tsx
@@ -1998,8 +1998,8 @@
   const seedInitialGreetingsIfEmpty = useCallback(async () => {
     if (chatCharIds.length === 0) return;
     try {
-      const { count } = await api.get<{ count: number }>(`/chats/${chat.id}/message-count`);
-      if (count > 0) return;
+      const seedCheckMessages = await api.get<Array<{ role: string }>>(`/chats/${chat.id}/messages`);
+      if (seedCheckMessages.some((m) => m.role !== "system")) return; // ignore system notices when checking emptiness
     } catch {
       return;
     }

(Alternative for the client side, if fetching all messages is undesirable: extend the message-count endpoint to accept a role filter or exclude system messages, and keep the count-based check.)

Verification

After applying both patches and rebuilding (packages/server and packages/client — note that a stale tsconfig.tsbuildinfo can make the server build silently emit nothing; a clean first is required):

  • New chats created via the wizard now receive the character's first_mes immediately.
  • No spurious "has joined" system message is created during initial setup.
  • Adding a character to an existing chat still produces the join notice as before.

Additional Notes

  • The failure is completely silent — no error surfaces to the user or logs; the seeder just returns early.
  • Because packaged installs run compiled dist output and the launcher only rebuilds on version change, source-level hotfixes are wiped by every manual update. An upstream fix would be much appreciated. 🍝
<!-- gh-comment-id:4945900736 --> @SpicyMarinara commented on GitHub (Jul 11, 2026): # Bug Report: New chats are created blank — character greeting (`first_mes`) is never inserted **App version:** 2.1.1 (Windows, packaged install) **Severity:** High — affects every newly created chat **Status:** Reproduced, root-caused, and fixed locally (patch included below) --- ## Summary When creating a new chat through the Chat Setup Wizard, the character's greeting (`first_mes`) is never inserted. The chat opens completely blank, even though the character card's greeting field is fully populated. Users must manually copy-paste the intro from the character info. ## Steps to Reproduce 1. Create (or use) any character with a non-empty `first_mes`. 2. Start a new chat with that character via the Chat Setup Wizard. 3. Observe: the chat is blank. No greeting message appears. Reproduced consistently with multiple characters (fresh cards and existing ones) and across app restarts. ## Root Cause A race/interaction between two features that don't know about each other: 1. The setup wizard first creates an **empty chat**, then PATCHes the chat to add the selected character(s) (`PATCH /chats/:id` with `characterIds`). 2. The server-side chat update handler (`packages/server/src/routes/chats.routes.ts`, ~line 712) sees characters were **added** and inserts a system message for each: *"<Character> has joined the chat."* — a feature intended for adding characters to *ongoing* group chats. 3. The wizard then calls `seedInitialGreetingsIfEmpty` (`packages/client/src/components/chat/ChatSetupWizard.tsx`, ~line 1998), which checks `GET /chats/:id/message-count`. The count is now **1** (the join notice), so the seeder concludes the chat is not empty and **silently skips inserting the greeting**. Result: every new chat contains only a system "has joined" notice (which the UI may not render), and no greeting is ever seeded. ## Fix (applied locally, both ends guarded) **Server** — suppress the "has joined" system notice during *initial* chat setup (when the chat previously had zero characters). Join notices still fire when adding characters to a chat that already has some, which is when they're actually meaningful: ```diff --- a/packages/server/src/routes/chats.routes.ts +++ b/packages/server/src/routes/chats.routes.ts @@ -712,7 +712,7 @@ - for (const id of addedIds) { + for (const id of previousIds.length > 0 ? addedIds : []) { // skip join notices at setup so greeting seeding isn't blocked await storage.createMessage({ chatId: req.params.id, role: "system", ``` **Client** — make the greeting seeder ignore system messages when deciding whether the chat is empty, so it's robust even if a system notice slips in: ```diff --- a/packages/client/src/components/chat/ChatSetupWizard.tsx +++ b/packages/client/src/components/chat/ChatSetupWizard.tsx @@ -1998,8 +1998,8 @@ const seedInitialGreetingsIfEmpty = useCallback(async () => { if (chatCharIds.length === 0) return; try { - const { count } = await api.get<{ count: number }>(`/chats/${chat.id}/message-count`); - if (count > 0) return; + const seedCheckMessages = await api.get<Array<{ role: string }>>(`/chats/${chat.id}/messages`); + if (seedCheckMessages.some((m) => m.role !== "system")) return; // ignore system notices when checking emptiness } catch { return; } ``` (Alternative for the client side, if fetching all messages is undesirable: extend the `message-count` endpoint to accept a `role` filter or exclude system messages, and keep the count-based check.) ## Verification After applying both patches and rebuilding (`packages/server` and `packages/client` — note that a stale `tsconfig.tsbuildinfo` can make the server build silently emit nothing; a `clean` first is required): - New chats created via the wizard now receive the character's `first_mes` immediately. - No spurious "has joined" system message is created during initial setup. - Adding a character to an *existing* chat still produces the join notice as before. ## Additional Notes - The failure is completely silent — no error surfaces to the user or logs; the seeder just returns early. - Because packaged installs run compiled `dist` output and the launcher only rebuilds on version change, source-level hotfixes are wiped by every manual update. An upstream fix would be much appreciated. 🍝
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1876
No description provided.