Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🛌 test: Poll Instead of Sleeping for Dead Subagent Owner Expiry (#16144)
lia-by-librechat[bot]a2a5ff708ab0
diff --git a/packages/api/src/agents/subagentTaskRouting.spec.ts b/packages/api/src/agents/subagentTaskRouting.spec.tsindex 21981e21e4..0c7ef0796f 100644--- a/packages/api/src/agents/subagentTaskRouting.spec.ts+++ b/packages/api/src/agents/subagentTaskRouting.spec.ts@@ -549,9 +549,24 @@ describe('RedisSubagentTaskControlTransport', () => {await liveOwner.registerTask('scope-1', liveTask.taskId, 20);await deadOwner.destroy();- await new Promise<void>((resolve) => setTimeout(resolve, 35));-- await expect(requester.list('scope-1')).resolves.toEqual([liveTask]);+ /** The dead owner's entry lapses on its own TTL while the live owner's heartbeat+ * re-registers its entry against that same TTL, so a runner that stalls past 20ms+ * can find both gone for one beat. Poll until the directory settles rather than+ * asserting on a single sleep. */+ let listed: SubagentTaskSnapshot[] = [];+ for (let attempt = 0; attempt < 100 && listed.length === 0; attempt += 1) {+ await new Promise<void>((resolve) => setTimeout(resolve, 5));+ try {+ listed = await requester.list('scope-1');+ } catch (error) {+ /** The dead owner is still registered, so the request routes to a process that+ * answers nothing. Anything else is a real failure. */+ if (!(error instanceof SubagentTaskOwnerUnavailableError)) {+ throw error;+ }+ }+ }+ expect(listed).toEqual([liveTask]);await Promise.all([liveOwner.destroy(), requester.destroy()]);});