fix(cli): reject malformed attach ttl values (#105103)

* fix(cli): reject malformed attach ttl values

* fix(cli): clarify attach ttl grammar
This commit is contained in:
qingminlong
2026-07-12 22:44:44 +08:00
committed by GitHub
parent 5482421f14
commit 4ecc67678d
2 changed files with 15 additions and 4 deletions
+7
View File
@@ -117,6 +117,13 @@ describe("openclaw attach (action)", () => {
expect(gatewayCalls.find((c) => c.method === "attach.grant")).toBeUndefined();
});
it.each(["0x10", "1.5", "1e3"])("rejects malformed --ttl %s before minting", async (ttl) => {
await runAttach("--ttl", ttl, "--print-config");
expect(exitCode).toBe(1);
expect(logs.join("\n")).toContain("--ttl must be a positive integer of milliseconds");
expect(gatewayCalls.find((c) => c.method === "attach.grant")).toBeUndefined();
});
it("rejects an empty --ttl rather than silently defaulting", async () => {
await runAttach("--ttl", "", "--print-config");
expect(exitCode).toBe(1);