Skip to content

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

🧪 test: Wait for the Durable Task Input Before Reserving a Child Control (#15901)

Danny Avila14c5e8d8cc28
diff --git a/packages/api/src/agents/subagentThreads.spec.ts b/packages/api/src/agents/subagentThreads.spec.ts
index 8a618d7dcd..1d44c2f3cf 100644
--- a/packages/api/src/agents/subagentThreads.spec.ts
+++ b/packages/api/src/agents/subagentThreads.spec.ts
@@ -4278,12 +4278,16 @@ describe('SubagentThreadTaskStore', () => {
);
const taskId = requireAccepted(started).task.taskId;
const threadId = requireThreadId(started);
- for (let attempt = 0; attempt < 200; attempt += 1) {
- if ((await methods.getConvo(userId, threadId)) != null) {
- break;
- }
- await new Promise<void>((resolve) => setTimeout(resolve, 10));
- }
+ await waitUntil(
+ async () =>
+ (
+ await methods.getMessages(
+ { user: userId, conversationId: threadId, messageId: `${taskId}:user` },
+ '+subagentTask',
+ )
+ ).length === 1,
+ 'the durable task input',
+ );
expect(await methods.getConvo(userId, threadId)).not.toBeNull();
const accepted = await ownerStore.controlTask(