[PR #2827] [MERGED] fix(conversation): sync chat-list + in-chat status dots with live presence #5755

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2827
Author: @Romuromylus
Created: 6/23/2026
Status: ✅ Merged
Merged: 6/23/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/convo-status-dot-sync


📝 Commits (4)

  • 1bd654f fix(conversation): sync chat-list + in-chat status dots with live presence
  • 8a347ea fix(conversation): tick presence dots on a clock so time-only transitions refresh
  • ee848b4 fix(conversation): require explicit schedule opt-in for live presence; share the resolver
  • bd7caa0 fix(conversation): mirror the server schedule gate (conversationSchedulesEnabled !== false)

📊 Changes

7 files changed (+305 additions, -126 deletions)

View changed files

📝 packages/client/src/components/chat/ChatArea.tsx (+32 -9)
📝 packages/client/src/components/layout/ChatSidebar.tsx (+14 -7)
➕ packages/client/src/hooks/use-presence-clock.ts (+52 -0)
➕ packages/client/src/lib/conversation-presence-status.ts (+51 -0)
📝 packages/server/src/services/conversation/schedule.service.ts (+23 -110)
📝 packages/shared/src/index.ts (+1 -0)
➕ packages/shared/src/utils/conversation-presence.ts (+132 -0)

📄 Description

Linked issue

Closes #2826

Why this change

In Conversation mode, a character's presence status dot in the chat-list sidebar (and the in-chat avatar overlay) did not match the status shown in the toolbar presence pill. After a status change — a manual override set in the pill, or a generated schedule crossing into a new time block — the pill updated immediately while the chat-list dot kept showing the old status until the next generated message.

Root cause: the sidebar and the in-chat overlay color the dot from the per-chat conversationCharacterStatuses snapshot, which is only rewritten by the generation pipeline (generate.routes.ts). The presence pill instead reads the live status from GET /conversation/status/:chatId, which derives it as active override > current schedule block > default. So between generations the two surfaces diverge.

What changed

  • Extracted the status-derivation helpers (getCurrentStatus, getActiveStatusOverride, getEffectiveCurrentStatus) and their schedule types (ScheduleBlock, WeekSchedule, CharacterSchedules, CurrentConversationStatus) from packages/server/.../schedule.service.ts into @marinara-engine/shared (utils/conversation-presence.ts) so the client can derive presence the same way the server does. This is the single source of truth for "what status is this character right now".
  • schedule.service.ts now imports and re-exports those helpers/types, so every existing server call site (conversation.routes.ts, generate.routes.ts, the autonomous scheduler, etc.) is unchanged — this is a behavior-preserving move on the server side.
  • ChatSidebar.tsx (chat-list dots) and ChatArea.tsx (in-chat avatar overlay) now prefer the live override > schedule status over the generation-time snapshot, falling back to the snapshot when there is no active override or schedule. Schedules are gated by conversationSchedulesEnabled, matching the server.
  • No change to the server's status computation, the generation snapshot write, or the persisted metadata shape.

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 check (clean + impeccable + lint + build) passes locally; the extracted helpers also have local unit coverage for the precedence (override beats schedule), override expiry, and midnight-wrapping schedule blocks.
  • Reproduced and verified on a build deployed to my private EasyPanel instance, in Conversation mode:
    • With a generation-time snapshot of online and a manual offline + "sleeping" override active: before this change the presence pill showed gray/"sleeping" while the chat-list dot stayed green; after, the chat-list dot is gray, matching the pill.
    • Clearing the override reverts both the pill and the chat-list dot to the snapshot/default (green/Online) — confirming the active-override gate falls through correctly and does not strand a stale value.
  • Still worth a maintainer double-check: a character with a generated schedule crossing a time block (covered by unit tests but I didn't drive a live schedule transition), and a multi-character conversation chat's combined dot.

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)

Conversation-mode chat list, single character with an active offline + "sleeping" override (snapshot = online):

  • Before: presence pill = gray dot + "sleeping"; chat-list sidebar dot = green (stale).
  • After: presence pill = gray dot + "sleeping"; chat-list sidebar dot = gray (matches).

🔄 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/2827 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 6/23/2026 **Status:** ✅ Merged **Merged:** 6/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/convo-status-dot-sync` --- ### 📝 Commits (4) - [`1bd654f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1bd654f49d5aca93299d74dc8c74f29769bad208) fix(conversation): sync chat-list + in-chat status dots with live presence - [`8a347ea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8a347ea06f1983f4272c57484e817b0412820cb7) fix(conversation): tick presence dots on a clock so time-only transitions refresh - [`ee848b4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ee848b4a1069ab2046eb4ba906d8fde8a94fb388) fix(conversation): require explicit schedule opt-in for live presence; share the resolver - [`bd7caa0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bd7caa02c107f2c3aabca3f9f5fb84d94d99e065) fix(conversation): mirror the server schedule gate (conversationSchedulesEnabled !== false) ### 📊 Changes **7 files changed** (+305 additions, -126 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatArea.tsx` (+32 -9) 📝 `packages/client/src/components/layout/ChatSidebar.tsx` (+14 -7) ➕ `packages/client/src/hooks/use-presence-clock.ts` (+52 -0) ➕ `packages/client/src/lib/conversation-presence-status.ts` (+51 -0) 📝 `packages/server/src/services/conversation/schedule.service.ts` (+23 -110) 📝 `packages/shared/src/index.ts` (+1 -0) ➕ `packages/shared/src/utils/conversation-presence.ts` (+132 -0) </details> ### 📄 Description ## Linked issue Closes #2826 ## Why this change In Conversation mode, a character's presence status dot in the chat-list sidebar (and the in-chat avatar overlay) did not match the status shown in the toolbar presence pill. After a status change — a manual override set in the pill, or a generated schedule crossing into a new time block — the pill updated immediately while the chat-list dot kept showing the old status until the next generated message. Root cause: the sidebar and the in-chat overlay color the dot from the per-chat `conversationCharacterStatuses` snapshot, which is only rewritten by the generation pipeline (`generate.routes.ts`). The presence pill instead reads the live status from `GET /conversation/status/:chatId`, which derives it as `active override > current schedule block > default`. So between generations the two surfaces diverge. ## What changed - Extracted the status-derivation helpers (`getCurrentStatus`, `getActiveStatusOverride`, `getEffectiveCurrentStatus`) and their schedule types (`ScheduleBlock`, `WeekSchedule`, `CharacterSchedules`, `CurrentConversationStatus`) from `packages/server/.../schedule.service.ts` into `@marinara-engine/shared` (`utils/conversation-presence.ts`) so the client can derive presence the same way the server does. This is the single source of truth for "what status is this character right now". - `schedule.service.ts` now imports and **re-exports** those helpers/types, so every existing server call site (`conversation.routes.ts`, `generate.routes.ts`, the autonomous scheduler, etc.) is unchanged — this is a behavior-preserving move on the server side. - `ChatSidebar.tsx` (chat-list dots) and `ChatArea.tsx` (in-chat avatar overlay) now prefer the live `override > schedule` status over the generation-time snapshot, falling back to the snapshot when there is no active override or schedule. Schedules are gated by `conversationSchedulesEnabled`, matching the server. - No change to the server's status computation, the generation snapshot write, or the persisted metadata shape. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `pnpm check` (clean + impeccable + lint + build) passes locally; the extracted helpers also have local unit coverage for the precedence (override beats schedule), override expiry, and midnight-wrapping schedule blocks. - Reproduced and verified on a build deployed to my private EasyPanel instance, in Conversation mode: - With a generation-time snapshot of `online` and a manual `offline` + "sleeping" override active: **before** this change the presence pill showed gray/"sleeping" while the chat-list dot stayed green; **after**, the chat-list dot is gray, matching the pill. - Clearing the override reverts both the pill and the chat-list dot to the snapshot/default (green/Online) — confirming the active-override gate falls through correctly and does not strand a stale value. - Still worth a maintainer double-check: a character with a **generated schedule** crossing a time block (covered by unit tests but I didn't drive a live schedule transition), and a **multi-character** conversation chat's combined dot. ## 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) Conversation-mode chat list, single character with an active `offline` + "sleeping" override (snapshot = `online`): - Before: presence pill = gray dot + "sleeping"; chat-list sidebar dot = green (stale). - After: presence pill = gray dot + "sleeping"; chat-list sidebar dot = gray (matches). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:19:13 +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#5755
No description provided.