Skip to content

feat!: hide Coder Tasks behind the enable-ai-tasks flag - #28008

Draft
david-fraley wants to merge 9 commits into
mainfrom
dfraley/hide-tasks-behind-flag
Draft

feat!: hide Coder Tasks behind the enable-ai-tasks flag#28008
david-fraley wants to merge 9 commits into
mainfrom
dfraley/hide-tasks-behind-flag

Conversation

@david-fraley

@david-fraley david-fraley commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Coder Tasks is being withdrawn from the product. This hides it rather than removing it: no Tasks implementation code is deleted, every user facing surface is gated behind a deployment value that defaults to off. Docs are removed outright.

Warning

Breaking change. Two things break on upgrade. Customers need to be notified.

1. Coder Tasks disappears. It is off by default, so on upgrade every deployment loses the Tasks tab, the /tasks URLs, the /api/v2/tasks and /api/experimental/tasks endpoints, and the coder task CLI commands. Existing tasks and their workspaces are untouched in the database, they are just unreachable. A deployment that needs Tasks back can set CODER_ENABLE_AI_TASKS=true.

2. --hide-ai-tasks is deleted. Anyone who set it in a YAML config file (client.hideAITasks) or passed --hide-ai-tasks on the command line will find that Coder refuses to start, because serpent rejects options it does not recognise. The fix is to delete the line. Setting it as the CODER_HIDE_AI_TASKS environment variable is ignored silently and is safe.

The flag

Property Value
Field DeploymentValues.EnableAITasks
Flag --enable-ai-tasks
Env CODER_ENABLE_AI_TASKS
YAML enableAITasks
Default false
Hidden true

Hidden: true keeps the option out of docs/reference/cli/server.md and docs/admin/setup/configuration-reference.md, so the flag itself does not advertise Tasks.

--hide-ai-tasks only hid the dashboard tab, which this flag subsumes now that Tasks is off by default, so it is removed rather than deprecated.

What the flag gates

Surface Behaviour when unset
/api/v2/tasks, /api/experimental/tasks Standard route-not-found payload via new httpmw.RouteNotFound()
Web routes /tasks and /tasks/:username/:taskId are not registered, so the URLs 404
Navbar Tasks item hidden
Other UI Tasks sidebar, "View task" on agent rows, Task badge on the workspaces table, task warning in the workspace delete dialog, "Task Sharing" heading, Task Events notification group, Coder Tasks paragraph on the licensing page
Custom roles The task resource is filtered out of the permission editor
CLI The task/tasks command tree is hidden from coder --help and from generated CLI docs

A single ai-tasks-enabled embedded metadata value carries the switch to the frontend, read through useAITasksEnabled(). The Go server always emits the tag, so an absent value means Vite, Storybook or Vitest is serving the app and Tasks stays visible there. This mirrors the existing useAIGatewayEnabled() helper. With HideAITasks gone the old tasks-tab-visible meta was redundant and is removed.

coderdtest.DeploymentValues defaults EnableAITasks to true so the existing Tasks suite keeps exercising the enabled path. TestTasksDisabled covers the off path.

Docs

