[PR #813] [MERGED] Show unread state for background autonomous messages #4784

Closed
opened 2026-10-22 04:10:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/813
Author: @cha1latte
Created: 5/13/2026
Status: ✅ Merged
Merged: 5/14/2026
Merged by: @cha1latte

Base: main ← Head: issue-699-unread-autonomy


📝 Commits (5)

  • 55ed383 Add autonomous unread state
  • 2c1adfe Merge upstream main into issue 699 unread autonomy
  • b1bfdd2 Address review feedback: harden autonomous unread cleanup
  • 5fbc3ab Merge remote-tracking branch 'upstream/main' into issue-699-unread-autonomy
  • eea5518 Fix combat voice audio element calls

📊 Changes

13 files changed (+320 additions, -5 deletions)

View changed files

➕ docs/pr-evidence/issue-699/unread-after.png (+0 -0)
➕ docs/pr-evidence/issue-699/unread-before.png (+0 -0)
📝 packages/client/src/components/game/GameCombatUI.tsx (+5 -3)
📝 packages/client/src/components/layout/AppShell.tsx (+27 -0)
📝 packages/client/src/components/layout/ChatSidebar.tsx (+29 -0)
📝 packages/client/src/hooks/use-background-autonomous.ts (+10 -0)
📝 packages/client/src/hooks/use-chats.ts (+27 -0)
📝 packages/client/src/stores/chat.store.ts (+47 -0)
📝 packages/server/src/routes/chats.routes.ts (+16 -0)
📝 packages/server/src/services/storage/chats.storage.ts (+58 -2)
➕ packages/server/test/issue-699-autonomous-unread.test.ts (+89 -0)
📝 packages/shared/src/schemas/chat.schema.ts (+6 -0)
📝 packages/shared/src/types/chat.ts (+6 -0)

📄 Description

Linked issue

Closes #699

Why this change

  • Background autonomous messages can arrive while the user is in another chat or after the app reloads. Without durable unread state, users can miss which conversation changed.

What changed

  • Added durable autonomous unread metadata on chats, with mark and clear endpoints.
  • Persist background autonomous messages as unread after generation produces a message.
  • Hydrate sidebar unread badges and floating notification bubbles from chat metadata on app load.
  • Clear persisted autonomous unread state when the user opens the relevant chat.
  • Added server regression coverage for mark, accumulate, de-dupe, and clear behavior.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • pnpm --dir packages/server exec tsx --import ./test/setup-env.ts --test test/issue-699-autonomous-unread.test.ts passed.
  • pnpm check passed.
  • Ran the built local app on http://127.0.0.1:7969, seeded Issue 699 Proof Chat, marked autonomous unread count 3 through the API, verified the sidebar badge displayed, clicked the chat, and verified the badge disappeared and /api/chats/:id no longer had autonomousUnreadCount.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Unread badge visible before opening the chat:

Unread badge before opening chat

Unread badge cleared after opening the chat:

Unread badge cleared after opening chat

Summary by CodeRabbit

  • New Features

    • Unread tracking for autonomous messages with per-chat badges and character info in the sidebar and chat list.
    • API endpoints to mark and clear autonomous unread state so unread badges remain accurate.
  • Bug Fixes

    • Automatic de-duplication and reliable clearing of autonomous unread when viewing a chat.
    • Preserves unrelated metadata when clearing autonomous unread.
  • Tests

    • Server tests validating marking, accumulation, and clearing of autonomous unread.

Review Change Stack


🔄 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/813 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/13/2026 **Status:** ✅ Merged **Merged:** 5/14/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `main` ← **Head:** `issue-699-unread-autonomy` --- ### 📝 Commits (5) - [`55ed383`](https://github.com/Pasta-Devs/Marinara-Engine/commit/55ed3833364dfc72739419d72730ac82f406ca85) Add autonomous unread state - [`2c1adfe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2c1adfeb77b244911870f9b9ee823ae2b629fcc3) Merge upstream main into issue 699 unread autonomy - [`b1bfdd2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b1bfdd2244018628526649ea30b86dfb1a12eb4f) Address review feedback: harden autonomous unread cleanup - [`5fbc3ab`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5fbc3aba11f31915f79a4acddf070d9be3bd5bc8) Merge remote-tracking branch 'upstream/main' into issue-699-unread-autonomy - [`eea5518`](https://github.com/Pasta-Devs/Marinara-Engine/commit/eea55187cd866188d40dc0acbd97599828b95e8a) Fix combat voice audio element calls ### 📊 Changes **13 files changed** (+320 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `docs/pr-evidence/issue-699/unread-after.png` (+0 -0) ➕ `docs/pr-evidence/issue-699/unread-before.png` (+0 -0) 📝 `packages/client/src/components/game/GameCombatUI.tsx` (+5 -3) 📝 `packages/client/src/components/layout/AppShell.tsx` (+27 -0) 📝 `packages/client/src/components/layout/ChatSidebar.tsx` (+29 -0) 📝 `packages/client/src/hooks/use-background-autonomous.ts` (+10 -0) 📝 `packages/client/src/hooks/use-chats.ts` (+27 -0) 📝 `packages/client/src/stores/chat.store.ts` (+47 -0) 📝 `packages/server/src/routes/chats.routes.ts` (+16 -0) 📝 `packages/server/src/services/storage/chats.storage.ts` (+58 -2) ➕ `packages/server/test/issue-699-autonomous-unread.test.ts` (+89 -0) 📝 `packages/shared/src/schemas/chat.schema.ts` (+6 -0) 📝 `packages/shared/src/types/chat.ts` (+6 -0) </details> ### 📄 Description ## Linked issue Closes #699 ## Why this change - Background autonomous messages can arrive while the user is in another chat or after the app reloads. Without durable unread state, users can miss which conversation changed. ## What changed - Added durable autonomous unread metadata on chats, with mark and clear endpoints. - Persist background autonomous messages as unread after generation produces a message. - Hydrate sidebar unread badges and floating notification bubbles from chat metadata on app load. - Clear persisted autonomous unread state when the user opens the relevant chat. - Added server regression coverage for mark, accumulate, de-dupe, and clear behavior. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `pnpm --dir packages/server exec tsx --import ./test/setup-env.ts --test test/issue-699-autonomous-unread.test.ts` passed. - `pnpm check` passed. - Ran the built local app on `http://127.0.0.1:7969`, seeded `Issue 699 Proof Chat`, marked autonomous unread count `3` through the API, verified the sidebar badge displayed, clicked the chat, and verified the badge disappeared and `/api/chats/:id` no longer had `autonomousUnreadCount`. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Unread badge visible before opening the chat: ![Unread badge before opening chat](https://raw.githubusercontent.com/cha1latte/Marinara-Engine/55ed3833364dfc72739419d72730ac82f406ca85/docs/pr-evidence/issue-699/unread-before.png) Unread badge cleared after opening the chat: ![Unread badge cleared after opening chat](https://raw.githubusercontent.com/cha1latte/Marinara-Engine/55ed3833364dfc72739419d72730ac82f406ca85/docs/pr-evidence/issue-699/unread-after.png) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Unread tracking for autonomous messages with per-chat badges and character info in the sidebar and chat list. * API endpoints to mark and clear autonomous unread state so unread badges remain accurate. * **Bug Fixes** * Automatic de-duplication and reliable clearing of autonomous unread when viewing a chat. * Preserves unrelated metadata when clearing autonomous unread. * **Tests** * Server tests validating marking, accumulation, and clearing of autonomous unread. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/813) <!-- review_stack_entry_end --> <!-- 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-22 04:10:38 +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#4784
No description provided.