Constrain agent names to hyphen-only 2–64 and migrate ./_ names - #536
Constrain agent names to hyphen-only 2–64 and migrate ./_ names#536bhaveshpatel640 wants to merge 10 commits into
Conversation
🦋 Changeset detectedLatest commit: d9217da The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
22b6e2a to
5229921
Compare
a62baaa to
8b89256
Compare
ccc20d0 to
c381c0a
Compare
91598c9 to
a0c3c76
Compare
b442af5 to
1081bee
Compare
8bd15a3 to
d1879c2
Compare
9927e2b to
a569517
Compare
ae2ac25 to
50d82db
Compare
50d82db to
babe75c
Compare
b9f437a to
561a438
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dd2b040. Configure here.
| UPDATE schedule | ||
| SET agent_name = ${rename.to} | ||
| WHERE tenant_id = ${rename.tenant_id} AND agent_name = ${rename.from} | ||
| `.execute(db); |
There was a problem hiding this comment.
Remote TrueFoundry agents stay unrenamed
Medium Severity
The migration rewrites only local agent.name (and denormalized session/schedule copies). In TrueFoundry mode, putRemoteAgent is keyed by name and does not receive external_id, so the next agent update PUTs the new local name and can create a new ServiceFoundry agent, orphan the old remote, and drop MCP grants bound to it.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit dd2b040. Configure here.


Summary
Align TrueForge agent names to hyphen-only 2–64 char and migration to enforce hyphen-only naming convention
Closes AGE-2065
Changes
How was this tested?
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
Medium Risk
Irreversible data migration renames live agent identifiers and denormalized references; API clients can no longer create agents with
.or_in names.Overview
Introduces a dedicated
AgentNametype (OpenAPI, SDK, and Zod) for agent registry identifiers: 2–64 lowercase characters, hyphens only between the leading letter and trailing alphanumeric. Agent create/list, schedules’agent_name, and session name refs now validate against this stricter rule instead of genericResourceName(which still allows.and_for other resources like schedule names).Create agent requests with dotted or underscored names are rejected; reserved names (
tfg,trueforge) behavior is unchanged.A one-way Postgres/SQLite migration rewrites existing agents whose names contain
.or_by hyphenating and appending a random 4-hex suffix (with truncation to fit 64 chars), and updates denormalizedsession.agent_nameandschedule.agent_nameto match. Original names are not preserved.Unit tests cover
AgentNameSchema, rename planning, and API rejection of invalid agent names.Reviewed by Cursor Bugbot for commit d9217da. Bugbot is set up for automated code reviews on this repo. Configure here.