Agent and App Rename System#
The rename system lets users rename agents, apps, and chat sessions from multiple surfaces in the Agenta UI. The feature was introduced in PR #5202 and a follow-up cache bug was fixed in PR #5330.
Architecture Overview#
The rename system is built around three layers:
EntityIdentitymodule β shared hook and UI primitives used by all rename surfacesEditAppModalβ the rename-and-details dialog triggered from table row menus- Surface integrations β playground header (inline), agents table, app-management table, app-overview page
All rename surfaces share a single API call path and cache invalidation strategy through the useRenameApp hook.
EntityIdentity Module#
Located at web/oss/src/components/EntityIdentity/, this module was added in PR #5202 and exports three items.
useRenameApp hook#
The central piece. It:
- Calls
updateWorkflow(projectId, { id, name, description, flags: { is_application: true } })to persist the rename - Invalidates
invalidateWorkflowsListCache(),mutate(), andinvalidateAppManagementWorkflowQueries()after success - Exposes
isDuplicateName(name, selfId)β case-insensitive guard that checks against the full apps list
All rename surfaces call only renameApp({ id, name }) and optionally supply an onRenamed callback; cache invalidation is centralized in the hook.
AgentNameInline component#
Inline editor used in the playground header.
- Renders the agent name as plain text with a hover-revealed pencil icon
- Enter edit mode by clicking the pencil or double-clicking the name
- Commit with Enter or blur; cancel with Escape
- Shows inline error if the proposed name is a duplicate
- Calls
renameApp(...)then firesonRenamed(newName)so the caller can update local display state immediately
fields.tsx β UI primitives#
Three small presentational components used inside EditAppModal:
FieldLabelβ caption above editable or read-only fieldsCopyRowβ read-only value with a copy-to-clipboard icon (check mark on success)TypeBadgeβ pill displaying app type (Agent / Chat / Completion / Custom workflow)
EditAppModal#
Before PR #5202: EditAppModal.tsx was a lightweight modal accepting appDetails, validating the new name (no duplicates, only letters/numbers/underscore/dash), calling updateAppName(appId, newName), and refreshing via mutate().
After PR #5202 refactor: The modal grows into a rename-and-details view.
- Callers pass only
{ id, name, onRenamed }β detail fields auto-populate fromworkflowArtifactQueryAtomFamily(workflowId) - Editable: name (with duplicate validation), description
- Read-only (with copy): version, created date, slug, workflow ID
- TypeBadge shows app kind in the modal header
The same modal instance is reused across all rename surfaces (home agents table, agents page, app-management, app-overview).
Rename Surfaces#
| Surface | Mechanism |
|---|---|
| Playground header | AgentNameInline β inline hover-pencil or double-click |
| Home "Your Agents" table | Row menu β "Rename" β EditAppModal |
| Agents page table | Row menu β "Rename" β EditAppModal |
| App-management table | Row menu β "Rename" β EditAppModal (active apps only; archived apps have no rename action) |
| App-overview page | 3-dot menu β "Rename" β EditAppModal (re-enabled in PR #5202) |
The playground header maintains a local displayAgentName state for instant UI feedback before the cache refresh completes.
Cache Invalidation Bug and Fix (PR #5330)#
Bug: After renaming from the app-overview page, the page title stayed stale β the backend updated correctly, but the overview kept showing the old workflow name.
Root cause: useRenameApp invalidated the app-list and artifact caches but not the separate ["workflows", "detail", projectId, workflowId] query key that the overview page reads from.
Fix (PR #5330): Two files changed:
useRenameApp.tsβ now also callsinvalidateWorkflowCache(id)after the renamestore.ts(agenta-entitiespackage, workflow state) βinvalidateWorkflowCache(workflowId)enhanced to readworkflowProjectIdAtomfrom the store and add an exact-match invalidation for["workflows", "detail", projectId, workflowId]
This ensures that any React Query subscriber on the detail view immediately sees the updated name without a manual reload.
Cache keys invalidated after rename#
| Cache key | Purpose |
|---|---|
["workflows", "apps"] | App list in management and home pages |
["workflows", "artifact", workflowId] | Per-workflow artifact data |
["workflows", "detail", projectId, workflowId] | Workflow detail / overview page (added in PR #5330) |
Key Files#
| File | Role |
|---|---|
web/oss/src/components/EntityIdentity/useRenameApp.ts | Shared rename hook β API call + cache invalidation |
web/oss/src/components/EntityIdentity/AgentNameInline.tsx | Inline rename editor for playground header |
web/oss/src/components/EntityIdentity/fields.tsx | FieldLabel, CopyRow, TypeBadge UI primitives |
EditAppModal.tsx | Rename-and-details modal (refactored in PR #5202) |
web/packages/agenta-entities/src/workflow/state/store.ts | invalidateWorkflowCache() β workflow detail cache invalidation |
web/oss/src/components/Playground/Components/PlaygroundHeader/index.tsx | Uses AgentNameInline for inline rename |
web/oss/src/components/pages/app-management/modals/EditAppModal/index.tsx | Refactored modal (post-PR #5202) |
Related PRs: