fix(jsm): improve create request error handling, add form-based submission support#4066
Conversation
PR SummaryMedium Risk Overview Fixes error reporting for JSM API failures by parsing and surfacing Atlassian Updates the block UI/tool schemas and docs to reflect the new parameter, makes Reviewed by Cursor Bugbot for commit 3019fd0. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR improves JSM Confidence Score: 5/5Safe to merge; all remaining findings are P2 style/UX suggestions that don't affect correctness. The duplicate error-extraction concern from the prior review has been cleanly resolved with parseJsmErrorMessage. The formAnswers flow is correctly threaded through types, tool, block params, and route. The two remaining comments are UX polish (missing required indicator on summary subBlock) and a misleading fallthrough error on the internal route — neither blocks production usage. apps/sim/blocks/blocks/jira_service_management.ts (summary required indicator), apps/sim/app/api/tools/jsm/request/route.ts (isCreateOperation fallthrough message)
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/tools/jsm/request/route.ts | Adds parseJsmErrorMessage helper (addressing prior review) and formAnswers support; isCreateOperation condition updated; requestFieldValues merge logic is correct but the fallback path produces a misleading error when serviceDeskId+requestTypeId are given without summary or formAnswers. |
| apps/sim/blocks/blocks/jira_service_management.ts | Adds formAnswers subBlock, JSON-parsing guards for both requestFieldValues and formAnswers, and summary/formAnswers co-validation in params; summary subBlock is not marked required in the block config despite PR description claiming basic-mode enforcement. |
| apps/sim/tools/jsm/create_request.ts | summary changed to optional, formAnswers added; tool body correctly forwards both to the route; transformResponse unchanged and still surfaces error from route. |
| apps/sim/tools/error-extractors.ts | New atlassian-errors extractor added first in the registry and exported via ErrorExtractorId; useful for Atlassian tools that don't pre-transform errors at the route level. |
| apps/sim/tools/jsm/types.ts | summary made optional, formAnswers added as optional Record<string, unknown>; type changes are consistent with tool and route. |
| apps/docs/content/docs/en/tools/jira_service_management.mdx | Docs updated to reflect summary optionality and new formAnswers parameter; accurate and complete. |
Sequence Diagram
sequenceDiagram
participant Block as JSM Block (UI)
participant Params as params()
participant Tool as jsmCreateRequestTool
participant Route as /api/tools/jsm/request
participant Atlassian as Atlassian JSM API
Block->>Params: operation=create_request, summary?, formAnswers? (string)
alt missing summary AND formAnswers
Params-->>Block: throw Error("Summary is required...")
end
Params->>Params: JSON.parse(requestFieldValues)
Params->>Params: JSON.parse(formAnswers)
Params->>Tool: { summary?, description?, requestFieldValues?, formAnswers? }
Tool->>Route: POST { serviceDeskId, requestTypeId, summary?, formAnswers?, ... }
Route->>Route: isCreateOperation = serviceDeskId && requestTypeId && (summary || formAnswers)
alt isCreateOperation
Route->>Route: build requestBody (merge requestFieldValues + summary/description)
opt formAnswers present
Route->>Route: requestBody.form = { answers: formAnswers }
end
Route->>Atlassian: POST /request
alt API error
Atlassian-->>Route: { errorMessage: ... }
Route->>Route: parseJsmErrorMessage() → JSM API error: ...
Route-->>Tool: { error: JSM API error: ... }
else success
Atlassian-->>Route: { issueKey, issueId, ... }
Route-->>Tool: { success: true, output: { issueKey, ... } }
end
else not isCreateOperation
Route->>Route: fall through to GET path (issueIdOrKey required)
end
Tool-->>Block: result
Reviews (3): Last reviewed commit: "fix(jsm): include description in request..." | Re-trigger Greptile
|
Both findings from the Greptile summary addressed in 724f9fd:
|
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Description silently dropped in form-only request mode
- Updated the condition on line 94 to check for description presence, ensuring it's included in requestFieldValues even when summary is not provided.
Or push these changes by commenting:
@cursor push da3de167c3
Preview (da3de167c3)
diff --git a/apps/sim/app/api/tools/jsm/request/route.ts b/apps/sim/app/api/tools/jsm/request/route.ts
--- a/apps/sim/app/api/tools/jsm/request/route.ts
+++ b/apps/sim/app/api/tools/jsm/request/route.ts
@@ -91,7 +91,7 @@
requestTypeId,
}
- if (summary || requestFieldValues) {
+ if (summary || description || requestFieldValues) {
const fieldValues =
requestFieldValues && typeof requestFieldValues === 'object'
? {This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3019fd0. Configure here.

Summary
errorMessagefrom API)formAnswersparam) for JSM create_requestsummaryoptional at tool level to support form-only requests (block UI still enforces it for basic mode)Type of Change
Testing
Tested manually
Checklist