[GH-ISSUE #4536] [Issue]: Pre-generation agents silently stop running after upgrade to 2.4.0 #2471

Closed
opened 2026-10-21 05:48:30 +07:00 by bsakaguchi · 2 comments
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

A user upgraded 2.3.4 → 2.4.0 and pre-generation ("preprocessing") agents stopped running. The main model generates immediately with nothing injected into the prompt. No error is surfaced, no log line is written, and the agent configs are still present in the UI — so from the user's side the feature simply vanished.

Reported on Discord: https://discord.com/channels/1417099416812392641/1533926858889105619

Reproduction (unconfirmed — see Open questions)

  1. Have working pre-generation agents on 2.3.4
  2. Upgrade to 2.4.0
  3. Send a fresh user message in a chat with agents enabled
  4. Expected: agent output injected into the main prompt
    Actual: main model generates immediately, no injection

Candidate cause #1 — externally imported agents, gate defaults to off on upgrade

packages/server/src/services/agents/custom-agent-import-policy.service.ts:9 reads the custom-agent-imports-enabled app setting and treats an unset value as OFF:

enabled: (await createAppSettingsStorage(db).get(CUSTOM_AGENT_IMPORTS_SETTINGS_KEY)) === "true",

The gate was added in 8b4c9018d ("Gate external Agent imports"), which is in the v2.3.4..v2.4.0 range. There is no backfill migration, so every install that upgraded with agents already imported gets the gate off by default.

Effect: at packages/server/src/routes/generate.routes.ts:1612-1618, every agent matching isExternallyImportedAgent is filtered out of configuredPromptAgents before phase resolution. Pre-generation agents never run and contextInjections stays empty. The same gate filters at packages/server/src/routes/generate/retry-agents-route.ts:1231 and packages/server/src/services/prompt/marker-expander.ts:573.

The filtering is silent — no log, no user-facing error. That is the part that turned a config change into an unreproducible-looking bug report.

Workaround: Settings → Advanced → Danger Zone → Allow custom Agent imports.

Proposed fix: treat unset as enabled (!== "false"), so an explicit opt-out still disables the feature but an upgrade does not silently break a working pipeline. Add a logger.debug wherever agents are dropped by this filter.

Candidate cause #2 — in-engine agents misclassified by name

isExternallyImportedAgent (packages/shared/src/types/agent.ts:675-681) classifies partly by type prefix custom-import-. Agents authored in-engine get custom-<slug>-<uuid> from packages/client/src/components/agents/AgentEditor.tsx:143, where the slug derives from the agent name.

An in-engine agent named "Import Helper" or "Importer" therefore produces custom-import-helper-<uuid> and is falsely treated as externally imported, then dropped by the gate above. Narrow, but it presents identically to #1 and is a genuine classification bug independent of the upgrade issue.

Open questions

The reporter may have created these agents in-engine (via Professor Mari) rather than importing them. In-engine agents get a plain custom-<slug>-<uuid> type with no customAgentImportSource setting, so neither the gate nor the Danger Zone toggle applies to them — in which case the real cause is still unidentified.

Next places to look for that path: chatMeta.enableAgents and chatMeta.activeAgentIds handling at packages/server/src/routes/generate.routes.ts:1586-1593, specifically whether 2.4.0 changed how per-chat agent activation is persisted for pre-existing chats.

Ruled out: the agent refactor commits 5610c23f9 and b03318e2c landed in v2.3.0, before the reporter's known-good version.

Regardless of which cause

Agents being dropped from the pipeline should never be silent. A debug log at each filter point, and ideally a visible indicator when enabled agents are skipped, would have made this self-diagnosable.

Originally created by @Gunterlie on GitHub (Aug 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4536 Originally assigned to: @SpicyMarinara on GitHub. ## Summary A user upgraded 2.3.4 → 2.4.0 and pre-generation ("preprocessing") agents stopped running. The main model generates immediately with nothing injected into the prompt. No error is surfaced, no log line is written, and the agent configs are still present in the UI — so from the user's side the feature simply vanished. Reported on Discord: https://discord.com/channels/1417099416812392641/1533926858889105619 ## Reproduction (unconfirmed — see Open questions) 1. Have working pre-generation agents on 2.3.4 2. Upgrade to 2.4.0 3. Send a fresh user message in a chat with agents enabled 4. **Expected:** agent output injected into the main prompt **Actual:** main model generates immediately, no injection ## Candidate cause #1 — externally imported agents, gate defaults to off on upgrade `packages/server/src/services/agents/custom-agent-import-policy.service.ts:9` reads the `custom-agent-imports-enabled` app setting and treats an unset value as OFF: ```ts enabled: (await createAppSettingsStorage(db).get(CUSTOM_AGENT_IMPORTS_SETTINGS_KEY)) === "true", ``` The gate was added in 8b4c9018d ("Gate external Agent imports"), which is in the `v2.3.4..v2.4.0` range. There is no backfill migration, so every install that upgraded with agents already imported gets the gate off by default. Effect: at `packages/server/src/routes/generate.routes.ts:1612-1618`, every agent matching `isExternallyImportedAgent` is filtered out of `configuredPromptAgents` before phase resolution. Pre-generation agents never run and `contextInjections` stays empty. The same gate filters at `packages/server/src/routes/generate/retry-agents-route.ts:1231` and `packages/server/src/services/prompt/marker-expander.ts:573`. The filtering is silent — no log, no user-facing error. That is the part that turned a config change into an unreproducible-looking bug report. **Workaround:** Settings → Advanced → Danger Zone → *Allow custom Agent imports*. **Proposed fix:** treat unset as enabled (`!== "false"`), so an explicit opt-out still disables the feature but an upgrade does not silently break a working pipeline. Add a `logger.debug` wherever agents are dropped by this filter. ## Candidate cause #2 — in-engine agents misclassified by name `isExternallyImportedAgent` (`packages/shared/src/types/agent.ts:675-681`) classifies partly by type prefix `custom-import-`. Agents authored in-engine get `custom-<slug>-<uuid>` from `packages/client/src/components/agents/AgentEditor.tsx:143`, where the slug derives from the agent **name**. An in-engine agent named "Import Helper" or "Importer" therefore produces `custom-import-helper-<uuid>` and is falsely treated as externally imported, then dropped by the gate above. Narrow, but it presents identically to #1 and is a genuine classification bug independent of the upgrade issue. ## Open questions The reporter may have created these agents in-engine (via Professor Mari) rather than importing them. In-engine agents get a plain `custom-<slug>-<uuid>` type with no `customAgentImportSource` setting, so neither the gate nor the Danger Zone toggle applies to them — in which case the real cause is still unidentified. Next places to look for that path: `chatMeta.enableAgents` and `chatMeta.activeAgentIds` handling at `packages/server/src/routes/generate.routes.ts:1586-1593`, specifically whether 2.4.0 changed how per-chat agent activation is persisted for pre-existing chats. Ruled out: the agent refactor commits 5610c23f9 and b03318e2c landed in v2.3.0, before the reporter's known-good version. ## Regardless of which cause Agents being dropped from the pipeline should never be silent. A debug log at each filter point, and ideally a visible indicator when enabled agents are skipped, would have made this self-diagnosable.
Author
Owner

@SpicyMarinara commented on GitHub (Aug 4, 2026):

Implementation has started in draft PR #4553. Owner: @SpicyMarinara.

<!-- gh-comment-id:5175454761 --> @SpicyMarinara commented on GitHub (Aug 4, 2026): Implementation has started in draft PR #4553. Owner: @SpicyMarinara.
Author
Owner

@SpicyMarinara commented on GitHub (Aug 4, 2026):

Delivered to staging via #4553 (merge commit 7708b7f0b2).

<!-- gh-comment-id:5175920530 --> @SpicyMarinara commented on GitHub (Aug 4, 2026): Delivered to staging via #4553 (merge commit 7708b7f0b2581b90ae4fdc9e2eba787796005fab).
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#2471
No description provided.