Repository navigation
Closed
Labels
Description
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
- A saved workflow resource in the
chatdschema, 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 behindForkOrganizationAgentDefinitionSharingDialog.tsx). - 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. run_workflowacceptsnameandargsand runs the saved script. The agent sees the workflows it may run, with their descriptions, in the tool description or alist_workflowstool.- 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_workflowby name, and an agent that tries to save (it cannot). - A saved workflow survives a server restart.
- With
fork-workflowsoff, the routes answer as the other fork routes do with their experiment off, and the tool has nonameargument.
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
ibetitsmike commentedon Nov 14, 2026
A workstream started on branch
mike/issue-322-saved-workflows. Expect a stack:-a(table, queries, dbauthz, routes) based onmain, then-b(run_workflowby name and agent visibility).ibetitsmike commentedon Nov 15, 2026
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.