Skip to content

coderd, chatd: saved workflows resource and run_workflow by name #322

Closed

Description

@ibetitsmike

Coder Agents acted on behalf of @ibetitsmike.

Part of #226 (scope item 4). This is the backend that the saved workflow UI issues depend on. Line references are at main ba26490b51.

Problem

Users cannot save a workflow. Runs are kept per chat in workflow_runs (coderd/database/forkdb/queries/workflow_runs.sql), but there is no saved workflow resource, no routes, and run_workflow takes only script, script_path or resume_run_id.

Scope

  1. A saved workflow resource in the chatd schema, scoped to an organization (organization_id) and owned by a user: name, description, script, optional args schema and declared phases. Personal and organization tiers, mirroring agent definitions (coderd/fork_agent_definitions.go, coderd/x/chatd/fork_agent_definitions.go, and the sharing routes behind ForkOrganizationAgentDefinitionSharingDialog.tsx).
  2. CRUD and sharing routes with RBAC and dbauthz, Swagger and generated types, behind fork-workflows. A member sees their own workflows and the ones shared with their organization, and cannot edit another user's workflow.
  3. run_workflow accepts name and args and runs the saved script. The agent sees the workflows it may run, with their descriptions, in the tool description or a list_workflows tool.
  4. Saving is a user action. No agent tool creates, edits or deletes a saved workflow.

Acceptance

  • Go tests for the routes, the RBAC cases above, run_workflow by name, and an agent that tries to save (it cannot).
  • A saved workflow survives a server restart.
  • With fork-workflows off, the routes answer as the other fork routes do with their experiment off, and the tool has no name argument.

Constraints

chatdmig nodes and forkdb queries, no numbered migrations. Fork files, one hook line per upstream file. About 500 changed lines per PR at most, generated code excepted, so expect two or three PRs.

Blocks the "Save workflow" action, the Workflows settings page and the @ menu entry.

Activity

  1. added
    enhancement
    followup
    on Nov 14, 2026
  2. ibetitsmike commented on Nov 14, 2026

    @ibetitsmike
    OwnerAuthor

    Coder Agents acted on behalf of @ibetitsmike.

    A workstream started on branch mike/issue-322-saved-workflows. Expect a stack: -a (table, queries, dbauthz, routes) based on main, then -b (run_workflow by name and agent visibility).

  3. ibetitsmike commented on Nov 15, 2026

    @ibetitsmike
    OwnerAuthor

    Coder Agents acted on behalf of @ibetitsmike.

    The backend stack is merged: #335 (6ae6741), #336 (b4340bd), #337 (895036c), #338 (05bc672). Each passed fork-ci on its head, a Codex receipt and an Opus review; gates comments are on each PR. Review P3s are collected in a follow-up issue. Unblocked now: #326, #327, #328.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfollowup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions