[PR #6991] [MERGED] feat(agents): let an agent opt out of shared agent requests #7419

Closed
opened 2026-10-23 04:19:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: feat/agent-batching-toggle-6977


📝 Commits (5)

  • 1e06892 feat(agents): let an agent opt out of shared agent requests
  • cfee43a fix(agents): keep every rewrite edit and the job limit on agent retries
  • ea09ab2 Merge remote-tracking branch 'origin/staging' into feat/agent-batching-toggle-6977
  • 04c62a0 fix(agents): lock the sharing switch for Music DJ in YouTube and Custom modes
  • 603d0f9 Merge remote-tracking branch 'origin/staging' into feat/agent-batching-toggle-6977

📊 Changes

13 files changed (+393 additions, -45 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 packages/client/src/components/agents/AgentEditor.tsx (+38 -0)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+1 -0)
📝 packages/client/src/localization/locales/en.json (+3 -0)
📝 packages/server/src/routes/generate.routes.ts (+3 -0)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+77 -39)
📝 packages/server/src/services/agents/agent-executor.ts (+6 -2)
📝 packages/server/src/services/generation/prose-guardian-settings.ts (+7 -2)
📝 packages/shared/src/utils/agent-cost.ts (+5 -2)
📝 scripts/regressions/advanced-memory-post-generation.regression.ts (+47 -0)
➕ scripts/regressions/agent-retry-batching.regression.ts (+143 -0)
📝 scripts/regressions/agent-runtime.regression.ts (+28 -0)
📝 scripts/regressions/roleplay-streaming.regression.ts (+31 -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

Closes #6977

Why this change

Agents that share a connection are batched into one request. Local models often mix up the instructions of batched agents. For example, a custom tracker starts filling in world-tracker fields, or the reverse. There was no way to keep one agent out of the batch. As promised on the issue, the Agent editor now has a toggle for that. The global and per-connection batching settings the issue also mentions are out of scope.

What changed

  • Per-agent setting settings.batchWithOtherAgents, shown in the Agent editor as Share requests with other agents under Connection Override, for built-in and custom agents. It is on by default, so nothing changes until a user turns it off. Off means shouldRunAgentIndividually (agent-executor.ts) sends the agent in its own request. Other agents on that connection still share one, and the agent's own request still waits behind the connection's Max Parallel Agent Jobs limit. Agent settings are a free-form record that import and export already keep, so there is no schema or storage change. The editor saves and exports the key.
  • The second batching path. Prose Guardian, Continuity Checker and Immersive HTML are merged into one editor request elsewhere (mergePairedBuiltInRewriteAgents and its retry twin). The new sharesBuiltInRewriteRequest keeps an opted-out rewrite agent out of that merge after a reply and on retry. Without it, the switch would do nothing for those three.
  • Agents that always run alone (Illustrator, Beholder, agents with Previous output and the other fixed rules) show the switch as off and locked, so it never claims something the server won't do. The fixed rules themselves are unchanged.
  • Advanced Memory: an opted-out tracker no longer carries the shared scene-check task; Advanced Memory checks the scene in a request of its own.
  • Retries: review found two problems in this path, both fixed.
    • Retried rewrite agents now run one after another, each on the text the one before left, as after a fresh reply. Before, retrying two of them together (for example Prose Guardian and a custom Text Rewrite agent) kept only the last one's edits.
    • Agent retries now keep to each connection's Max Parallel Agent Jobs limit.
  • Chat Settings: the agent-load readout counts an opted-out agent as its own call.
  • Copy: two English localization keys, and two CHANGELOG entries.
  • Regressions:
    • agent-runtime (an opted-out agent gets its own request while the others still share one) and roleplay-streaming (rewrite merge) are extended.
    • agent-retry-batching is new, for the retry rewrite chain and the per-connection job limit.
    • advanced-memory-post-generation is extended, for the scene check.
    • Each fails without its fix.

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

Manual verification notes

Run by the agent:

  • pnpm check and pnpm localization:check pass.
  • These regressions pass: the new and extended ones above, plus every regression that imports or pattern-matches the agent executor or retry route (agent-runtime, capability-agent-runtime, agent-scene-check, manual-agent-retry-resolution, game-sequential-tasks, agent-previous-output, agent-progress, illustrator-*, beholder-directive, character-identity, generate-agent-abort, issue-sweep-5391-5394, expression-group-generation, decision-conditionals, prompt, open-issues).
  • A temporary Playwright spec (deleted afterwards) checked the switch in the Agent editor on desktop and mobile Chromium.
  • An adversarial review reproduced four findings and a nit, and all were fixed: the retry rewrite chain, the retry job limit, the scene check, the locked switch, and the readout.

Still to verify by hand:

  • Prose Guardian, Continuity Checker and Immersive HTML keep an enabled Share requests with other agents switch even with Previous output on (no e2e fixture installs those packages).
  • Retry Failed Agents after Prose Guardian and a custom Text Rewrite agent both fail on one reply, on a real model: both edits remain in the message.
  • Retrying agents on a local connection with Max Parallel Agent Jobs = 1, with one agent's switch off: one agent request at a time.
  • With Advanced Memory on and the Decision model off, a tracker with sharing off runs its own request, and the scene check appears as separate Advanced Recall activity.
  • The Chat Settings agent-load readout shows one more call after turning sharing off for an active agent.
  • The locked switch row in light theme and at mobile width (only desktop Chromium in dark theme was captured).

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)

