diff --git a/src/lib/cloudAgent/baseAgent.ts b/src/lib/cloudAgent/baseAgent.ts index 9f5689b90b..26c2defb59 100644 --- a/src/lib/cloudAgent/baseAgent.ts +++ b/src/lib/cloudAgent/baseAgent.ts @@ -86,10 +86,10 @@ export abstract class CloudAgentBase { } protected generateTaskId(): string { - return `task_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`; + return `task_${Date.now()}_${crypto.randomUUID().replace(/-/g, "").substring(0, 9)}`; } protected generateActivityId(): string { - return `act_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`; + return `act_${Date.now()}_${crypto.randomUUID().replace(/-/g, "").substring(0, 9)}`; } } diff --git a/tests/unit/antigravity-discovery-bootstrap.test.ts b/tests/unit/antigravity-discovery-bootstrap.test.ts index 3d0aa82f98..9f211e65e9 100644 --- a/tests/unit/antigravity-discovery-bootstrap.test.ts +++ b/tests/unit/antigravity-discovery-bootstrap.test.ts @@ -152,7 +152,7 @@ describe("ensureAntigravityProjectAssigned", () => { const mockFetch = async (url: string, _init?: RequestInit): Promise => { hitUrls.push(url); - if (url.includes("daily-cloudcode-pa.googleapis.com")) { + if (new URL(url).hostname === "daily-cloudcode-pa.googleapis.com") { // First URL fails return new Response("not found", { status: 404 }); }