[PR #7886] [MERGED] fix(packages): game boards render once, clear install errors, schedule updates from calls #7984

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7886
Author: @SpicyMarinara
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/dedup-review-engine


📝 Commits (1)

  • 864b11c fix(packages): game boards render once, clear install errors, schedule updates from calls

📊 Changes

10 files changed (+424 additions, -26 deletions)

View changed files

📝 docs/development/optional-agent-packages.md (+10 -0)
📝 packages/client/src/components/chat/ConversationView.tsx (+8 -20)
📝 packages/client/src/hooks/use-capability-packages.ts (+39 -0)
📝 packages/server/src/routes/capability-packages.routes.ts (+7 -1)
📝 packages/server/src/services/capability-packages/capability-persistence.service.ts (+63 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+11 -3)
📝 packages/shared/src/types/capability-runtime.ts (+30 -1)
➕ scripts/regressions/capability-package-install-refusal.regression.ts (+104 -0)
📝 scripts/regressions/capability-runtime-host-services.regression.ts (+87 -1)
➕ scripts/regressions/conversation-turn-game-surface.regression.ts (+65 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Refs Pasta-Devs/Marinara-Agents#1496. Its "Additional context" lists these three Engine-side findings from the host de-duplication review (Pasta-Devs/Marinara-Agents#1494, Pasta-Devs/Marinara-Engine#7858). There is no separate Engine issue for them. The package fixes in that issue stay with Marinara-Agents.

@SpicyMarinara

Why this change

The review of the host de-duplication found three problems in the Engine. The packages cannot fix any of them:

  • Game boards render twice in Conversation. When a game's agent is on in a Conversation chat, you see two boards. On a phone, the extra board takes up the whole screen. Every turn game lists the conversation-surface slot in its manifest. ConversationView mounts every turn game's board itself, and then the slot mounts it again. The Engine has done this since ae92414ad (2026-08-04), so v2.5.0 has it too. The fix belongs in the Engine. Removing the slot from the game manifests would not help: games people already installed, and older Engines, would still show two boards.
  • "Internal Server Error" when an agent needs a newer Engine. Download Agents offers an Install or Update button for a package version that this Engine refuses. Clicking it shows only "Internal Server Error". The reason, "Package requires capability API 1.341; this Engine supports …", appears only in the server log. Pending updates already skip these versions using the same check. The install route has to say why it refuses, for this Engine and every later one (v2.5.0 itself cannot be fixed).
  • A call's [schedule_update] does not last. The character card now owns presence. The chat's characterSchedules map is only a cache, and the next presence read replaces it. Calls can only patch that map, so the next GET /api/chats/:id wipes the change. The same command in a normal Conversation reply puts a status on the card. Calls needs a host member that reaches the card.

Decisions:

  • New member: api.runtime.persistence.updateCharacterStatus(chatId, characterId, update). Its name and shape match the other contract §2.2 persistence writers (patchChatMetadata, appendMessages, createChatNote). It does not copy the host's code. It hands the command to handleConversationScheduleCommand, the same function the generate route uses. That keeps the manual-status precedence, the 60-minute default and one-week limit on duration, and the cache refresh.
  • Checks: it requires chat-write, like every other persistence writer. It checks the input first. The chat must exist and be a Conversation chat. The character must be in that chat, which is the same check the reply path makes, since a command only reaches a character of its own chat. In a shared room it changes nothing and returns null, because rooms keep their own routines and never write the card.
  • No capability API minor bump. It stays at 1.341, and packages feature-detect the member. Under the contract, a package must declare a minor only when it requires a feature, so an older Engine refuses the install cleanly. Calls does not require this member: when it is missing, Calls skips the status change. The 1.31 speech member set the precedent of an optional member with no new minor. 1.341 has not shipped in any release yet: v2.5.0 reports 1.66. v2.5.1 will be the first release to report 1.341, and it will include this member. Only pre-release staging builds report 1.341 without it, which is why packages feature-detect it.

What changed

  • With a game's agent on in a Conversation chat, its board now shows once instead of twice. Installing or updating an agent that needs a newer Marinara Engine now says which Engine or capability API version it needs, instead of "Internal Server Error".
  • ConversationView takes its turn games and conversation-surface packages from new selectors in hooks/use-capability-packages.ts. The slot leaves out turn games, because their boards are already mounted. Calls and other surface packages are unchanged. The Roleplay surface is unchanged, because it mounts games only through the slot.
  • installCatalogPackage throws CapabilityPackageCompatibilityError for the three checks it runs before downloading: install issue, capability API and Engine range. POST /api/capability-packages/:id/install answers 409 { error: <message> } for it, the same way it already answers a version mismatch. Other failures still go to the error handler.
  • New optional CapabilityPersistenceHost.updateCharacterStatus with shared types CapabilityCharacterStatusUpdate and CapabilityCharacterStatusResult, implemented in capability-persistence.service.ts. It is documented in docs/development/optional-agent-packages.md, under "Capability API 1.341", next to the other persistence members.
  • Regressions: conversation-turn-game-surface (new), capability-package-install-refusal (new) and an updateCharacterStatus block in capability-runtime-host-services.

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

Agent-run checks (for reference, not a substitute for the boxes above):

  • pnpm check passed. Its only output was an existing lint warning in a file this PR does not touch.
  • New or changed regressions passed: conversation-turn-game-surface, capability-package-install-refusal and capability-runtime-host-services.
  • Related regressions passed: capability-package-lifecycle, capability-package-cache, capability-package-disk-cleanup, capability-persistence-permissions, capability-package-chat-controls, capability-gm-verbs, capability-preview-overlay, capability-release-notes, agent-registry-hydration, agents-see-whispers, character-schedule-ownership, conversation-game-slash, game-tool-controls, game-ruleset-packages, marinara-host-namespace, chat-window-icons, open-issues and robustness-runtime-diagnostics.
  • Negative control: I removed the new instanceof from the install route, and the refusal regression failed with 500 !== 409. The turn-game regression counts each surface mount. With the old slot filter, UNO would be mounted twice.

Claim boundary (risky work: install/update flow, writes to character data):

  • Core claim: each turn game's board mounts once in a Conversation chat. A refused install answers 409 with the reason. A package can apply [schedule_update] to the character card through the host.
  • Entrypoints: ConversationView surface mounts; POST /api/capability-packages/:id/install; api.runtime.persistence.updateCharacterStatus.
  • Current paths tested:
    • A capability API one minor above this Engine's, and an Engine range above this Engine, both answer 409 before any download (fetch is stubbed to fail).
    • A failure that is not a refusal still answers 500 through the error handler.
    • Status, activity and duration land on the card, and the next presence read keeps them.
    • An update with only an activity keeps the current status.
    • An unreadable duration falls back to 60 minutes.
  • Legacy paths: installed schemaVersion: 1 games still declare the slot and are still left out of it, because the filter uses kind, not the manifest version.
  • Negative rows:
    • A manual status (no end time) is kept, and the call returns null.
    • Rejected: an invalid status, an activity that is not text, an activity over 500 characters, an empty update, a null update, a character outside the chat, a Roleplay chat, a missing chat, and a package without chat-write. None of these changes the card.
    • A shared room returns null and leaves the card alone.
  • Ground truth: the verifier findings for Pasta-Devs/Marinara-Agents#1494: two marinara-capability-eightball[view=surface] elements under the same parent, HTTP 500 for 8 refused installs, and a call's schedule_update wiped by the next presence read.
  • Manual blockers: I did not run a browser on this Mac, and I did not install the real packages from the catalog. Calls does not use the new member until the Agents follow-up ships, so its end-to-end effect is not tested here.

Manual verification notes

  • Manually verify in a browser: in a Conversation chat with Chess, UNO, Poker, 8-Ball, Tic-Tac-Toe or Rock Paper Scissors installed, turn the game's agent on (Chat Settings → Agents) and start a game. Exactly one board should show. Check the desktop and phone layouts.
  • Manually verify in a browser that the same game still shows one board with its agent off, and that Calls still shows its call screen in that chat.
  • Manually verify: with a catalog entry that needs a newer capability API (for example, MARINARA_AGENT_CATALOG_URL pointing at a copy where one package declares capabilityApi.minor 342), click Install or Update in Download Agents. The toast should read "Package requires capability API 1.342; this Engine supports 1.341", not "Internal Server Error".
  • Manually verify, once a Calls build that calls updateCharacterStatus is installed: in a call, have the character change its status (for example, to Do Not Disturb). The presence card should show the new status, keep it after a page reload, and keep it in the character's other Conversation chats until it ends.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Docs for translation:

  • docs/development/optional-agent-packages.md: one new bullet under "Capability API 1.341: host runtime services and shared server libraries" (runtime.persistence.updateCharacterStatus).

No capability API bump, no version bump, no CHANGELOG.md edit.

UI evidence (if applicable)

None captured: no browser was run for this PR. The board fix only changes which components mount, so the verifier screenshots of two boards (listed in Pasta-Devs/Marinara-Agents#1496) show the before state.


🔄 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/7886 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/20/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/dedup-review-engine` --- ### 📝 Commits (1) - [`864b11c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/864b11cdabcf716bfafff8a564c28846fd94a110) fix(packages): game boards render once, clear install errors, schedule updates from calls ### 📊 Changes **10 files changed** (+424 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `docs/development/optional-agent-packages.md` (+10 -0) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+8 -20) 📝 `packages/client/src/hooks/use-capability-packages.ts` (+39 -0) 📝 `packages/server/src/routes/capability-packages.routes.ts` (+7 -1) 📝 `packages/server/src/services/capability-packages/capability-persistence.service.ts` (+63 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+11 -3) 📝 `packages/shared/src/types/capability-runtime.ts` (+30 -1) ➕ `scripts/regressions/capability-package-install-refusal.regression.ts` (+104 -0) 📝 `scripts/regressions/capability-runtime-host-services.regression.ts` (+87 -1) ➕ `scripts/regressions/conversation-turn-game-surface.regression.ts` (+65 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Refs Pasta-Devs/Marinara-Agents#1496. Its "Additional context" lists these three Engine-side findings from the host de-duplication review (Pasta-Devs/Marinara-Agents#1494, Pasta-Devs/Marinara-Engine#7858). There is no separate Engine issue for them. The package fixes in that issue stay with Marinara-Agents. @SpicyMarinara ## Why this change The review of the host de-duplication found three problems in the Engine. The packages cannot fix any of them: - **Game boards render twice in Conversation.** When a game's agent is on in a Conversation chat, you see two boards. On a phone, the extra board takes up the whole screen. Every turn game lists the `conversation-surface` slot in its manifest. `ConversationView` mounts every turn game's board itself, and then the slot mounts it again. The Engine has done this since `ae92414ad` (2026-08-04), so v2.5.0 has it too. The fix belongs in the Engine. Removing the slot from the game manifests would not help: games people already installed, and older Engines, would still show two boards. - **"Internal Server Error" when an agent needs a newer Engine.** Download Agents offers an Install or Update button for a package version that this Engine refuses. Clicking it shows only "Internal Server Error". The reason, "Package requires capability API 1.341; this Engine supports …", appears only in the server log. Pending updates already skip these versions using the same check. The install route has to say why it refuses, for this Engine and every later one (v2.5.0 itself cannot be fixed). - **A call's `[schedule_update]` does not last.** The character card now owns presence. The chat's `characterSchedules` map is only a cache, and the next presence read replaces it. Calls can only patch that map, so the next `GET /api/chats/:id` wipes the change. The same command in a normal Conversation reply puts a status on the card. Calls needs a host member that reaches the card. Decisions: - **New member:** `api.runtime.persistence.updateCharacterStatus(chatId, characterId, update)`. Its name and shape match the other contract §2.2 persistence writers (`patchChatMetadata`, `appendMessages`, `createChatNote`). It does not copy the host's code. It hands the command to `handleConversationScheduleCommand`, the same function the generate route uses. That keeps the manual-status precedence, the 60-minute default and one-week limit on duration, and the cache refresh. - **Checks:** it requires `chat-write`, like every other persistence writer. It checks the input first. The chat must exist and be a Conversation chat. The character must be in that chat, which is the same check the reply path makes, since a command only reaches a character of its own chat. In a shared room it changes nothing and returns null, because rooms keep their own routines and never write the card. - **No capability API minor bump.** It stays at 1.341, and packages feature-detect the member. Under the contract, a package must declare a minor only when it *requires* a feature, so an older Engine refuses the install cleanly. Calls does not require this member: when it is missing, Calls skips the status change. The 1.31 `speech` member set the precedent of an optional member with no new minor. 1.341 has not shipped in any release yet: v2.5.0 reports 1.66. v2.5.1 will be the first release to report 1.341, and it will include this member. Only pre-release staging builds report 1.341 without it, which is why packages feature-detect it. ## What changed - With a game's agent on in a Conversation chat, its board now shows once instead of twice. Installing or updating an agent that needs a newer Marinara Engine now says which Engine or capability API version it needs, instead of "Internal Server Error". - `ConversationView` takes its turn games and `conversation-surface` packages from new selectors in `hooks/use-capability-packages.ts`. The slot leaves out turn games, because their boards are already mounted. Calls and other surface packages are unchanged. The Roleplay surface is unchanged, because it mounts games only through the slot. - `installCatalogPackage` throws `CapabilityPackageCompatibilityError` for the three checks it runs before downloading: install issue, capability API and Engine range. `POST /api/capability-packages/:id/install` answers **409 `{ error: <message> }`** for it, the same way it already answers a version mismatch. Other failures still go to the error handler. - New optional `CapabilityPersistenceHost.updateCharacterStatus` with shared types `CapabilityCharacterStatusUpdate` and `CapabilityCharacterStatusResult`, implemented in `capability-persistence.service.ts`. It is documented in `docs/development/optional-agent-packages.md`, under "Capability API 1.341", next to the other persistence members. - Regressions: `conversation-turn-game-surface` (new), `capability-package-install-refusal` (new) and an `updateCharacterStatus` block in `capability-runtime-host-services`. ## 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` Agent-run checks (for reference, not a substitute for the boxes above): - `pnpm check` passed. Its only output was an existing lint warning in a file this PR does not touch. - New or changed regressions passed: `conversation-turn-game-surface`, `capability-package-install-refusal` and `capability-runtime-host-services`. - Related regressions passed: `capability-package-lifecycle`, `capability-package-cache`, `capability-package-disk-cleanup`, `capability-persistence-permissions`, `capability-package-chat-controls`, `capability-gm-verbs`, `capability-preview-overlay`, `capability-release-notes`, `agent-registry-hydration`, `agents-see-whispers`, `character-schedule-ownership`, `conversation-game-slash`, `game-tool-controls`, `game-ruleset-packages`, `marinara-host-namespace`, `chat-window-icons`, `open-issues` and `robustness-runtime-diagnostics`. - Negative control: I removed the new `instanceof` from the install route, and the refusal regression failed with `500 !== 409`. The turn-game regression counts each surface mount. With the old slot filter, UNO would be mounted twice. Claim boundary (risky work: install/update flow, writes to character data): - **Core claim:** each turn game's board mounts once in a Conversation chat. A refused install answers 409 with the reason. A package can apply `[schedule_update]` to the character card through the host. - **Entrypoints:** `ConversationView` surface mounts; `POST /api/capability-packages/:id/install`; `api.runtime.persistence.updateCharacterStatus`. - **Current paths tested:** - A capability API one minor above this Engine's, and an Engine range above this Engine, both answer 409 before any download (`fetch` is stubbed to fail). - A failure that is not a refusal still answers 500 through the error handler. - Status, activity and duration land on the card, and the next presence read keeps them. - An update with only an activity keeps the current status. - An unreadable duration falls back to 60 minutes. - **Legacy paths:** installed `schemaVersion: 1` games still declare the slot and are still left out of it, because the filter uses `kind`, not the manifest version. - **Negative rows:** - A manual status (no end time) is kept, and the call returns null. - Rejected: an invalid status, an activity that is not text, an activity over 500 characters, an empty update, a null update, a character outside the chat, a Roleplay chat, a missing chat, and a package without `chat-write`. None of these changes the card. - A shared room returns null and leaves the card alone. - **Ground truth:** the verifier findings for Pasta-Devs/Marinara-Agents#1494: two `marinara-capability-eightball[view=surface]` elements under the same parent, HTTP 500 for 8 refused installs, and a call's `schedule_update` wiped by the next presence read. - **Manual blockers:** I did not run a browser on this Mac, and I did not install the real packages from the catalog. Calls does not use the new member until the Agents follow-up ships, so its end-to-end effect is not tested here. ### Manual verification notes - Manually verify in a browser: in a Conversation chat with Chess, UNO, Poker, 8-Ball, Tic-Tac-Toe or Rock Paper Scissors installed, turn the game's agent on (Chat Settings → Agents) and start a game. Exactly one board should show. Check the desktop and phone layouts. - Manually verify in a browser that the same game still shows one board with its agent off, and that Calls still shows its call screen in that chat. - Manually verify: with a catalog entry that needs a newer capability API (for example, `MARINARA_AGENT_CATALOG_URL` pointing at a copy where one package declares `capabilityApi.minor` 342), click Install or Update in Download Agents. The toast should read "Package requires capability API 1.342; this Engine supports 1.341", not "Internal Server Error". - Manually verify, once a Calls build that calls `updateCharacterStatus` is installed: in a call, have the character change its status (for example, to Do Not Disturb). The presence card should show the new status, keep it after a page reload, and keep it in the character's other Conversation chats until it ends. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Docs for translation: - `docs/development/optional-agent-packages.md`: one new bullet under "Capability API 1.341: host runtime services and shared server libraries" (`runtime.persistence.updateCharacterStatus`). No capability API bump, no version bump, no `CHANGELOG.md` edit. ## UI evidence (if applicable) None captured: no browser was run for this PR. The board fix only changes which components mount, so the verifier screenshots of two boards (listed in Pasta-Devs/Marinara-Agents#1496) show the before state. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:09:25 +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#7984
No description provided.