fix: an answer to a blocked agent goes ahead of the queue

Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
FactorandOvis Fast committed 2026-11-19 12:19:54 +01:00
1 parent f3250e594e
commit e6afb3ebf9
3 files changed
+50 -5

No files matched your search

+19
View File
@@ -81,3 +81,22 @@ test("stillSameAgent: only when the field and the focus are on one agent", () =>
assert.equal(stillSameAgent({ before: "", after: "", target: "" }), false);
assert.equal(stillSameAgent({ before: "", after: "t2", target: "t2" }), false);
});
import { directSendBlocked } from "../mod/ovis-composer/view.js";
test("directSendBlocked: who must wait behind the queue", () => {
const queue = [{ state: "queued" }];
// an answer to a blocked agent goes ahead of the queue
assert.equal(directSendBlocked({ draining: false, mode: "auto", status: "blocked", queue }), false);
// an idle agent with a queue: the new message waits at the end
assert.equal(directSendBlocked({ draining: false, mode: "auto", status: "idle", queue }), true);
assert.equal(directSendBlocked({ draining: false, mode: "auto", status: "done", queue }), true);
// Ctrl+Enter is the person's own order
assert.equal(directSendBlocked({ draining: false, mode: "now", status: "idle", queue }), false);
// a message on the wire always goes first
assert.equal(directSendBlocked({ draining: true, mode: "now", status: "blocked", queue: [] }), true);
assert.equal(directSendBlocked({ draining: true, mode: "auto", status: "idle", queue }), true);
// nothing waits
assert.equal(directSendBlocked({ draining: false, mode: "auto", status: "idle", queue: [] }), false);
assert.equal(directSendBlocked({ draining: false, mode: "auto", status: "idle", queue: [{ state: "held" }] }), false);
});