[GH-ISSUE #3692] [Issue]: Custom agents (maybe any agents?) can't run in conversations #1996

Closed
opened 2026-10-21 05:44:28 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Custom chat agents can't run in conversation mode even if you specifically select "enable agents" and then add one to the chat. Marinara appears to be blocking them while in conversation mode.

I wanted a custom agent to rewrite responses to include typing quirks/speech patterns that models found it difficult to follow organically just from normal prompting and example messages.

Expected behavior

Added a custom agent to check what is going on whose job was just to add a marker "[REWRITER DEFINITELY RAN]", it should add that text to the start of messages.

Actual behavior

Nothing happens

Steps to reproduce

  1. Create a custom agent for post processing, text rewrite, no activation keys, enable it. I used this prompt:
" You are testing whether this Text Rewrite agent executes.

Rewrite only the latest assistant response.

Add the exact marker:

[REWRITER DEFINITELY RAN]

to the very beginning of the response.

Return only one valid JSON object:

{
  "editedText": "[REWRITER DEFINITELY RAN] followed immediately by the complete original assistant response",
  "changes": [
    {
      "description": "Added the execution-test marker."
    }
  ]
}

You must always add the marker.
Never return the original response without the marker.
Do not return Markdown fences or commentary."
  1. Add this agent to a conversation (not Roleplay or Game). Specifically make sure you manually toggled "enable agents."
  2. Send some messages

Environment

  • Marinara Engine version: 2.2.1
  • Install type: Termux
  • OS + version: Android 13
  • Browser or app shell: Marinara Official APK

Logs, screenshots, or video

Grepped the logs to see if the agent is even actually running, got this:

{"level":30,"time":1784209206302,"pid":30983,"hostname":"localhost","msg":"[generate] Resolved 0 agents for chat Wy8IesoJz4_OevM8SJtCb (enableAgents=false, perChatList=false, activeIds=[]): "}
{"level":30,"time":1784209273528,"pid":30983,"hostname":"localhost","msg":"[generate] Resolved 0 agents for chat Wy8IesoJz4_OevM8SJtCb (enableAgents=false, perChatList=false, activeIds=[]): "}
{"level":30,"time":1784209399553,"pid":30983,"hostname":"localhost","msg":"[generate] Resolved 0 agents for chat mZdXpX7VK2yOLvgb4KOTV (enableAgents=false, perChatList=true, activeIds=[custom-human-voice-rewriter-8aceedf8-03ef-4ce8-b0df-38ac122491d9]): "}
{"level":30,"time":1784209442336,"pid":30983,"hostname":"localhost","reqId":"req-bh","req":{"method":"GET","url":"/api/agents/memory/custom-human-voice-rewriter-8aceedf8-03ef-4ce8-b0df-38ac122491d9/mZdXpX7VK2yOLvgb4KOTV","host":"127.0.0.1:7860","remoteAddress":"127.0.0.1","remotePort":46768},"msg":"incoming request"}
{"level":30,"time":1784209451040,"pid":30983,"hostname":"localhost","msg":"[generate] Resolved 0 agents for chat mZdXpX7VK2yOLvgb4KOTV (enableAgents=false, perChatList=true, activeIds=[custom-human-voice-rewriter-8aceedf8-03ef-4ce8-b0df-38ac122491d9]): "}
{"diagnostic": "raw_chat_agent_state", "chatId": "mZdXpX7VK2yOLvgb4KOTV", "chatMode": "conversation", "rawEnableAgents": true, "activeAgentIds": ["custom-human-voice-rewriter-8aceedf8-03ef-4ce8-b0df-38ac122491d9"]}

Enable agents is false despite "enable agents" being toggled withim the chat's ui.

Additional context

In:

  • packages/server/src/routes/generate/generate-route-utils.ts

There is:

shouldEnableAgentsForGeneration(...)

Which contains:

return chatEnableAgents
  && chatMode !== "conversation"
  && !(impersonate && impersonateBlockAgents);

Which appears to force agents off in conversations no matter what, even if you toggled them on.

After changing the mentioned function to:

export function shouldEnableAgentsForGeneration({
  chatEnableAgents,
  chatMode,
  impersonate,
  impersonateBlockAgents,
}: {
  chatEnableAgents: boolean;
  chatMode: string;
  impersonate: boolean;
  impersonateBlockAgents: boolean;
}): boolean {
  return (
    chatEnableAgents &&
    !(impersonate && impersonateBlockAgents)
  );
}

My test agent was able to run:

Image

Opt QoL?: For text rewriting agents in conversations, it might be better to like not reveal the final message until the rewrite is done for ✨️immersion✨️. Right now the original message renders, stays for a few moments, then rerenders with the edits.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @rainedaye on GitHub (Jul 16, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3692 Originally assigned to: @SpicyMarinara on GitHub. ## Summary <!-- What is wrong in one or two sentences? --> Custom chat agents can't run in conversation mode even if you specifically select "enable agents" and then add one to the chat. Marinara appears to be blocking them while in conversation mode. I wanted a custom agent to rewrite responses to include typing quirks/speech patterns that models found it difficult to follow organically just from normal prompting and example messages. ## Expected behavior <!-- What should have happened? --> Added a custom agent to check what is going on whose job was just to add a marker "[REWRITER DEFINITELY RAN]", it should add that text to the start of messages. ## Actual behavior Nothing happens <!-- What happened instead? --> ## Steps to reproduce 1. Create a custom agent for post processing, text rewrite, no activation keys, enable it. I used this prompt: ``` " You are testing whether this Text Rewrite agent executes. Rewrite only the latest assistant response. Add the exact marker: [REWRITER DEFINITELY RAN] to the very beginning of the response. Return only one valid JSON object: { "editedText": "[REWRITER DEFINITELY RAN] followed immediately by the complete original assistant response", "changes": [ { "description": "Added the execution-test marker." } ] } You must always add the marker. Never return the original response without the marker. Do not return Markdown fences or commentary." ``` 2. Add this agent to a conversation (not Roleplay or Game). Specifically make sure you manually toggled "enable agents." 3. Send some messages ## Environment - Marinara Engine version: 2.2.1 - Install type: Termux - OS + version: Android 13 - Browser or app shell: Marinara Official APK ## Logs, screenshots, or video <!-- Paste relevant logs and add screenshots when possible --> Grepped the logs to see if the agent is even actually running, got this: ``` {"level":30,"time":1784209206302,"pid":30983,"hostname":"localhost","msg":"[generate] Resolved 0 agents for chat Wy8IesoJz4_OevM8SJtCb (enableAgents=false, perChatList=false, activeIds=[]): "} {"level":30,"time":1784209273528,"pid":30983,"hostname":"localhost","msg":"[generate] Resolved 0 agents for chat Wy8IesoJz4_OevM8SJtCb (enableAgents=false, perChatList=false, activeIds=[]): "} {"level":30,"time":1784209399553,"pid":30983,"hostname":"localhost","msg":"[generate] Resolved 0 agents for chat mZdXpX7VK2yOLvgb4KOTV (enableAgents=false, perChatList=true, activeIds=[custom-human-voice-rewriter-8aceedf8-03ef-4ce8-b0df-38ac122491d9]): "} {"level":30,"time":1784209442336,"pid":30983,"hostname":"localhost","reqId":"req-bh","req":{"method":"GET","url":"/api/agents/memory/custom-human-voice-rewriter-8aceedf8-03ef-4ce8-b0df-38ac122491d9/mZdXpX7VK2yOLvgb4KOTV","host":"127.0.0.1:7860","remoteAddress":"127.0.0.1","remotePort":46768},"msg":"incoming request"} {"level":30,"time":1784209451040,"pid":30983,"hostname":"localhost","msg":"[generate] Resolved 0 agents for chat mZdXpX7VK2yOLvgb4KOTV (enableAgents=false, perChatList=true, activeIds=[custom-human-voice-rewriter-8aceedf8-03ef-4ce8-b0df-38ac122491d9]): "} {"diagnostic": "raw_chat_agent_state", "chatId": "mZdXpX7VK2yOLvgb4KOTV", "chatMode": "conversation", "rawEnableAgents": true, "activeAgentIds": ["custom-human-voice-rewriter-8aceedf8-03ef-4ce8-b0df-38ac122491d9"]} ``` Enable agents is false despite "enable agents" being toggled withim the chat's ui. ## Additional context <!-- Optional: related issue links, temporary workaround, etc. --> In: - packages/server/src/routes/generate/generate-route-utils.ts There is: ``` shouldEnableAgentsForGeneration(...) ``` Which contains: ``` return chatEnableAgents && chatMode !== "conversation" && !(impersonate && impersonateBlockAgents); ``` Which appears to force agents off in conversations no matter what, even if you toggled them on. After changing the mentioned function to: ``` export function shouldEnableAgentsForGeneration({ chatEnableAgents, chatMode, impersonate, impersonateBlockAgents, }: { chatEnableAgents: boolean; chatMode: string; impersonate: boolean; impersonateBlockAgents: boolean; }): boolean { return ( chatEnableAgents && !(impersonate && impersonateBlockAgents) ); } ``` My test agent was able to run: <img width="1080" height="2400" alt="Image" src="https://github.com/user-attachments/assets/b08745ad-903f-412d-a305-57739934bbef" /> ### Opt QoL?: For text rewriting agents in conversations, it might be better to like not reveal the final message until the rewrite is done for ✨️immersion✨️. Right now the original message renders, stays for a few moments, then rerenders with the edits. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:44:28 +07:00
  • closed this issue
  • added the
    in-pr
    bug
    labels
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#1996
No description provided.