Static docs cannot be gated, so Tasks is removed from the docs entirely:

  • Narrative pages deleted: ai-coder/tasks.md, tasks-core-principles.md, tasks-lifecycle.md, tasks-migration.md, github-to-tasks.md, plus the orphaned ai-coder/cli.md stub and the Tasks images.
  • agents/tasks-to-chats-migration.md is kept. It is the one page customers still need, so it stays in the manifest under Coder Agents with a warning callout stating that Coder Tasks is deprecated as of Coder v2.36 and that Tasks documentation is only available in previous documentation versions. Its links to the deleted Tasks pages are removed.
  • Generated CLI pages (reference/cli/task*.md) are gone because the command is hidden.
  • reference/api/tasks.md is gone because the swagger annotations were removed from the ten handlers in coderd/aitasks.go. The Tasks endpoints leave the spec entirely, which also drops the task-only definitions (codersdk.Task, TaskState, TasksListResponse and friends) from schemas.md, coderd/apidoc/docs.go and swagger.json: about 2,200 lines of generated reference.
  • The handlers stay registered for deployments that opt back in, so TestEndpointsDocumented would flag them as missing @Router. They are skipped with isTaskEndpoint, alongside the existing isExperimentalEndpoint and isLegacyAIBridgeAlias skips.
  • The Coder Tasks glossary entry and all inbound links across user guides, AI Coder pages and ESR upgrade guides are removed or rewritten, so the weekly link checker stays green.
  • The remaining in-product links to the deleted Tasks pages (TaskPrompt, TaskApps and the licensing page) are unlinked, so nothing in the UI points at a 404.
  • The tasks-docker starter template is deleted (examples/templates/tasks-docker/, its //go:embed line, examples.gen.json, templates init --id enum, generated CLI docs and golden file). It only exists to demo Coder Tasks, so it cannot work on a default deployment.

Two deliberate exceptions:

  • docs/install/releases/esr-2.24-2.29-upgrade.md and esr-2.29-2.34-upgrade.md still mention Tasks. These are historical upgrade guides for operators performing those specific upgrades. Only dead links and forward looking "use Coder Tasks" guidance were removed; deleting the factual record would make the guides wrong.
  • Incidental Tasks fields on other endpoints remain: the deprecated has_ai_task on workspace builds, task in the RBAC resource enum, task_manual_pause/task_resume build reasons, and enable_ai_tasks in DeploymentValues. Those are the shape of existing API responses, not Tasks pages, and changing them changes the API.

Proof

Captured against a live scripts/develop.sh instance, served from the production frontend build on :3000 rather than the Vite dev server, which force-enables the feature.

Flag off (default)

Navbar has no Tasks item:

Navbar without Tasks

/tasks 404s:

Tasks URL 404

/tasks/:username/:taskId 404s:

Task detail URL 404

The custom role permission editor, with advanced permissions shown, has no task resource between tailnet_coordinator and template:

Custom role editor without the task resource

Rendered metadata and API, as an authenticated owner:

ai-tasks-enabled: false

GET /api/v2/tasks            404
GET /api/experimental/tasks  404
GET /api/v2/workspaces       200

Flag on (CODER_ENABLE_AI_TASKS=true)

Tasks returns to the navbar:

Navbar with Tasks

The Tasks page loads:

Tasks page

ai-tasks-enabled: true

GET /api/v2/tasks            200

Screenshots are hosted on the dfraley/tasks-flag-evidence branch to keep them out of this diff.

Known gaps

  • The task RBAC resource still exists on the built-in roles. An earlier revision negated it via rbac.RoleOptions, but built-in roles are process-global state, so a tasks-disabled server poisoned every other server in the same test process. Since every task route 404s, a task grant reaches nothing, so the negation only bought cosmetics. The custom role editor still filters the resource out of the UI.
  • Task notification templates, the agent side task reporting path, telemetry and the database schema are untouched. They are invisible to users and belong with the actual removal.
Implementation plan

Hide Coder Tasks behind a deployment flag

Goal

Make Coder Tasks invisible to users by default, without deleting any Tasks
code. Everything Tasks-related is gated behind a single deployment flag that
defaults to off. Actual code removal is a separate, later change.

Key decisions

  1. New deployment value, default off. Following
    254d1b3a48 (DisableChatSharing), add
    DeploymentValues.EnableAITasks:

    Property Value
    Field EnableAITasks serpent.Bool
    JSON enable_ai_tasks
    Flag --enable-ai-tasks
    Env CODER_ENABLE_AI_TASKS
    YAML enableAITasks
    Default false
    Hidden true

    Hidden: true keeps the option out of docs/reference/cli/server.md and
    docs/admin/setup/configuration-reference.md.

  2. --hide-ai-tasks is deleted. It only hid the dashboard tab, which the
    new flag subsumes now that Tasks is off by default. Naming follows the old
    flag's convention so operators recognise it. This is a breaking change for
    deployments that set it via YAML or command line; customers will be
    notified.

  3. Gate, do not delete. Route trees, nav items, RBAC permissions and CLI
    commands are conditionally registered or conditionally rendered. No Tasks
    implementation code is removed.

  4. Docs are removed outright, except the migration guide. Static docs cannot
    be flag-gated. Narrative Tasks pages and their manifest entries are deleted.
    The Tasks to Chats migration guide is kept, with a deprecation warning
    pointing readers at previous documentation versions for Tasks details.
    Generated CLI docs disappear once the command is hidden. The generated API
    reference goes away by removing the swagger annotations from the handlers,
    with an isTaskEndpoint skip in the swagger verifier because the routes stay
    registered.

Work items

Backend

  • codersdk/deployment.go: add EnableAITasks; delete HideAITasks.
  • coderd/coderd.go:
    • pass AITasksEnabled into the site handler options;
    • gate /api/v2/tasks and /api/experimental/tasks.
  • coderd/httpmw/routenotfound.go: new middleware that answers a whole route
    tree with the standard route-not-found payload.
  • coderd/aitasks.go: remove the swagger annotation blocks.
  • coderd/coderdtest/swaggerparser.go: skip the Tasks routes.
  • site/site.go: add AITasksEnabled and emit the ai-tasks-enabled html
    state value; drop HideAITasks and TasksTabVisible.
  • site/index.html: single ai-tasks-enabled meta tag.
  • cli/task.go: set Hidden: true on the task/tasks command so it drops
    out of coder --help and out of generated CLI docs.
  • coderdtest: default EnableAITasks to true so the existing Tasks test
    suite keeps exercising the enabled path.

Frontend (site/src)

  • hooks/useEmbeddedMetadata.ts: register ai-tasks-enabled, drop
    tasks-tab-visible.
  • New useAITasksEnabled() helper used by every Tasks surface, including the
    navbar.
  • router.tsx: only register /tasks and /tasks/:username/:taskId when
    enabled, so the URLs 404.
  • Gate remaining Tasks surfaces:
    • modules/tasks/TasksSidebar/TasksSidebar.tsx
    • modules/resources/AgentRow.tsx ("View task")
    • modules/workspaces/WorkspaceMoreActions/WorkspaceDeleteDialog.tsx
    • pages/WorkspacesPage/WorkspacesTable.tsx (Task badge)
    • pages/WorkspacePage/WorkspaceActions/ShareButton.tsx
    • pages/UserSettingsPage/NotificationsPage/NotificationsPage.tsx
      (Task Events group)
    • pages/DeploymentSettingsPage/LicensesSettingsPage/ManagedAgentsConsumption.tsx
  • pages/OrganizationSettingsPage/CustomRolesPage/CreateEditRolePageView.tsx:
    filter the task RBAC resource out of the permission editor so the Tasks
    role permissions are not settable.

Docs

Delete and de-manifest:

  • docs/ai-coder/tasks.md
  • docs/ai-coder/tasks-core-principles.md
  • docs/ai-coder/tasks-lifecycle.md
  • docs/ai-coder/tasks-migration.md
  • docs/ai-coder/github-to-tasks.md
  • docs/ai-coder/cli.md
  • docs/reference/api/tasks.md
  • docs/reference/cli/task*.md
  • related images under docs/images/guides/ai-agents/

Keep docs/ai-coder/agents/tasks-to-chats-migration.md in the manifest, add a
v2.36 deprecation warning to it, and drop its links to the deleted Tasks pages.

Delete the tasks-docker starter template and regenerate what references it:

  • examples/templates/tasks-docker/
  • the //go:embed templates/tasks-docker line in examples/examples.go
  • examples/examples.gen.json
  • docs/reference/cli/templates_init.md and
    cli/testdata/coder_templates_init_--help.golden

Scrub inbound references so the weekly link checker stays green:

  • docs/reference/glossary.md
  • docs/user-guides/shared-workspaces.md
  • docs/user-guides/workspace-scheduling.md
  • docs/ai-coder/custom-agents.md
  • docs/ai-coder/agent-compatibility.md
  • docs/ai-coder/ai-governance.md
  • docs/ai-coder/agents/index.md
  • docs/install/releases/esr-2.24-2.29-upgrade.md
  • docs/install/releases/esr-2.29-2.34-upgrade.md

Out of scope

  • Deleting Tasks implementation code, database tables or migrations. The tasks-docker example template is the one exception: it is a demo-only starter template, not implementation code.
  • Task notification templates and the agent-side task reporting path.
  • Historical facts in the ESR upgrade guides.
  • Incidental Tasks fields on other endpoints' payloads and enums.

Generated with Coder Agents on behalf of @david-fraley.

Coder Tasks is being withdrawn from the product. Rather than ripping the
implementation out now, every user-facing Tasks surface is gated behind a
new deployment value that defaults to off.

DeploymentValues.TasksEnabled (--enable-tasks, CODER_ENABLE_TASKS,
enableTasks) is hidden so it stays out of the generated CLI and
configuration reference docs. When it is unset:

- The /api/v2/tasks and /api/experimental/tasks route trees respond with
  the standard route-not-found payload.
- rbac.RoleOptions.NoTasks strips every task action from the built-in
  roles, so the task permissions are neither granted nor settable on a
  custom role.
- The frontend does not register the /tasks and /tasks/:username/:taskId
  routes, hides the navbar item, the tasks sidebar, task badges and links
  on workspace surfaces, the Task Events notification group, and the task
  resource in the custom role editor.
- The CLI task command tree is hidden from help and from generated docs.

The existing --hide-ai-tasks flag keeps working. The Tasks tab is now
visible only when tasks are enabled and that flag is unset.

Documentation for Tasks is removed outright since static docs cannot be
gated. The generated API reference remains because the handlers still
exist behind the flag.

coderdtest defaults TasksEnabled to true so the existing Tasks suite
keeps exercising the enabled path.

Co-authored-by: Coder Agents <noreply@coder.com>
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

david-fraley and others added 3 commits August 11, 2026 13:30
…into enable-tasks

The Tasks API reference page was still published because the handlers keep
their swagger annotations, which TestEndpointsDocumented requires. Add an
unpublishedSections set to the apidoc postprocessor so a swagger tag can stay
annotated without being written to docs/reference/api or listed in the
manifest, and register the Tasks tag there. docs/reference/api/tasks.md is
deleted and stays deleted across make gen.

Also drop the Coder Tasks glossary entry.

--hide-ai-tasks only ever hid the dashboard tab, which --enable-tasks now
subsumes. Mark it hidden and point UseInstead at --enable-tasks. It keeps
parsing so existing deployments do not break, and it no longer documents
Tasks in the CLI or configuration reference.

Co-authored-by: Coder Agents <noreply@coder.com>
…ction

Drops the annotation blocks from the ten Tasks handlers in coderd/aitasks.go,
so the Tasks endpoints leave the swagger spec entirely rather than being
filtered out after generation. This also removes the task-only schema
definitions (codersdk.Task, TaskState, TasksListResponse and friends) from
docs/reference/api/schemas.md, coderd/apidoc/docs.go and swagger.json.

Reverts the unpublishedSections filter added to the apidoc postprocessor,
which is no longer needed.

The handlers stay registered so deployments that set CODER_ENABLE_TASKS keep
working, which means TestEndpointsDocumented would flag them as missing an
@router annotation. Skip them with isTaskEndpoint, alongside the existing
isExperimentalEndpoint and isLegacyAIBridgeAlias skips.

Co-authored-by: Coder Agents <noreply@coder.com>
--hide-ai-tasks only hid the dashboard tab, which --enable-tasks subsumes now
that Tasks is off by default. Remove it outright rather than carrying a
deprecated alias, and rename the new flag to match the naming it used:

  TasksEnabled  -> EnableAITasks
  tasks_enabled -> enable_ai_tasks
  --enable-tasks   -> --enable-ai-tasks
  CODER_ENABLE_TASKS -> CODER_ENABLE_AI_TASKS
  enableTasks   -> enableAITasks

With HideAITasks gone the tasks-enabled and tasks-tab-visible embedded
metadata values were identical, so they collapse into a single
ai-tasks-enabled meta tag. useTasksEnabled becomes useAITasksEnabled and is
now the navbar's switch too, replacing its inline metadata read.

Note for operators: serpent rejects unknown YAML keys, so a config file that
still sets client.hideAITasks fails to start. CODER_HIDE_AI_TASKS as an
environment variable is ignored silently.

Co-authored-by: Coder Agents <noreply@coder.com>
@david-fraley david-fraley changed the title feat: hide Coder Tasks behind the enable-tasks flag feat!: hide Coder Tasks behind the enable-ai-tasks flag Aug 11, 2026
@david-fraley david-fraley added the release/breaking This label is applied to PRs to detect breaking changes as part of the release process label Aug 11, 2026
…hind-flag

# Conflicts:
#	docs/ai-coder/agents/index.md
#	docs/ai-coder/agents/tasks-to-chats-migration.md
#	docs/manifest.json
coderd.New reloaded the process-wide built-in roles whenever tasks were
disabled, which is the default. Any test process that started both a
tasks-disabled server and a tasks-enabled server ended up with the task
denials applied to both, so the CLI task suite failed after the server
suite ran.

Route-level 404s already remove every task endpoint, so the role
negation added nothing an operator could reach. Drop it and delete the
now-stale CLI task golden files, which make gen removes because the
command is hidden.
Comment on lines +105 to +114
<>
Today, Coder Tasks (via UI, CLI, or API) is the only way to
create agentic workspaces, but additional protocols and APIs
may be supported as standards emerge.
</>
) : (
<>
Additional protocols and APIs may be supported as standards
emerge.
</>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Coder Agents mention maybe?

### Coding agent

An AI agent that reads and writes code on a developer's behalf, such as Claude Code, run through Coder Tasks or Coder Agents.
An AI agent that reads and writes code on a developer's behalf, such as Claude Code, run through Coder Agents or inside a workspace.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can't really run Claude through Agents right now AFAIK?

Suggested change
An AI agent that reads and writes code on a developer's behalf, such as Claude Code, run through Coder Agents or inside a workspace.
An AI agent that reads and writes code on a developer's behalf, such as Coder Tasks, or Claude Code via AI Gateway.

Comment on lines +30 to +33
> [!NOTE]
> Coder Tasks has since been deprecated and is no longer available in current
> releases. [Coder Agents](../../ai-coder/agents/index.md) is the long-term
> replacement.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cc @mtojek

Comment thread coderd/aitasks.go
Comment on lines -37 to -46
// @Summary Create a new AI task
// @ID create-a-new-ai-task
// @Security CoderSessionToken
// @Accept json
// @Produce json
// @Tags Tasks
// @Param user path string true "Username, user ID, or 'me' for the authenticated user"
// @Param request body codersdk.CreateTaskRequest true "Create task request"
// @Success 201 {object} codersdk.Task
// @Router /api/v2/tasks/{user} [post]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suggest marking these with a comment similar to the below:

// DEPRECATED: this endpoint is being removed in release X.Y. 

// Tasks ship disabled. Tests exercise the enabled behavior by default so
// the Tasks suite keeps running; tests for the disabled path opt out
// explicitly via the mutators.
cfg.EnableAITasks = true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Comment on lines -293 to -295
--hide-ai-tasks bool, $CODER_HIDE_AI_TASKS (default: false)
Hide AI tasks from the dashboard.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could alternatively build on top of this and make CODER_HIDE_AI_TASKS also make the endpoints 404?

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

Labels

release/breaking This label is applied to PRs to detect breaking changes as part of the release process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants