Skip to content

Align TrueForge agent names to hyphen-only 2–64 char and migration to enforce hyphen-only naming convention - #536

Draft
bhaveshpatel640 wants to merge 2 commits into
mainfrom
AGE-2065
Draft

Align TrueForge agent names to hyphen-only 2–64 char and migration to enforce hyphen-only naming convention#536
bhaveshpatel640 wants to merge 2 commits into
mainfrom
AGE-2065

Conversation

@bhaveshpatel640

@bhaveshpatel640 bhaveshpatel640 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

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 AgentName OpenAPI/Zod type (lowercase, 2–64 chars, hyphens only—no . or _) and wires it through agent create/list APIs, schedule agent_name fields, and session agent-by-name references. ResourceName is unchanged for other resources (e.g. schedule names).

Adds an irreversible Postgres/SQLite migration that rewrites existing agent names containing . or _ via planAgentNameHyphenRenames (hyphenate, per-tenant collision suffixes, 64-char truncation) and updates denormalized session.agent_name. New POST /agents requests with dotted or underscored names return 400. SDK and OpenAPI specs are regenerated to use AgentName.

Reviewed by Cursor Bugbot for commit 123a95e. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 123a95e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@truefoundry/trueforge Patch

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

@bhaveshpatel640
bhaveshpatel640 force-pushed the AGE-2065 branch 2 times, most recently from a62baaa to 8b89256 Compare September 1, 2026 12:09
Comment thread packages/trueforge/src/db/planAgentNameHyphenRenames.ts
Comment thread packages/trueforge/src/db/planAgentNameHyphenRenames.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 91598c9. Configure here.

@bhaveshpatel640
bhaveshpatel640 marked this pull request as draft September 1, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants