Auto-fix ClickUp bugs with OpenAI planning and Cursor execution in n8n
ClickUp webhook → OpenAI analysis with scoring → optional Slack approval → Cursor background agent → GitHub PR creation → ClickUp status update
- Who
- DevOps leads or engineering managers who want to automate bug-fix pipelines for their teams
- You get
- When a ClickUp bug report arrives, automatically generate a fix plan, optionally require human approval, let Cursor implement and test the fix, open a GitHub PR, and update the task status
Constraints
Prerequisites: accessible n8n instance; API credentials for OpenAI, Slack, ClickUp, GitHub; HTTP Header Auth credential for the Cursor API; ClickUp configured to send bug webhooks. Costs: OpenAI API per token; Cursor API per call; n8n hosting costs separate. Boundary: auto-fix only triggers when confidence >= threshold, complexity is low/medium, no high-risk keywords are flagged, and at least one affected file is identified; otherwise the workflow routes to Slack for developer approval.
What they did
oneclick-ai published an n8n template demonstrating how to wire a ClickUp bug report webhook into an automated pipeline: use OpenAI (gpt-4.1) to analyze the bug and output a structured fix plan, validate and score the plan with a Code node to decide if autonomous fixing is safe, route uncertain cases through Slack for developer approval, pass approved tasks to a Cursor background agent to implement and test the fix, then create a GitHub PR and update the ClickUp task status.
How it went
The author presented a complete 21-node template with full node orchestration and prompt design (author_report). No specific runtime data or ROI was provided.
Worth knowing
1) The auto-fix threshold (autoFixConfidenceThreshold=0.75) and high-risk keyword list are hardcoded; tune them to your team's risk tolerance. 2) The Cursor API (api.cursor.com/v0/background-agents) is an external service; its availability, pricing, and auth requirements are not detailed in the template—verify independently. 3) The GitHub PR node does not explicitly set a draft flag in the provided JSON; confirm draft behavior for failed tests in your node version. 4) Both Wait nodes require manual replacement of resume webhook URLs; otherwise the workflow will hang indefinitely. 5) This site has not tested the workflow; reproduction=not_tested.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- After import, connect your own credentials on auth-required nodes; author secrets are not included.
Configuration to replace
- Source template is n8n public workflow #18622 (~21 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Configure webhook to receive bug reports
Create a Webhook node in n8n with path clickup-bug-autofix, method POST, and responseMode set to responseNode. In ClickUp, configure an automation to send new bug tasks to this webhook URL, ensuring the payload includes taskId, taskName, description, stackTrace, repoUrl, repoBranch, priority, and listId.
Prepare normalized bug report data
Use the Set node (Prepare Bug Report Data) to normalize the webhook payload into a configuration object. Key mappings: bugId ← taskId, taskName ← taskName/name (default 'Untitled bug'), description, stackTrace, repoUrl, repoBranch (default 'main'), priority (default 'normal'), reporter (default 'unknown'), clickupListId ← listId. Also set workflow constants: llmModel='gpt-4.1', autoFixConfidenceThreshold=0.75, cursorApiUrl='https://api.cursor.com/v0/background-agents', cursorApiModel='cursor-fast', cursorCallbackWebhookUrl (replace with actual wait-node resume URL), githubOwner, githubRepo, testCommand (default 'npm test'), slackChannel (default '#eng-bugfixes').
Analyze bug with OpenAI and generate a fix plan
Connect the OpenAI Chat Model node (gpt-4.1) to the AI Agent node (Bug Fix Planner Agent). The AI Agent uses define mode with a system prompt that instructs the model to analyze root cause, affected files, fix approach, complexity, confidence, test plan, and risk flags, returning strict JSON only.
Execution prompt · Source text。Bug Fix Planner Agent node text field (define mode)
=You are a senior software engineer diagnosing a bug reported in ClickUp task {{ $json.bugId }} for repository {{ $json.repoUrl }} (branch {{ $json.repoBranch }}). Bug title: {{ $json.taskName }} Priority: {{ $json.priority }} Description: {{ $json.description }} Stack trace / logs (if any): {{ $json.stackTrace }} Analyze this bug and determine: - rootCause: the underlying cause of the bug, in plain language - affectedFiles: array of specific file paths in the repository most likely involved in the fix - fixApproach: a concrete description of the code change strategy to resolve it - fixComplexity: one of low, medium, high - confidence: a number from 0 to 1 estimating how confident you are that an automated coding agent could safely implement this fix without human intervention - testPlan: which existing tests should verify the fix, and any new test cases that should be added - riskFlags: array of short strings flagging any sensitive areas this fix touches (e.g. "auth", "payment", "database migration", "encryption", "user permissions") — empty array if none apply Return ONLY a JSON object (no markdown fences, no commentary) with exactly these keys: rootCause, affectedFiles, fixApproach, fixComplexity, confidence, testPlan, riskFlags.Validate output and determine auto-fix eligibility
Use the Code node (Analyze Auto-Fix Eligibility) to parse the AI output, strip markdown fences, validate JSON structure, normalize complexity (low/medium/high, default medium) and confidence (clamped 0–1). Extract risk flags and check against high-risk keywords (auth, payment, billing, migration, schema, secret, encryption, permission). Eligibility gate: confidence >= autoFixConfidenceThreshold (0.75) AND complexity !== 'high' AND no high-risk area touched AND affectedFiles.length > 0. Generate fixId = 'FIX-' + bugId + '-' + Date.now(), output full analysis with autoFixEligible boolean.
Approval branch: auto-pass or Slack manual review
The If node checks autoFixEligible. If true, proceed directly to Cursor execution. If false, the Slack node sends a review message to the configured channel with bug summary, confidence, complexity, risk flags, root cause, fix approach, and affected files; then the Wait node pauses the workflow until a developer replies via webhook to resume.
Execution prompt · Source text。Notify Dev on Slack for Review node text field
=🛠️ *Bug needs manual review before auto-fix* — ClickUp task `{{ $json.bugId }}`: *{{ $json.taskName }}* Confidence: {{ $json.confidence }} | Complexity: {{ $json.fixComplexity }} | Risk flags: {{ $json.riskFlags.join(', ') || 'none' }} *Root cause:* {{ $json.rootCause }} *Proposed fix:* {{ $json.fixApproach }} *Affected files:* {{ $json.affectedFiles.join(', ') }} Reply to acknowledge and let the pipeline continue to Cursor, or handle this one manually instead.Build Cursor task and trigger background agent
The Code node (Create Fix Task Payload) merges the analysis with approval context: if auto-approved, reviewedBy is 'auto (confidence X >= threshold Y)'; if via Slack approval, reads reviewedBy and notes from the resume payload. Generates branch name autofix/{fixId}, builds the Cursor prompt (repository, bug, root cause, fix approach, affected files, test plan, branch and test command). The HTTP Request node POSTs JSON to cursorApiUrl with repository, baseBranch, branch, model, prompt, testCommand, callbackUrl, and metadata, using HTTP Header Auth credentials. Then the Wait node pauses for the Cursor callback.
Process Cursor result and create GitHub PR
The Code node (Process Cursor Result for PR) parses the Cursor callback payload, extracting testsPassed, filesChanged, diffSummary, commitSha. If tests passed, status='ready_for_review'; else 'tests_failed'. Assembles PR title '[Auto-fix] {taskName} ({fixId})' and PR body (root cause, fix approach, files changed, reviewer, test results, diff summary). The GitHub node creates the PR (continueOnFail=true); if tests failed, the PR should be draft (verify draft parameter availability in your GitHub node version).
Update ClickUp and return response
The ClickUp node updates the bug task status: 'in review' if tests passed, 'needs manual fix' if failed. The Respond to Webhook node returns a JSON summary with bugId, fixId, taskName, autoFixEligible, reviewedBy, branchName, status, testsPassed, prTitle, prUrl, and clickupStatus.
Prompt you can copy
Setup guidance · Editorial suggestion。交给搭建助手,先确认输入和权限
This block is the prompt. Ads are never placed here.
You are a senior DevOps engineer setting up the 'ClickUp Bug Auto-Fix' workflow from an n8n template. First confirm: 1) you have admin access to an n8n instance; 2) you have obtained credentials for OpenAI, Slack, ClickUp, GitHub, and the Cursor API; 3) ClickUp can configure webhooks pointing to your n8n instance. Then import workflow.json or rebuild nodes manually, paying special attention to constants in Prepare Bug Report Data, the prompt in Bug Fix Planner Agent, the threshold logic in Analyze Auto-Fix Eligibility, and the resume webhook URLs for both Wait nodes.
Test webhook connectivity in an isolated environment before production deployment. The Cursor API is a third-party service; confirm its availability and authentication method independently.
Source
Auto-fix ClickUp bug reports with OpenAI, Cursor, GitHub and Slack · oneclick-ai · n8n.io · 2026-08-24
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.