[GH-ISSUE #5715] [Bug]: Package assets 404 while an update awaits restart, breaking the Home tab icon #3161

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

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

Summary

After updating a capability package that declares a server entrypoint, every asset request for that package returns 404 {"error":"Active package asset not found"} until the Engine is restarted. The package's Home tab icon disappears from the running UI and comes back only after the user exits and relaunches.

Reported against Slurp, but the mechanism is generic — it affects any package with entrypoints.server whose update requires a restart.

Reproduction

  1. Have Slurp (or any package with a server entrypoint) installed and running.
  2. Install a package update from the UI, without restarting.
  3. The Home tab logo disappears. The browser console shows:
    GET /api/capability-packages/slurp/assets/slurp-logo.png → 404 Active package asset not found
  4. Restart the Engine. The logo returns.

Root cause

packageAsset() in packages/server/src/services/capability-packages/package-manager.service.ts:940-942:

async packageAsset(packageId: string, assetPath: string) {
  const installed = (await readRegistry()).packages.find((item) => item.id === packageId);
  if (!installed || !isInstalledCapabilityReady(installed)) return null;   // ← 404 here

isInstalledCapabilityReady() in packages/shared/src/schemas/capability-package.schema.ts:543-546:

export function isInstalledCapabilityReady(installed: InstalledCapabilityPackage): boolean {
  if (installed.status !== "active") return false;
  return !installed.manifest.entrypoints.server || installed.readiness === "ready";
}

The update path deliberately leaves the package un-activated. In capability-packages.routes.ts, the install handler only activates turn-game packages:

return installed.manifest.kind.includes("turn-game") && installed.status !== "restart-required"
  ? await capabilityModuleRuntime.activatePackage(app, id)
  : installed;

Slurp's manifest has "kind": ["agent"], so it is never activated inline. Its status stays restart-required, and the adjacent comment confirms this is intentional:

"A restart-required update leaves the prior runtime active in this process. Keep its agent definitions visible until startup activates the replacement; refreshing now would make the package disappear."

That intent is correct for the server runtime. The bug is that the same readiness gate is applied to static asset serving, so while the old runtime keeps serving the package's UI, that UI's own images 404.

The same gate is on line 914 (the client entrypoint route), which is likely also worth reviewing under this issue.

Why the readiness gate is wrong here

readiness describes whether the package's server module has been loaded and activated. Serving slurp-logo.png does not touch the server module at all. The bytes are on disk, declared in the manifest with a SHA-256, and re-verified on every request by readVerifiedInstalledPackageFile(). Nothing about a pending restart makes those bytes less trustworthy.

The result is a UI that is still running and still rendering, but cannot load its own declared icons.

Suggested fix

Gate asset serving on the package being installed and verified, not on runtime readiness. Concretely, in packageAsset() replace the isInstalledCapabilityReady(installed) check with a check that the registry entry exists and is not in a failed or partially-extracted state — restart-required should be servable.

All the safety properties are preserved, because they are enforced further down and are independent of readiness:

  • path normalization and traversal refusal (tryNormalize)
  • manifest.json refusal
  • the allowlist of contributions.homeBrowserTab.iconPaths + contributions.assets.paths
  • the manifest.files declaration lookup
  • the content-type allowlist
  • full re-read and hash verification via readVerifiedInstalledPackageFile(), which still throws loudly on an integrity failure

Which version's asset gets served

Worth deciding explicitly as part of the fix: while an update is pending restart, the registry entry describes the new version, but the old runtime is serving the UI. If the new version renamed or removed an icon, serving from the new manifest would still 404 for the old client.

Slurp is not affected today — slurp-logo.png is unchanged across 1.0.23 and 1.0.24 — but the general fix should serve assets from the manifest matching the runtime that is currently active, falling back to the newly installed one. Otherwise this reappears the first time a package renames an icon.

Evidence the package side is correct

The asset is present and correctly declared in the shipped artifact, so nothing needs to change in Pasta-Devs/Marinara-Agents:

$ unzip -l artifacts/slurp-1.0.24.zip
    31677  slurp-logo.png

packages/slurp/manifest.json:

"contributions": { "homeBrowserTab": { "iconPaths": ["slurp-logo.png"] } },
"files": [ { "path": "slurp-logo.png",
             "sha256": "722def3c01846167c9979b0408f380f923c520e7515aed1584de0d879131a75b",
             "bytes": 31677 } ]

Both the allowlist and the declaration lookup in packageAsset() would succeed. The request never reaches them because of the readiness gate on line 942.

Suggested regression test

Install a package with a server entrypoint, leave it at status: "restart-required", and assert that GET /:id/assets/<declared icon> returns 200 with the verified bytes rather than 404.

Originally created by @Gunterlie on GitHub (Sep 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5715 ## Summary After updating a capability package that declares a server entrypoint, every asset request for that package returns `404 {"error":"Active package asset not found"}` until the Engine is restarted. The package's Home tab icon disappears from the running UI and comes back only after the user exits and relaunches. Reported against Slurp, but the mechanism is generic — it affects any package with `entrypoints.server` whose update requires a restart. ## Reproduction 1. Have Slurp (or any package with a server entrypoint) installed and running. 2. Install a package update from the UI, without restarting. 3. The Home tab logo disappears. The browser console shows: `GET /api/capability-packages/slurp/assets/slurp-logo.png` → 404 `Active package asset not found` 4. Restart the Engine. The logo returns. ## Root cause `packageAsset()` in `packages/server/src/services/capability-packages/package-manager.service.ts:940-942`: ```ts async packageAsset(packageId: string, assetPath: string) { const installed = (await readRegistry()).packages.find((item) => item.id === packageId); if (!installed || !isInstalledCapabilityReady(installed)) return null; // ← 404 here ``` `isInstalledCapabilityReady()` in `packages/shared/src/schemas/capability-package.schema.ts:543-546`: ```ts export function isInstalledCapabilityReady(installed: InstalledCapabilityPackage): boolean { if (installed.status !== "active") return false; return !installed.manifest.entrypoints.server || installed.readiness === "ready"; } ``` The update path deliberately leaves the package un-activated. In `capability-packages.routes.ts`, the install handler only activates turn-game packages: ```ts return installed.manifest.kind.includes("turn-game") && installed.status !== "restart-required" ? await capabilityModuleRuntime.activatePackage(app, id) : installed; ``` Slurp's manifest has `"kind": ["agent"]`, so it is never activated inline. Its status stays `restart-required`, and the adjacent comment confirms this is intentional: > "A restart-required update leaves the prior runtime active in this process. Keep its agent definitions visible until startup activates the replacement; refreshing now would make the package disappear." That intent is correct for the *server runtime*. The bug is that the same readiness gate is applied to **static asset serving**, so while the old runtime keeps serving the package's UI, that UI's own images 404. The same gate is on line 914 (the client entrypoint route), which is likely also worth reviewing under this issue. ## Why the readiness gate is wrong here `readiness` describes whether the package's **server module** has been loaded and activated. Serving `slurp-logo.png` does not touch the server module at all. The bytes are on disk, declared in the manifest with a SHA-256, and re-verified on every request by `readVerifiedInstalledPackageFile()`. Nothing about a pending restart makes those bytes less trustworthy. The result is a UI that is still running and still rendering, but cannot load its own declared icons. ## Suggested fix Gate asset serving on the package being *installed and verified*, not on runtime readiness. Concretely, in `packageAsset()` replace the `isInstalledCapabilityReady(installed)` check with a check that the registry entry exists and is not in a failed or partially-extracted state — `restart-required` should be servable. All the safety properties are preserved, because they are enforced further down and are independent of readiness: - path normalization and traversal refusal (`tryNormalize`) - `manifest.json` refusal - the allowlist of `contributions.homeBrowserTab.iconPaths` + `contributions.assets.paths` - the `manifest.files` declaration lookup - the content-type allowlist - full re-read and hash verification via `readVerifiedInstalledPackageFile()`, which still throws loudly on an integrity failure ## Which version's asset gets served Worth deciding explicitly as part of the fix: while an update is pending restart, the registry entry describes the **new** version, but the **old** runtime is serving the UI. If the new version renamed or removed an icon, serving from the new manifest would still 404 for the old client. Slurp is not affected today — `slurp-logo.png` is unchanged across 1.0.23 and 1.0.24 — but the general fix should serve assets from the manifest matching the runtime that is currently active, falling back to the newly installed one. Otherwise this reappears the first time a package renames an icon. ## Evidence the package side is correct The asset is present and correctly declared in the shipped artifact, so nothing needs to change in Pasta-Devs/Marinara-Agents: ``` $ unzip -l artifacts/slurp-1.0.24.zip 31677 slurp-logo.png ``` `packages/slurp/manifest.json`: ```json "contributions": { "homeBrowserTab": { "iconPaths": ["slurp-logo.png"] } }, "files": [ { "path": "slurp-logo.png", "sha256": "722def3c01846167c9979b0408f380f923c520e7515aed1584de0d879131a75b", "bytes": 31677 } ] ``` Both the allowlist and the declaration lookup in `packageAsset()` would succeed. The request never reaches them because of the readiness gate on line 942. ## Suggested regression test Install a package with a server entrypoint, leave it at `status: "restart-required"`, and assert that `GET /:id/assets/<declared icon>` returns 200 with the verified bytes rather than 404.
bsakaguchi 2026-10-21 06:00:07 +07:00
Author
Owner

@Gunterlie commented on GitHub (Sep 1, 2026):

Scope evidence: this affects every package, not just Slurp

Checked all 13 package manifests in Pasta-Devs/Marinara-Agents:

count
packages with entrypoints.server 13 of 13
of those, packages that also declare a Home tab icon 3 (slurp, noodle, gacha-forge)

isInstalledCapabilityReady() returns false for any package with a server entrypoint whose readiness !== "ready", and the update path deliberately leaves non-turn-game packages at restart-required. Since every package in the catalog has a server entrypoint, every package's asset route is gated off after an update until the Engine restarts.

Three of them declare a browser-tab icon, so those are where a user actually sees it: the tab icon vanishes mid-session and returns after a relaunch. The other ten have no icon to lose today, but the same latent gate would bite the moment any of them declares one.

This was originally reported as a Slurp problem. It is not Slurp-specific — Slurp is just one of the three packages currently visible enough to notice.

Separate, unrelated finding in the Agents repo

While checking this I found a second cause of the same 404 string that is not an Engine bug, so it does not belong to this issue — recording it here only so the two are not conflated during triage.

slurp-1.0.25 ships slurpagent.png in files[] with a SHA-256, but the file appears in neither contributions.homeBrowserTab.iconPaths nor contributions.assets.paths. packageAsset() correctly refuses it via the serve-path allowlist, so it returns the same Active package asset not found permanently, independent of restart state.

That is a manifest problem on the package side. Fixing it needs contributions.assets, which requires schemaVersion: 2 and capabilityApi 1.10+ — Slurp is currently schemaVersion: 1 with engine.min 2.4.3, so it is a compatibility decision for the package maintainers rather than a change here.

No action needed on this issue for that one; the restart-gate fix described above stands on its own.

<!-- gh-comment-id:5493856885 --> @Gunterlie commented on GitHub (Sep 1, 2026): ## Scope evidence: this affects every package, not just Slurp Checked all 13 package manifests in `Pasta-Devs/Marinara-Agents`: | | count | |---|---| | packages with `entrypoints.server` | **13 of 13** | | of those, packages that also declare a Home tab icon | 3 (`slurp`, `noodle`, `gacha-forge`) | `isInstalledCapabilityReady()` returns false for any package with a server entrypoint whose `readiness !== "ready"`, and the update path deliberately leaves non-turn-game packages at `restart-required`. Since **every** package in the catalog has a server entrypoint, every package's asset route is gated off after an update until the Engine restarts. Three of them declare a browser-tab icon, so those are where a user actually sees it: the tab icon vanishes mid-session and returns after a relaunch. The other ten have no icon to lose today, but the same latent gate would bite the moment any of them declares one. This was originally reported as a Slurp problem. It is not Slurp-specific — Slurp is just one of the three packages currently visible enough to notice. ## Separate, unrelated finding in the Agents repo While checking this I found a second cause of the same 404 string that is **not** an Engine bug, so it does not belong to this issue — recording it here only so the two are not conflated during triage. `slurp-1.0.25` ships `slurpagent.png` in `files[]` with a SHA-256, but the file appears in neither `contributions.homeBrowserTab.iconPaths` nor `contributions.assets.paths`. `packageAsset()` correctly refuses it via the serve-path allowlist, so it returns the same `Active package asset not found` **permanently**, independent of restart state. That is a manifest problem on the package side. Fixing it needs `contributions.assets`, which requires `schemaVersion: 2` and `capabilityApi` 1.10+ — Slurp is currently `schemaVersion: 1` with `engine.min` 2.4.3, so it is a compatibility decision for the package maintainers rather than a change here. No action needed on this issue for that one; the restart-gate fix described above stands on its own.
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#3161
No description provided.