[PR #4] [CLOSED] Fix /retry-agents route failing when connectionId === "random" #4383

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4
Author: @Copilot
Created: 3/9/2026
Status: ❌ Closed

Base: release/1.2.0 ← Head: copilot/sub-pr-1-another-one


📝 Commits (2)

  • fdf0ac7 Initial plan
  • bdde288 Fix /retry-agents route to handle connectionId === "random"

📊 Changes

1 file changed (+7 additions, -1 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+7 -1)

📄 Description

The /retry-agents route passed chat.connectionId directly to getWithKey(), causing a "No connection configured" error for chats using the random connection pool (connectionId === "random").

Changes

  • generate.routes.ts — /retry-agents connection resolution: Added the same random-pool resolution logic already present in the main /generate route. Before calling getWithKey(), resolve "random" to a concrete connection ID by sampling from conns.listRandomPool().
// Before
const connId = chat.connectionId;
const conn = connId ? await conns.getWithKey(connId) : null;
if (!conn) throw new Error("No connection configured");

// After
let connId = chat.connectionId;
if (connId === "random") {
  const pool = await conns.listRandomPool();
  if (!pool.length) throw new Error("No connections are marked for the random pool");
  const picked = pool[Math.floor(Math.random() * pool.length)];
  connId = picked.id;
}
const conn = connId ? await conns.getWithKey(connId) : null;
if (!conn) throw new Error("No connection configured");

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


🔄 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/4 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 3/9/2026 **Status:** ❌ Closed **Base:** `release/1.2.0` ← **Head:** `copilot/sub-pr-1-another-one` --- ### 📝 Commits (2) - [`fdf0ac7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fdf0ac74cdab5954c18047343e352cf608abdcd4) Initial plan - [`bdde288`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bdde2884eadf0591ece5b4623669c7c65dbaad4c) Fix /retry-agents route to handle connectionId === "random" ### 📊 Changes **1 file changed** (+7 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+7 -1) </details> ### 📄 Description The `/retry-agents` route passed `chat.connectionId` directly to `getWithKey()`, causing a "No connection configured" error for chats using the random connection pool (`connectionId === "random"`). ## Changes - **`generate.routes.ts` — `/retry-agents` connection resolution**: Added the same random-pool resolution logic already present in the main `/generate` route. Before calling `getWithKey()`, resolve `"random"` to a concrete connection ID by sampling from `conns.listRandomPool()`. ```ts // Before const connId = chat.connectionId; const conn = connId ? await conns.getWithKey(connId) : null; if (!conn) throw new Error("No connection configured"); // After let connId = chat.connectionId; if (connId === "random") { const pool = await conns.listRandomPool(); if (!pool.length) throw new Error("No connections are marked for the random pool"); const picked = pool[Math.floor(Math.random() * pool.length)]; connId = picked.id; } const conn = connId ? await conns.getWithKey(connId) : null; if (!conn) throw new Error("No connection configured"); ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:07:07 +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#4383
No description provided.