[PR #7417] [MERGED] fix(conversation): let characters remember and see the selfies they send #7724

Closed
opened 2026-10-24 04:06:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7417
Author: @Gunterlie
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @Gunterlie

Base: staging ← Head: say-cheese-no-picture-shown


📝 Commits (7)

  • df025c7 fix(conversation): let characters remember the selfie they sent
  • 5b9fb20 fix(conversation): name the sender of each selfie in prompt history
  • 0e8bc68 fix(conversation): caption sent selfies once with the chat's captioning model
  • b689174 refactor(generate): drop the duplicate dynamic gallery storage import
  • 2bad22b fix(conversation): caption only the newest selfie messages per turn
  • 05741ad fix(conversation): send selfie captions only known image types; qualify changelog
  • c69bf18 Merge remote-tracking branch 'origin/staging' into say-cheese-no-picture-shown

📊 Changes

8 files changed (+249 additions, -7 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/routes/generate.routes.ts (+54 -7)
📝 packages/server/src/routes/generate/conversation-prompt-formatting.ts (+23 -0)
📝 packages/server/src/services/generation/conversation-selfie-command-runtime.ts (+2 -0)
📝 packages/server/src/services/generation/image-captioning-runtime.ts (+50 -0)
📝 packages/server/src/services/generation/prompt-attachments.ts (+10 -0)
📝 packages/shared/src/types/chat.ts (+2 -0)
📝 scripts/regressions/prompt.regression.ts (+107 -0)

📄 Description

Why

A user reported that in Conversation mode, when a character sends a selfie, the character doesn't know it on the next turn — reacting to the photo usually gets "Lol what photo?". Their captioning model (llama.cpp) captioned uploaded images fine but was never called for selfies.

Root cause: since 4c4091dc4 (2026-04-02) every generated image attachment (type: "image") is hidden from prompt history so Illustrator scene images don't make the character think it sent them. Selfies use the same type, so they were hidden too. Captioning only handles inline image/* uploads, and the selfie's saved image prompt was never read back. The model only saw its own raw [selfie] tag, which carries no description (and vanishes after an edit).

No linked issue — this came in as a direct user report.

What changed

  • History note for sent selfies. Assistant messages with a selfie get [<Name> sent a selfie: <description>] in prompt history (formatSentSelfieNotes). Illustrator images stay hidden. Selfies are recognised by their selfie_* filename, which only the selfie runtime writes, so existing chats work.
  • Sender name. New selfie attachments store characterName, because one merged group reply can hold several speakers. Older selfies get an unattributed note.
  • Captioning follows the existing setting. When image captioning resolves to on (connection default or chat override), the selfie file is read from the chat gallery and captioned once by the captioning connection. The caption is cached on the attachment with the same fields and invalidation rules as uploads. A missing file or failed caption never stops the turn — the note falls back to the first paragraph of the image prompt.
  • Bounded cost. Only selfies in the two newest selfie-carrying messages are captioned per turn (ponytail: comment), so a long chat or a changed caption model can't queue a caption call per old selfie before the reply.
  • Removed a now-duplicate dynamic gallery.storage import.

Validation

  • pnpm check — pass (one pre-existing client react-hooks/exhaustive-deps warning, untouched code)
  • pnpm regression:prompt — pass, incl. new cases: selfie note vs Illustrator image, caption wins over prompt, group sender names, caption made once + cache hit, failed caption doesn't throw, captioning off skips the read
  • Server tsc --noEmit — pass
  • Local CodeRabbit: run twice; findings fixed (group sender attribution, unbounded historical captioning). One suggestion to add per-mode regressions was not taken: the helper is mode-independent and runs in the single shared history mapper; selfies only exist in Conversation. The third local run hit the CodeRabbit rate limit, so the last commit (caption bound) was not locally reviewed — the GitHub review covers it.

Manual verification

  • In a Conversation chat with a selfie connection, ask for a selfie, then react to it ("nice outfit!") — manually verify the character answers about the photo.
  • With image captioning on, manually verify the captioning model is called once for the new selfie (llama.cpp console / debug log) and not again on the next turn.
  • With captioning off, manually verify the prompt (debug mode) shows [<Name> sent a selfie: …] built from the image prompt.
  • In a group Conversation chat, manually verify the note names the character who sent the selfie.
  • Manually verify Illustrator images still do not appear in the character's history.

Summary by CodeRabbit

  • New Features
    • Conversation characters now retain brief notes about selfies they have sent. When image captioning is enabled, selfies in the two newest messages containing one are captioned once, and the captions are saved for later conversation history.
    • Notes use a saved caption when available, or the image prompt otherwise. In group chats, notes identify who sent the selfie.
    • Illustrator images remain hidden from the character.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7417 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `say-cheese-no-picture-shown` --- ### 📝 Commits (7) - [`df025c7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/df025c7b49e50174089f7259105b219ff8f8399f) fix(conversation): let characters remember the selfie they sent - [`5b9fb20`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5b9fb2012a802a8e5ebb28d7865a7f7391a6dfde) fix(conversation): name the sender of each selfie in prompt history - [`0e8bc68`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0e8bc68fc1471514780833eb70a695de3518fa2e) fix(conversation): caption sent selfies once with the chat's captioning model - [`b689174`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b689174141efac5f27c8c7be32bf0ce8b638fcdb) refactor(generate): drop the duplicate dynamic gallery storage import - [`2bad22b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2bad22b1be82739e0f5696699e6555637107d765) fix(conversation): caption only the newest selfie messages per turn - [`05741ad`](https://github.com/Pasta-Devs/Marinara-Engine/commit/05741ad63984c0e27cd8596eb40c6b67a5835e45) fix(conversation): send selfie captions only known image types; qualify changelog - [`c69bf18`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c69bf187c1693fbf01fef61facb5a0da528b5e3d) Merge remote-tracking branch 'origin/staging' into say-cheese-no-picture-shown ### 📊 Changes **8 files changed** (+249 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+54 -7) 📝 `packages/server/src/routes/generate/conversation-prompt-formatting.ts` (+23 -0) 📝 `packages/server/src/services/generation/conversation-selfie-command-runtime.ts` (+2 -0) 📝 `packages/server/src/services/generation/image-captioning-runtime.ts` (+50 -0) 📝 `packages/server/src/services/generation/prompt-attachments.ts` (+10 -0) 📝 `packages/shared/src/types/chat.ts` (+2 -0) 📝 `scripts/regressions/prompt.regression.ts` (+107 -0) </details> ### 📄 Description ## Why A user reported that in Conversation mode, when a character sends a selfie, the character doesn't know it on the next turn — reacting to the photo usually gets "Lol what photo?". Their captioning model (llama.cpp) captioned uploaded images fine but was never called for selfies. Root cause: since `4c4091dc4` (2026-04-02) every generated image attachment (`type: "image"`) is hidden from prompt history so Illustrator scene images don't make the character think it sent them. Selfies use the same type, so they were hidden too. Captioning only handles inline `image/*` uploads, and the selfie's saved image prompt was never read back. The model only saw its own raw `[selfie]` tag, which carries no description (and vanishes after an edit). No linked issue — this came in as a direct user report. ## What changed - **History note for sent selfies.** Assistant messages with a selfie get `[<Name> sent a selfie: <description>]` in prompt history (`formatSentSelfieNotes`). Illustrator images stay hidden. Selfies are recognised by their `selfie_*` filename, which only the selfie runtime writes, so existing chats work. - **Sender name.** New selfie attachments store `characterName`, because one merged group reply can hold several speakers. Older selfies get an unattributed note. - **Captioning follows the existing setting.** When image captioning resolves to on (connection default or chat override), the selfie file is read from the chat gallery and captioned once by the captioning connection. The caption is cached on the attachment with the same fields and invalidation rules as uploads. A missing file or failed caption never stops the turn — the note falls back to the first paragraph of the image prompt. - **Bounded cost.** Only selfies in the two newest selfie-carrying messages are captioned per turn (`ponytail:` comment), so a long chat or a changed caption model can't queue a caption call per old selfie before the reply. - Removed a now-duplicate dynamic `gallery.storage` import. ## Validation - `pnpm check` — pass (one pre-existing client `react-hooks/exhaustive-deps` warning, untouched code) - `pnpm regression:prompt` — pass, incl. new cases: selfie note vs Illustrator image, caption wins over prompt, group sender names, caption made once + cache hit, failed caption doesn't throw, captioning off skips the read - Server `tsc --noEmit` — pass - Local CodeRabbit: run twice; findings fixed (group sender attribution, unbounded historical captioning). One suggestion to add per-mode regressions was not taken: the helper is mode-independent and runs in the single shared history mapper; selfies only exist in Conversation. The third local run hit the CodeRabbit rate limit, so the last commit (caption bound) was not locally reviewed — the GitHub review covers it. ## Manual verification - [ ] In a Conversation chat with a selfie connection, ask for a selfie, then react to it ("nice outfit!") — manually verify the character answers about the photo. - [ ] With image captioning on, manually verify the captioning model is called once for the new selfie (llama.cpp console / debug log) and not again on the next turn. - [ ] With captioning off, manually verify the prompt (debug mode) shows `[<Name> sent a selfie: …]` built from the image prompt. - [ ] In a group Conversation chat, manually verify the note names the character who sent the selfie. - [ ] Manually verify Illustrator images still do not appear in the character's history. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Conversation characters now retain brief notes about selfies they have sent. When image captioning is enabled, selfies in the two newest messages containing one are captioned once, and the captions are saved for later conversation history. * Notes use a saved caption when available, or the image prompt otherwise. In group chats, notes identify who sent the selfie. * Illustrator images remain hidden from the character. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:54 +07:00
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#7724
No description provided.