[GH-ISSUE #3940] [Feature]: Keep Professor Mari's task result on tab resume + alert when she needs input #2127

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

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

What problem does this solve?

When you give Professor Mari a task and then leave — background the tab, lock the phone, switch to another chat — the browser suspends the tab and the SSE stream socket goes half-open. On return, reader.read() never settles, so the generation looks frozen: the reply she actually finished (the server keeps generating after a passive client disconnect and saves it) does not appear, and no notification fires. Only sending a new command unblocks the zombie stream and pulls the result in.

Separately, when Mari finishes and is blocked waiting on your approval to apply a workspace change, there is nothing to pull you back if you have stepped away — you only find out by returning and looking.

Proposed solution

  • Detect the hidden→visible transition mid-stream and surface a normal disconnect so the existing passive-recovery path runs: it polls /generate/status, refetches the finished reply, and fires the existing "reply ready" notification. No new streaming/reconnect infrastructure.
  • When a new pending approval appears, fire a "Professor Mari needs your approval" notification (reusing the existing notification helpers, which self-suppress while the app is focused). Approvals are DB-backed and already re-fetched on re-entry, so the in-app review card is waiting when you return.

Alternatives considered

  • Service Worker + Web Push for true closed-app alerts — deferred; scoped to "notify on re-entry / while backgrounded," which needs no push infra.
  • Live token replay on reconnect (attach to an in-progress stream) — no such endpoint exists; poll-then-refetch covers "see the result." Add later only if watching her type on return is wanted.
  • A dedicated notification toggle for approvals — reused the existing generation-notification settings to avoid settings plumbing.

Additional context

Server already continues non-impersonate generations after a client disconnect (generate.routes.ts), and /api/generate/status/:chatId reports active generations — so this is a client re-sync + notification gap, not a server one.

Known limitation: if the app is fully closed (or a self-hosted server is stopped with it), generation cannot continue / notify. Covers backgrounded tab, locked phone, and switched chat.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Gunterlie on GitHub (Jul 22, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3940 ## What problem does this solve? When you give Professor Mari a task and then leave — background the tab, lock the phone, switch to another chat — the browser suspends the tab and the SSE stream socket goes half-open. On return, `reader.read()` never settles, so the generation looks frozen: the reply she actually finished (the server keeps generating after a passive client disconnect and saves it) does not appear, and no notification fires. Only sending a *new* command unblocks the zombie stream and pulls the result in. Separately, when Mari finishes and is blocked waiting on your approval to apply a workspace change, there is nothing to pull you back if you have stepped away — you only find out by returning and looking. ## Proposed solution - Detect the hidden→visible transition mid-stream and surface a normal disconnect so the **existing** passive-recovery path runs: it polls `/generate/status`, refetches the finished reply, and fires the existing "reply ready" notification. No new streaming/reconnect infrastructure. - When a new pending approval appears, fire a "Professor Mari needs your approval" notification (reusing the existing notification helpers, which self-suppress while the app is focused). Approvals are DB-backed and already re-fetched on re-entry, so the in-app review card is waiting when you return. ## Alternatives considered - **Service Worker + Web Push** for true closed-app alerts — deferred; scoped to "notify on re-entry / while backgrounded," which needs no push infra. - **Live token replay on reconnect** (attach to an in-progress stream) — no such endpoint exists; poll-then-refetch covers "see the result." Add later only if watching her type on return is wanted. - **A dedicated notification toggle** for approvals — reused the existing generation-notification settings to avoid settings plumbing. ## Additional context Server already continues non-impersonate generations after a client disconnect (`generate.routes.ts`), and `/api/generate/status/:chatId` reports active generations — so this is a client re-sync + notification gap, not a server one. Known limitation: if the app is *fully* closed (or a self-hosted server is stopped with it), generation cannot continue / notify. Covers backgrounded tab, locked phone, and switched chat. ## Template check - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@Gunterlie commented on GitHub (Jul 22, 2026):

Work in progress by @Gunterlie — draft PR #3941 (branch mari-task-persistence, targeting staging).

<!-- gh-comment-id:5046484307 --> @Gunterlie commented on GitHub (Jul 22, 2026): Work in progress by @Gunterlie — draft PR #3941 (branch `mari-task-persistence`, targeting `staging`).
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#2127
No description provided.