CHANGELOG updated. No user doc became wrong; docs/agents/agents-overview.md could mention the switch in a later docs pass.

Summary by CodeRabbit

  • New Features
    • Agents can be configured to share requests with other agents or send requests separately. Sharing is enabled by default, and agents that must run independently are shown as such.
  • Improvements
    • Rewrite agents apply accepted edits in sequence, and retry jobs honor configured concurrency limits.
    • Separate agent requests are counted individually when estimating load.

🔄 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/6991 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/3/2026 **Status:** ✅ Merged **Merged:** 10/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/agent-batching-toggle-6977` --- ### 📝 Commits (5) - [`1e06892`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1e06892ff852f0f7d45df8a78c23ac0c1e25e143) feat(agents): let an agent opt out of shared agent requests - [`cfee43a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cfee43ac33ca65b61bb6c45a2e13bb878e51faca) fix(agents): keep every rewrite edit and the job limit on agent retries - [`ea09ab2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ea09ab2c1d5f4b5517687fa3d78bd9c61f2103ae) Merge remote-tracking branch 'origin/staging' into feat/agent-batching-toggle-6977 - [`04c62a0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/04c62a0ba3097254cdc510410d5b86e85d7723e7) fix(agents): lock the sharing switch for Music DJ in YouTube and Custom modes - [`603d0f9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/603d0f9c78c64c90f90a8cc99319cebc0d7178b1) Merge remote-tracking branch 'origin/staging' into feat/agent-batching-toggle-6977 ### 📊 Changes **13 files changed** (+393 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+38 -0) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+1 -0) 📝 `packages/client/src/localization/locales/en.json` (+3 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+3 -0) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+77 -39) 📝 `packages/server/src/services/agents/agent-executor.ts` (+6 -2) 📝 `packages/server/src/services/generation/prose-guardian-settings.ts` (+7 -2) 📝 `packages/shared/src/utils/agent-cost.ts` (+5 -2) 📝 `scripts/regressions/advanced-memory-post-generation.regression.ts` (+47 -0) ➕ `scripts/regressions/agent-retry-batching.regression.ts` (+143 -0) 📝 `scripts/regressions/agent-runtime.regression.ts` (+28 -0) 📝 `scripts/regressions/roleplay-streaming.regression.ts` (+31 -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`. ## Linked issue Closes #6977 ## Why this change Agents that share a connection are batched into one request. Local models often mix up the instructions of batched agents. For example, a custom tracker starts filling in world-tracker fields, or the reverse. There was no way to keep one agent out of the batch. As promised on the issue, the Agent editor now has a toggle for that. The global and per-connection batching settings the issue also mentions are out of scope. ## What changed - **Per-agent setting** `settings.batchWithOtherAgents`, shown in the Agent editor as **Share requests with other agents** under **Connection Override**, for built-in and custom agents. It is on by default, so nothing changes until a user turns it off. Off means `shouldRunAgentIndividually` (`agent-executor.ts`) sends the agent in its own request. Other agents on that connection still share one, and the agent's own request still waits behind the connection's **Max Parallel Agent Jobs** limit. Agent settings are a free-form record that import and export already keep, so there is no schema or storage change. The editor saves and exports the key. - **The second batching path.** Prose Guardian, Continuity Checker and Immersive HTML are merged into one editor request elsewhere (`mergePairedBuiltInRewriteAgents` and its retry twin). The new `sharesBuiltInRewriteRequest` keeps an opted-out rewrite agent out of that merge after a reply and on retry. Without it, the switch would do nothing for those three. - **Agents that always run alone** (Illustrator, Beholder, agents with Previous output and the other fixed rules) show the switch as off and locked, so it never claims something the server won't do. The fixed rules themselves are unchanged. - **Advanced Memory:** an opted-out tracker no longer carries the shared scene-check task; Advanced Memory checks the scene in a request of its own. - **Retries:** review found two problems in this path, both fixed. - Retried rewrite agents now run one after another, each on the text the one before left, as after a fresh reply. Before, retrying two of them together (for example Prose Guardian and a custom Text Rewrite agent) kept only the last one's edits. - Agent retries now keep to each connection's Max Parallel Agent Jobs limit. - **Chat Settings:** the agent-load readout counts an opted-out agent as its own call. - **Copy:** two English localization keys, and two CHANGELOG entries. - **Regressions:** - `agent-runtime` (an opted-out agent gets its own request while the others still share one) and `roleplay-streaming` (rewrite merge) are extended. - `agent-retry-batching` is new, for the retry rewrite chain and the per-connection job limit. - `advanced-memory-post-generation` is extended, for the scene check. - Each fails without its fix. ## 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` ### Manual verification notes Run by the agent: - `pnpm check` and `pnpm localization:check` pass. - These regressions pass: the new and extended ones above, plus every regression that imports or pattern-matches the agent executor or retry route (agent-runtime, capability-agent-runtime, agent-scene-check, manual-agent-retry-resolution, game-sequential-tasks, agent-previous-output, agent-progress, illustrator-*, beholder-directive, character-identity, generate-agent-abort, issue-sweep-5391-5394, expression-group-generation, decision-conditionals, prompt, open-issues). - A temporary Playwright spec (deleted afterwards) checked the switch in the Agent editor on desktop and mobile Chromium. - An adversarial review reproduced four findings and a nit, and all were fixed: the retry rewrite chain, the retry job limit, the scene check, the locked switch, and the readout. Still to verify by hand: - Prose Guardian, Continuity Checker and Immersive HTML keep an enabled **Share requests with other agents** switch even with Previous output on (no e2e fixture installs those packages). - **Retry Failed Agents** after Prose Guardian and a custom Text Rewrite agent both fail on one reply, on a real model: both edits remain in the message. - Retrying agents on a local connection with Max Parallel Agent Jobs = 1, with one agent's switch off: one agent request at a time. - With Advanced Memory on and the Decision model off, a tracker with sharing off runs its own request, and the scene check appears as separate Advanced Recall activity. - The Chat Settings agent-load readout shows one more call after turning sharing off for an active agent. - The locked switch row in light theme and at mobile width (only desktop Chromium in dark theme was captured). ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) CHANGELOG updated. No user doc became wrong; `docs/agents/agents-overview.md` could mention the switch in a later docs pass. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Agents can be configured to share requests with other agents or send requests separately. Sharing is enabled by default, and agents that must run independently are shown as such. * **Improvements** * Rewrite agents apply accepted edits in sequence, and retry jobs honor configured concurrency limits. * Separate agent requests are counted individually when estimating load. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:19:35 +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#7419
No description provided.