feat(linear): support custom workflow statuses#1364
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
Requesting changes: the Linear wizard no longer exposes the existing friction status slot once workflow statuses load, which regresses friction reporting setup.
Code Issues
Should Fix
- web/src/components/projects/pm-providers/linear/wizard.ts:184 — Switching the Linear mapping UI to
workflowStatuses.listdrops thefrictionslot becauseBUILTIN_WORKFLOW_STATUSESdoes not include it.statuses.frictionis still part of the Linear config contract and is required by friction materialization, so new Linear projects can no longer configure friction reports through the wizard.
🕵️ codex · gpt-5.5 · run details
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
Requesting changes because custom Linear statuses can dispatch but do not participate in lifecycle moves, and Linear setup can auto-enable backlog-manager unexpectedly.
Code Issues
Should Fix
- src/pm/linear/integration.ts:92 - Custom workflow statuses saved in
linearConfig.statusesare not included in the normalized lifecycle config. A custom agent can declarelifecycle.moveOnSuccess: storybecause the schema accepts arbitrary strings, butPMLifecycleManager.handleSuccess()resolves moves throughpmConfig.statuses[moveOnSuccess]; forstorythat lookup is undefined, sosafeMoveskips the transition. Any PRD/story/phased-plan style flow that relies on the normal lifecycle will dispatch when a user manually moves into the custom state, but it will not advance to the next custom Linear state on success. Include custom status mappings inresolveLifecycleConfigand widenProjectPMConfig.statusesaccordingly. - web/src/components/projects/pm-providers/save-trigger-configs.ts:30 - Linear setup now builds trigger configs for every mapped workflow status with an agent type. Since
BUILTIN_WORKFLOW_STATUSESgivesbacklogagentType: 'backlog-manager', a project that maps Backlog during Linear setup gets a DB override enablingbacklog-managerforpm:status-changed, even though that trigger's YAML default is false and the Trello/JIRA setup paths still only enable implementation/splitting/planning. After that, moving any Linear issue into Backlog can fire backlog-manager and pull work forward unexpectedly. Filter default-disabled built-ins such as backlog-manager out of the auto-created configs, or make the allowlist explicit.
🕵️ codex · gpt-5.5 · run details
Linear wizard now sources cascade stages from workflowStatuses.list, but BUILTIN_WORKFLOW_STATUSES omitted `friction` — so new Linear setups lost the UI row for `statuses.friction`, which friction materialization still requires. Add `friction` as a builtin (sortOrder 100, no agent) alongside `alerts` so the slot reappears in the wizard.
|
Updated the PR after the latest review pass. Changes pushed in
Verification:
|
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
Requesting changes: manual/retry runs now always use PM lifecycle defaults, which regresses PR-based agent retries by mutating linked PM work items.
Code Issues
Should Fix
- src/triggers/shared/manual-runner.ts:152 — PR-based manual/retry runs now enter
runAgentExecutionPipelinewithout the GitHub execution config. The normal GitHub path explicitly setsskipPrepareForAgent,skipHandleFailure, andhandleSuccessOnlyForAgentTypeso review/respond-to-ci/respond-to-review runs do not add/remove PM lifecycle labels or post PM failure comments. A retry of a linked review run can now resolve the work item from the PR, callprepareForAgent, thenhandleSuccess, and mark the PM item processing/processed even though no implementation lifecycle occurred. Preserve the GitHub execution config for PR-based manual/retry runs, or scope this new lifecycle behavior to the PM/implementation retry case.
🕵️ codex · gpt-5.5 · run details
|
Fixed the latest manual/retry lifecycle review issue in Changes:
Verification:
Note: pre-push |
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
Requesting changes because a custom workflow status can be mapped to an agent that the trigger resolver will never enable, making the core Linear custom-status dispatch path silently no-op.
Code Issues
Should Fix
- src/api/routers/workflowStatuses.ts:54 —
validateAgentTypeonly checks that the agent definition exists. A valid custom definition can still have nopm:status-changedtrigger; when a Linear issue enters the mapped state,LinearStatusChangedTriggerresolves that agent butcheckTriggerEnabledWithParams()delegates togetResolvedTriggerConfig(), which returnsnullif the definition does not declare the event, even if the wizard inserted anagent_trigger_configsrow. The webhook is then skipped. Reject these mappings with a clear error, or make workflow-status dispatch explicitly synthesize/honor status-trigger configs for mapped agents.
🕵️ codex · gpt-5.5 · run details
| async function validateAgentType(agentType: string | null | undefined) { | ||
| if (!agentType) return; | ||
| try { | ||
| await resolveAgentDefinition(agentType); |
There was a problem hiding this comment.
This accepts any existing agent as a workflow-status dispatch target, but the status trigger later goes through checkTriggerEnabledWithParams()/getResolvedTriggerConfig(), which returns null unless that agent definition declares pm:status-changed. A custom agent with triggers: [] is valid and passes this check, so the UI/CLI can save the mapping and even upsert a trigger config, but Linear status changes will silently skip it. Please either validate that the mapped agent supports pm:status-changed here or make the workflow-status dispatch path honor these mappings without requiring a declared trigger.
Summary
Adds database-backed workflow status definitions and wires them through Linear project setup, custom agent dispatch, dashboard stats filters, prompt loading, and CLI management. This lets Linear statuses map to custom Cascade workflow stages and custom agents while preserving the built-in statuses as immutable defaults.
Also routes manual/retry runs through the normal execution lifecycle so successful implementation retries still create/link PRs and advance the work item lifecycle.
Screenshots
Custom statuses
Status mapping to agent
Custom agent triggers
Test Plan
npm test)npm run lint)npm run typecheck)Additional verification run locally:
npm run buildnpm run verifynpm run test:fastChecklist