[GH-ISSUE #5615] Client: pass chatId on the four id-only endpoints so their lazy tables stay scoped #3109

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

Originally created by @kolacheee on GitHub (Aug 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5615

Originally assigned to: @kolacheee on GitHub.

What happens

#5611 / PR #5614 scoped the server's lazy-table queries, but four endpoints identify their target by id alone, so the server can only scope them when the client sends the owning chat. The server side already accepts an optional chatId on each; the client does not send it yet, so these remain the last cold paths that permanently convert a lazy table to fully resident (defeating MARINARA_MAX_RESIDENT_CHATS) when they run against an evicted chat:

  • DELETE /api/gallery/:id — accepts ?chatId= (query); leases chat_images
  • DELETE /api/game/checkpoint/:id — accepts ?chatId= (query); leases game_checkpoints
  • DELETE /api/professor-mari-workspace/context/:id — accepts ?chatId= (query, same convention its sibling GET /context already requires); leases mari_workspace_context
  • PATCH /api/agents/runs/:runId — accepts chatId in the JSON body; leases agent_runs

The fix

At every client call site for these four requests, the chat is already open (you delete a gallery image from a chat's gallery, delete a checkpoint from a chat's checkpoint list, remove attached workspace context from a workspace chat, and edit an agent run from a chat's Agent Suite panel) — so the client can pass the id it already holds. Pure client change in packages/client/; the server treats a missing value exactly as before, so this can ship independently and roll out safely.

Note: on the server, sending a wrong chatId makes the row not-found (404) rather than acting cross-chat — that's intentional scoping, so the client must pass the chat that owns the resource, not just any open chat.

Follow-up to #5611; part of the #5592 close-out.

Originally created by @kolacheee on GitHub (Aug 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5615 Originally assigned to: @kolacheee on GitHub. **What happens** #5611 / PR #5614 scoped the server's lazy-table queries, but four endpoints identify their target by id alone, so the server can only scope them when the client sends the owning chat. The server side already accepts an **optional `chatId`** on each; the client does not send it yet, so these remain the last cold paths that permanently convert a lazy table to fully resident (defeating `MARINARA_MAX_RESIDENT_CHATS`) when they run against an evicted chat: - `DELETE /api/gallery/:id` — accepts `?chatId=` (query); leases `chat_images` - `DELETE /api/game/checkpoint/:id` — accepts `?chatId=` (query); leases `game_checkpoints` - `DELETE /api/professor-mari-workspace/context/:id` — accepts `?chatId=` (query, same convention its sibling `GET /context` already requires); leases `mari_workspace_context` - `PATCH /api/agents/runs/:runId` — accepts `chatId` in the JSON body; leases `agent_runs` **The fix** At every client call site for these four requests, the chat is already open (you delete a gallery image from a chat's gallery, delete a checkpoint from a chat's checkpoint list, remove attached workspace context from a workspace chat, and edit an agent run from a chat's Agent Suite panel) — so the client can pass the id it already holds. Pure client change in `packages/client/`; the server treats a missing value exactly as before, so this can ship independently and roll out safely. Note: on the server, sending a **wrong** chatId makes the row not-found (404) rather than acting cross-chat — that's intentional scoping, so the client must pass the chat that owns the resource, not just any open chat. Follow-up to #5611; part of the #5592 close-out.
Author
Owner

@kolacheee commented on GitHub (Aug 29, 2026):

Taking this one (kolacheee, agent-assisted) — PR incoming.

<!-- gh-comment-id:5459787484 --> @kolacheee commented on GitHub (Aug 29, 2026): Taking this one (kolacheee, agent-assisted) — PR incoming.
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#3109
No description provided.