CaroFernando commented on code in PR #8753:
URL: https://github.com/apache/texera/pull/8753#discussion_r4343792135


##########
agent-service/src/server.ws.spec.ts:
##########
@@ -299,6 +299,48 @@ describe(`WS ${API}/agents/:id/react`, () => {
     expect(resting.state).toBe("AVAILABLE");
   });
 
+  test("a prompt sent while a run is in flight is rejected, not interleaved 
(#8711)", async () => {
+    const id = await createAgent();
+    const agent = _getAgentForTests(id)! as any;
+
+    // Pin an initial warehouse so we can assert the busy-rejected prompt below
+    // never reaches setDelegateWarehouse and re-points it mid-run (#8711).
+    agent.setDelegateConfig({ userToken: "t", workflowId: 1, warehouseId: 7 });
+
+    let release!: () => void;
+    const gate = new Promise<void>(r => (release = r));
+    let callCount = 0;
+    agent.sendMessage = async function (this: any) {
+      callCount++;
+      this.state = "GENERATING";
+      await gate;
+      this.state = "AVAILABLE";
+      return { response: "done", messages: [], usage: { inputTokens: 0, 
outputTokens: 0, totalTokens: 0 }, stopped: false };

Review Comment:
   Applied, bun run format:check is clean. bun test passes 315 tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to