"New item" button visible in work item list when not logged in, leads to broken state on click

Summary

The New item button is visible in the work item list page for unauthenticated (not logged in) users on public projects. Clicking it leads to a broken/weird state because the underlying createWorkItem GraphQL mutation requires authentication.

The expected behavior is that the New item button should be hidden (or replaced with a sign-in prompt) for unauthenticated users, since creating work items requires being signed in.

Steps to reproduce

  1. Open an incognito/private browsing window (ensure you are not signed in to GitLab)
  2. Navigate to a public project's work item list (e.g. https://gitlab.com/gitlab-org/gitlab/-/issues)
  3. Observe the New item button is visible in the list header
  4. Click the New item button

Example https://gitlab.com/components/agents-and-flows/templates/template/-/work_items

image__3_

image__4_

What is the current bug behavior?

  • The New item button is visible to unauthenticated users in the work item list
  • Clicking it leads to a broken/weird state (e.g. an infinite loading spinner or an unhandled error), because the backend rejects the createWorkItem mutation for anonymous users and the frontend does not handle this gracefully

What is the expected correct behavior?

  • The New item button should not be shown to unauthenticated users in the work item list
  • Unauthenticated users should only be able to view work items in public projects, not access creation flows

Relevant logs or screenshots

None provided — please add steps/URL and screenshot if you can reproduce

  • #605427 (closed) — Infinite loading spinner when creating an issue while unauthenticated via work_items/new (downstream consequence of the same root cause: the UI exposes a create path to unauthenticated users that the backend rejects)
Edited by 🤖 GitLab Bot 🤖