Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix: ignore empty needs-input sentinel

0xTidalBore8d8f304e0fe3
diff --git a/server/runtime-coordinator.test.ts b/server/runtime-coordinator.test.ts
index 15fc89184e..08276932e3 100644
--- a/server/runtime-coordinator.test.ts
+++ b/server/runtime-coordinator.test.ts
@@ -182,6 +182,16 @@ describe("needsInputQuestion", () => {
expect(needsInputQuestion("NEEDS INPUT:")).toBeUndefined();
expect(needsInputQuestion("")).toBeUndefined();
expect(needsInputQuestion("Done.")).toBeUndefined();
+ expect(needsInputQuestion("NEEDS INPUT: none")).toBeUndefined();
+ expect(needsInputQuestion("NEEDS INPUT: none.")).toBeUndefined();
+ expect(needsInputQuestion("NEEDS INPUT: NONE! \n\n")).toBeUndefined();
+ expect(needsInputQuestion("NEEDS INPUT: none.\nDefault: proceed")).toBeUndefined();
+ });
+
+ it("preserves actual questions and defaults", () => {
+ expect(needsInputQuestion("NEEDS INPUT: none?")).toBe("none?");
+ expect(needsInputQuestion("NEEDS INPUT: none of the accounts work; which one?")).toBe("none of the accounts work; which one?");
+ expect(needsInputQuestion("NEEDS INPUT: Which account?\nDefault: staging")).toBe("Which account?\nDefault: staging");
});
});
diff --git a/server/runtime-coordinator.ts b/server/runtime-coordinator.ts
index e30c31f0d6..bfc52eaa3b 100644
--- a/server/runtime-coordinator.ts
+++ b/server/runtime-coordinator.ts
@@ -82,7 +82,9 @@ export function needsInputQuestion(text: string): string | undefined {
const at = /^default:/i.test(lines[last]!.trim()) ? filled(last - 1) : last;
const line = at < 0 ? "" : lines[at]!.trim();
if (!NEEDS_INPUT.test(line)) return undefined;
- const question = [line.slice("NEEDS INPUT:".length), ...lines.slice(at + 1)].join("\n").trim();
+ const value = line.slice("NEEDS INPUT:".length).trim();
+ if (/^none(?:[.!])?$/i.test(value)) return undefined;
+ const question = [value, ...lines.slice(at + 1)].join("\n").trim();
return question || undefined;
}