Align TrueForge agent names to hyphen-only 2–64 char and migration to enforce hyphen-only naming convention - #536
Align TrueForge agent names to hyphen-only 2–64 char and migration to enforce hyphen-only naming convention#536bhaveshpatel640 wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 123a95e 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
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 91598c9. Configure here.
| 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.
Migration skips schedule name FK
High Severity
The hyphen-only migration updates agent.name and denormalized session.agent_name but never rewrites schedule.agent_name. schedule_agent_name_fk references agent(tenant_id, name) with ON DELETE CASCADE only, so renaming a parent that still has schedules fails immediately. Any tenant with a dotted or underscored agent that owns a schedule cannot finish this migration, and startup/upgrade stops.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 91598c9. Configure here.
… enforce hyphen-only naming convention
91598c9 to
a0c3c76
Compare


Align TrueForge agent names to hyphen-only 2–64 char and migration to enforce hyphen-only naming convention
Summary
Closes #
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 in-place renames can break integrations that still reference old agent names; collision suffixes may yield non-obvious names at the 64-character limit.
Overview
Introduces a dedicated
AgentNameOpenAPI/Zod type (lowercase, 2–64 chars, hyphens only—no.or_) and wires it through agent create/list APIs, scheduleagent_namefields, and session agent-by-name references.ResourceNameis unchanged for other resources (e.g. schedule names).Adds an irreversible Postgres/SQLite migration that rewrites existing agent names containing
.or_viaplanAgentNameHyphenRenames(hyphenate, per-tenant collision suffixes, 64-char truncation) and updates denormalizedsession.agent_name. NewPOST /agentsrequests with dotted or underscored names return 400. SDK and OpenAPI specs are regenerated to useAgentName.Reviewed by Cursor Bugbot for commit 123a95e. Bugbot is set up for automated code reviews on this repo. Configure here.