Skip to content

Let owners and admins rename the workspace from Settings - #439

Merged
abhishekgahlot2 merged 1 commit into
useagenthq:mainfrom
officialasishkumar:feature/rename-workspace-in-settings
Nov 11, 2026
Merged

abhishekgahlot2 merged 1 commit into
useagenthq:mainfrom
officialasishkumar:feature/rename-workspace-in-settings

Conversation

@officialasishkumar

@officialasishkumar officialasishkumar commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

By opening this pull request you agree to the Contributor License Agreement. On your first pull request a bot asks you to sign it with a one-line comment.

Fixes #285

The welcome page says the workspace name "can change later in Settings", but Settings, General showed the name as read-only text. Once the workspace had been renamed, or had a second member, the welcome form was gone and the app had no way left to rename it.

What changed

  • Settings, General, Workspace name (frontend/app/(workspace)/settings/general-card.tsx): owners and admins now get an inline field with Save. Members still see the name as plain text. The role comes from the same /api/team/workspaces read the card already used, and the check is the existing canManageTeam.
    • Save calls the existing renameWorkspace from team-api.ts, the same call the welcome page makes, with the trimmed name. It stays off for a blank or unchanged name.
    • When the server refuses, its own message shows under the field. The field is marked invalid and points at that message through aria-describedby.
    • After a save the field shows the name exactly as saved, with "Saved." under it. If you keep typing while the save is in flight, your text stays in the field and "Saved." does not show, the same way the welcome page handles it.
  • User menu shows the new name without a reload (frontend/lib/auth.ts, frontend/components/shell/user-menu.tsx): the menu reads the workspace list once per session. lib/auth.ts now has a small workspacesChanged / onWorkspacesChanged signal next to listWorkspaces. The General card fires it after a successful rename, and the user menu reads the list again when it hears it. Because the next read has defaultName: false, the menu's "Set up your workspace" entry also goes away after the first rename.
  • Docs: the General card on the Settings page (docs-site/docs/product/settings.mdx) now says owners and admins rename the workspace there.

No backend change: better-auth's default access control already lets owners and admins update the organisation and refuses members.

Tests

  • general-card.test.tsx: a member gets the name as text with no input or Save. An owner and an admin each get the field holding the current name, plus Save. activeWorkspace keeps the id and role and still treats a list without the active workspace as a failed read.

  • New general-card.interaction.test.tsx mounts the card next to the real UserMenu under happy-dom. It uses the real team-api and auth helpers over a stubbed fetch and covers:

    • an owner's Save posts { organizationId, data: { name: "Acme Robotics" } } for " Acme Robotics ", shows "Saved.", and the user menu requests /api/team/workspaces once more
    • a 403 shows "You are not allowed to update this organization" under the field, and nothing re-reads the list
    • text typed during a held save stays in the field without "Saved."
    • a blank or unchanged name is never sent
    • a member gets no field

    Without the change, four of these five fail. With only the user menu change reverted, the "reads the list again" assertion fails.

Checks, with Bun 1.3.14:

  • cd frontend && bun run test: 1938 pass, 0 fail
  • cd frontend && bun run typecheck: passes
  • cd frontend && bun run lint: no new findings (the one warning in settings/ is the existing one in theme-toggle.tsx)
  • cd frontend && bun run build: passes
  • bun test scripts/agent-docs.test.ts: passes

End to end

I ran a real backend (dev mode, on its own pgvector Postgres) and a production build of the frontend (next start), then drove them with Playwright:

  • I signed up a new account and opened /settings. The field held "Ada's workspace" and Save was off. I typed Acme Robotics and pressed Save. The row showed "Saved.", the user menu fetched /api/team/workspaces once more, and without a reload the opened account menu listed "Acme Robotics / Owner / Selected". /api/team/workspaces returned Acme Robotics.
  • I added a second account to that workspace as a member and opened /settings as them. The row showed "Acme Robotics" as text, with no field and no Save. A direct POST /api/auth/organization/update from that session returned 403 {"message":"You are not allowed to update this organization"}, the message the field shows to anyone the server refuses.
  • Against the same backend, an admin's rename returned 200.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The welcome page says the workspace name can change later in Settings,
but the General card showed it as read-only text. Once the workspace had
been renamed or had a second member, the welcome form was gone and the
app offered no way to rename it.

The Workspace name row in Settings, General is now a field with Save for
owners and admins, using the same renameWorkspace call as the welcome
page. Save sends the trimmed name, stays off for a blank or unchanged
name, and shows the server's own reason under the field when the rename
is refused. Text typed while a save is in flight stays in the field, and
"Saved." only shows when the field holds the saved name. Members still
see the name as plain text; the server refuses their rename either way.

The user menu reads the workspace list once per session, so a rename
used to show there only after a reload. lib/auth.ts now has a small
workspacesChanged signal: the General card fires it after a successful
rename and the user menu reads the list again when it hears it, so the
new name shows in the menu straight away.

The Settings docs page now says owners and admins rename the workspace
there.

Fixes useagenthq#285
@abhishekgahlot2
abhishekgahlot2 merged commit 8a39aa6 into useagenthq:main Nov 11, 2026
22 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 11, 2026
@abhishekgahlot2

Copy link
Copy Markdown
Contributor

Merged, thanks @officialasishkumar. Renaming the workspace from Settings was overdue, and the owner/admin check sits on the server, so the UI can't be talked past.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let admins rename the workspace from Settings

2 participants