fix(mantis): validate telegram driver before lease

This commit is contained in:
Ayaan Zaidi
2026-05-11 14:11:27 +05:30
parent 4ddccbd28d
commit 96d4dd68da
4 changed files with 34 additions and 7 deletions

View File

@@ -51,7 +51,7 @@ describe("Mantis Telegram Desktop proof workflow", () => {
const agent = workflowStep("Run Codex Mantis Telegram agent");
expect(agent.env?.OPENCLAW_TELEGRAM_USER_DRIVER_SCRIPT).toBe(
"scripts/e2e/telegram-user-driver.py",
"${{ github.workspace }}/scripts/e2e/telegram-user-driver.py",
);
expect(agent.env?.OPENCLAW_TELEGRAM_USER_CRABBOX_BIN).toBe("/usr/local/bin/crabbox");
expect(agent.env?.CRABBOX_COORDINATOR).toContain(
@@ -66,4 +66,24 @@ describe("Mantis Telegram Desktop proof workflow", () => {
"OPENCLAW_TELEGRAM_USER_CRABBOX_BIN OPENCLAW_TELEGRAM_USER_CRABBOX_PROVIDER OPENCLAW_TELEGRAM_USER_DRIVER_SCRIPT",
);
});
it("checks the Telegram user driver before leasing credentials", () => {
const proofScript = readFileSync(PROOF_SCRIPT, "utf8");
const startSession = proofScript.slice(
proofScript.indexOf("async function startSession"),
proofScript.indexOf("async function sendSessionProbe"),
);
const defaultProof = proofScript.slice(proofScript.indexOf("async function main"));
expect(startSession).toContain("requireUserDriverScript(opts);");
expect(startSession).toContain("leaseCredential({ localRoot, opts, root })");
expect(defaultProof).toContain("requireUserDriverScript(opts);");
expect(defaultProof).toContain("leaseCredential({ localRoot, opts, root })");
expect(startSession.indexOf("requireUserDriverScript(opts);")).toBeLessThan(
startSession.indexOf("leaseCredential({ localRoot, opts, root })"),
);
expect(defaultProof.indexOf("requireUserDriverScript(opts);")).toBeLessThan(
defaultProof.indexOf("leaseCredential({ localRoot, opts, root })"),
);
});
});