Repository navigation
fix(apollo-react): mint new guardrail ids as uuids [AL-672] - #1464
apetraru-uipath wants to merge 1 commit into
Conversation
Agents reads a tool guardrail policy id as a Guid and copies a tool-scoped guardrail into its tool's policies under the same id, so the old "guardrail-<ts>-<rand>" ids broke deployed agents. Save as new now hands the copy a fresh id as well, so Agents' fork no longer shares the original's id (Flow already mints its own). Edited guardrails keep their existing ids, so agents saved with a legacy tool policy id still need the Agents backend to accept non-GUID ids. Consumers asserting the old prefix (Flow's DeterministicGuardrailsBuilder.test.tsx) need updating when they bump. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues in the focused ID changes or accompanying tests; tests were not rerun.
No open issues 🎉
What changed in this PR
Updates Apollo React guardrail IDs to UUIDs compatible with Agents’ GUID parsing and prevents “Save as new” copies from sharing the original’s ID.
Changes:
- Generates v4 UUIDs using
crypto.randomUUID(), with acrypto.getRandomValues()fallback. - Assigns fresh IDs to copies in both builders while preserving IDs during normal edits.
- Updates regression tests and documents the ID contract.
| File | Description |
|---|---|
packages/apollo-react/src/canvas/components/Guardrails/README.md |
Documents new, copied, and edited guardrail ID behavior. |
packages/apollo-react/src/canvas/components/Guardrails/guardrail-builder.tsx |
Generates a fresh ID for “Save as new.” |
packages/apollo-react/src/canvas/components/Guardrails/guardrail-builder.test.tsx |
Updates save and copy assertions to expect UUIDs. |
packages/apollo-react/src/canvas/components/Guardrails/custom-guardrail-builder.tsx |
Generates a fresh ID for custom guardrail copies. |
packages/apollo-react/src/canvas/components/Guardrails/custom-guardrail-builder.test.tsx |
Checks UUIDs for new and copied custom guardrails. |
packages/apollo-react/src/canvas/components/Guardrails/custom-builder-utils.test.ts |
Expects UUIDs in default custom guardrails. |
packages/apollo-react/src/canvas/components/Guardrails/builder-utils.ts |
Implements v4 UUID generation and fallback. |
packages/apollo-react/src/canvas/components/Guardrails/builder-utils.test.ts |
Covers UUID format, uniqueness, and deterministic fallback output. |
Review effort: Balanced
Dependency License Review
License distribution
Excluded packages
|
📦 Dev Packages
|
📊 Coverage + size by packagePer-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.
"Coverage" is each package's own |
Storybook visual diffBaseline is the deployed main Storybook, so changes merged to main after this branch was last updated can also appear here. Logs Updated (PT): Oct 23, 2026, 10:13:56 AM |
What changed?
AL-672.
generateGuardrailId()mintedguardrail-<base36 time>-<random>ids. Agents copies a Tool-scoped guardrail, under the same id, into its tool'sguardrail.policies[], and the Agents backend parses that id as a GUID. So agents built with the Apollo builder (on in alpha) couldn't be loaded once deployed (Agent.PackageDeserialization), and their debug and eval starts returned 400.generateGuardrailId()now returns an RFC 4122 v4 UUID:crypto.randomUUID()when it exists, otherwise built fromcrypto.getRandomValues(randomUUIDis only defined in secure contexts). Its name, export andstringtype are unchanged.GuardrailBuilderandCustomGuardrailBuilder. Before, the copy kept the original's id, so the Agents host ended up with two guardrails sharing one id. That id is also used as the list key and the dnd id. Flow already mints its own id for the fork, so nothing changes there. The JSDoc and the README contract note say so.Consumers: Flow's
DeterministicGuardrailsBuilder.test.tsxasserts/^guardrail-/and needs a UUID regex when it bumps. Agents pins7.9.0exactly and will bump in a follow-up.How has this been tested?
getRandomValuesfallback, which is deterministic with fixed bytes and an exact expected UUID (5 mutants of the version/variant bits all fail it); and Save as new passing a fresh id in both builders.vitest --run src/canvas/components/Guardrails: 46 files, 1106 tests passed.@uipath/apollo-reactsuite: 4506 passed and 2 failed. The two failures (aJsonTree.importtimeout and one other) also fail on a cleanmain.lint,format:check,build(rslib dts) andtsc --noEmitare clean, and commitlint passes.Labelled
dev-packagesso Agents can try the preview build before release.🤖 Generated with Claude Code