[PR #3784] [MERGED] fix: batch same-connection agents reliably #6099

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3784
Author: @SpicyMarinara
Created: 7/18/2026
Status: ✅ Merged
Merged: 7/18/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/3783-batch-tracker-retries


📝 Commits (3)

  • a87fcbc chore: start tracker agent batching fix
  • 9490f53 fix: batch same-connection agents reliably
  • c758836 fix: address agent batching review

📊 Changes

5 files changed (+159 additions, -24 deletions)

View changed files

📝 packages/server/src/routes/generate/retry-agents-route.ts (+13 -7)
📝 packages/server/src/services/agents/agent-executor.ts (+0 -1)
📝 packages/server/src/services/generation/agent-resolution.ts (+16 -16)
📝 scripts/regressions/open-issues.regression.ts (+7 -0)
📝 scripts/regressions/roleplay-streaming.regression.ts (+123 -0)

📄 Description

Linked issue

Closes #3783

Why this change

  • Compatible agents could be split into separate paid-model requests even when they shared a connection and model. Retry resolution recreated provider wrappers per saved agent, ordinary generation did the same for direct chat-connection fallbacks, and Expression Engine was explicitly excluded from batching.

What changed

  • Reuse request-scoped provider resolutions for every saved retry agent sharing a connection, including default, explicit, and local-sidecar connections.
  • Reuse the ordinary generation wrapper when multiple agents inherit the chat connection directly.
  • Allow Expression Engine to participate in compatible agent batches.
  • Add regression proof that Expression Engine, World State, and Background make one provider call with one Agent Batch (3) debug request/response pair.

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

  • pnpm regression:roleplay — passed. The controlled provider fixture asserts one provider call, three successful logical results, and one batch debug request/response pair.
  • pnpm regression:issues — passed sequentially. Its expected simulated storage errors remain part of the passing fixtures.
  • pnpm check — passed after the final implementation.
  • No live paid-provider call was made; provider request-count behavior was verified with the deterministic regression fixture.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

No docs or release metadata changes are needed for this server-side orchestration fix.

UI evidence (if applicable)

Not applicable; no UI files changed.

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability by reusing cached retry agent connection resolutions per connection ID.
    • Enhanced agent connection provider resolution by caching even fallback cases when no connection ID is present.
    • Broadened isolation rules so specialized and “JSON-only” music agents execute independently when needed.
    • Improved batching consistency for compatible tracker agents.
  • Tests

    • Added regression coverage to verify retry-agent connection caching behavior.
    • Added regression coverage validating tracker-agent batching into a single combined provider request.

🔄 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/3784 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/18/2026 **Status:** ✅ Merged **Merged:** 7/18/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/3783-batch-tracker-retries` --- ### 📝 Commits (3) - [`a87fcbc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a87fcbc1e6a39f518b98d41498d6c53c8b1eafc5) chore: start tracker agent batching fix - [`9490f53`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9490f5339254fea19fbf282b79f56c3978a4f1d7) fix: batch same-connection agents reliably - [`c758836`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c7588362278195caa12b72908f8acf83d7b5fc09) fix: address agent batching review ### 📊 Changes **5 files changed** (+159 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+13 -7) 📝 `packages/server/src/services/agents/agent-executor.ts` (+0 -1) 📝 `packages/server/src/services/generation/agent-resolution.ts` (+16 -16) 📝 `scripts/regressions/open-issues.regression.ts` (+7 -0) 📝 `scripts/regressions/roleplay-streaming.regression.ts` (+123 -0) </details> ### 📄 Description ## Linked issue Closes #3783 ## Why this change - Compatible agents could be split into separate paid-model requests even when they shared a connection and model. Retry resolution recreated provider wrappers per saved agent, ordinary generation did the same for direct chat-connection fallbacks, and Expression Engine was explicitly excluded from batching. ## What changed - Reuse request-scoped provider resolutions for every saved retry agent sharing a connection, including default, explicit, and local-sidecar connections. - Reuse the ordinary generation wrapper when multiple agents inherit the chat connection directly. - Allow Expression Engine to participate in compatible agent batches. - Add regression proof that Expression Engine, World State, and Background make one provider call with one `Agent Batch (3)` debug request/response pair. ## 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 - `pnpm regression:roleplay` — passed. The controlled provider fixture asserts one provider call, three successful logical results, and one batch debug request/response pair. - `pnpm regression:issues` — passed sequentially. Its expected simulated storage errors remain part of the passing fixtures. - `pnpm check` — passed after the final implementation. - No live paid-provider call was made; provider request-count behavior was verified with the deterministic regression fixture. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) No docs or release metadata changes are needed for this server-side orchestration fix. ## UI evidence (if applicable) Not applicable; no UI files changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved reliability by reusing cached retry agent connection resolutions per connection ID. - Enhanced agent connection provider resolution by caching even fallback cases when no connection ID is present. - Broadened isolation rules so specialized and “JSON-only” music agents execute independently when needed. - Improved batching consistency for compatible tracker agents. - **Tests** - Added regression coverage to verify retry-agent connection caching behavior. - Added regression coverage validating tracker-agent batching into a single combined provider request. <!-- 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:07:04 +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#6099
No description provided.