Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(person-first): do not queue a steered message again once the engine has read it
ARAYN70111128b084f0da
diff --git a/server/host/person-first.test.ts b/server/host/person-first.test.tsindex 22848274ba..ff39fde0e9 100644--- a/server/host/person-first.test.ts+++ b/server/host/person-first.test.ts@@ -78,6 +78,20 @@ describe("the person's message goes first", () => {expect(h.requeued).toEqual([]);});+ it("does not queue a steered message again that the engine already read, when the next call runs long without text", async () => {+ const h = harness();+ h.turnStarted();+ h.toolStarted("first");+ await h.advance(10_000);+ h.first.wait(T, h.steered());+ await h.advance(5_000);+ h.toolDone("first");+ h.toolStarted("second", "npm test");+ await h.advance(PERSON_FIRST_MS);+ expect(h.stops).toHaveLength(1);+ expect(h.requeued).toEqual([]);+ });+it("stops the call when it reaches its minute with the message still unread", async () => {const h = harness();h.turnStarted();diff --git a/server/host/person-first.ts b/server/host/person-first.tsindex d10c6290f8..7957737aaa 100644--- a/server/host/person-first.ts+++ b/server/host/person-first.ts@@ -162,6 +162,9 @@ export function createPersonFirst(deps: PersonFirstDeps) {if (event.itemType !== "tool" || !watch) return;if (event.itemId) watch.tools.delete(event.itemId);watch.read = true;+ // The engine's next step reads a steered message with this result, so queueing it again would run it twice:+ // a long call after this one may still be stopped for the person, but nothing is put back in the queue.+ watch.waits = watch.waits.map((wait): PersonWait => (wait.requeue ? {} : wait));check(threadId);return;}