Skip to content

v0.6.35: additional jira fields, HITL docs, logs cleanup efficiency#4093

Merged
waleedlatif1 merged 5 commits intomainfrom
staging
Apr 10, 2026
Merged

v0.6.35: additional jira fields, HITL docs, logs cleanup efficiency#4093
waleedlatif1 merged 5 commits intomainfrom
staging

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

waleedlatif1 and others added 5 commits April 9, 2026 17:08
#4088)

Update parseJsmErrorMessage to extract errors from all Atlassian API
response formats: errorMessage (JSM), errorMessages array (Jira),
errors[].title RFC 7807 (Confluence/Forms), field-level errors object,
and message (gateway). Remove redundant prefix wrapping so the raw
error message surfaces cleanly through the extractor.
* fix(log): log cleanup sql query

* perf(log): use startedAt index for cleanup query filter

Switch cleanup WHERE clause from createdAt to startedAt to leverage
the existing composite index (workspaceId, startedAt), converting a
full table scan to an index range scan. Also remove explanatory comment.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Theodore Li <[email protected]>
Co-authored-by: Waleed Latif <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
…#4089)

Add the generated human-in-the-loop group to the docs navigation
and create meta.json listing all HITL operation IDs so endpoints
render in the API reference.

Co-authored-by: Claude Opus 4.6 <[email protected]>
* feat(tools): add fields parameter to Jira search block

Expose the Jira REST API `fields` parameter on the search operation,
allowing users to specify which fields to return per issue. This reduces
response payload size by 10-15x, preventing 10MB workflow state limit
errors for users with high ticket volume.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* style(tools): remove redundant type annotation in fields map callback

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix(tools): restore type annotation for implicit any in params callback

The params object is untyped, so TypeScript cannot infer the string
element type from .split() — the explicit annotation is required.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
* fix(agent): include model in structured response output

* fix(agent): update test expectation for model in structured response
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 10, 2026 5:52am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 10, 2026

PR Summary

Medium Risk
Touches production cleanup SQL and deletion criteria for execution logs, which could change what data gets archived/deleted. Also expands Jira request shaping and error parsing, and adjusts agent outputs, requiring validation across integrations and downstream consumers.

Overview
Docs: Adds a generated Human-in-the-loop section to the API reference sidebar.

Logs cleanup: Reworks free-plan targeting to use a freeWorkspacesSubquery (workspace→subscription join) and changes retention filtering to use workflowExecutionLogs.startedAt instead of createdAt.

Jira tooling: Adds an optional fields input for the Jira search operation and passes it as a trimmed array to the underlying tool request.

Executor/Atlassian utils: Ensures agent structured responses include model in output metadata, and expands parseJsmErrorMessage to handle multiple Atlassian error response shapes with cleaner fallback messaging.

Reviewed by Cursor Bugbot for commit 3efbd1d. Configure here.

@waleedlatif1 waleedlatif1 merged commit 4f40c4c into main Apr 10, 2026
24 checks passed
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR bundles five small improvements: it adds Human-in-the-Loop docs to the API reference sidebar, optimises the log-cleanup route by collapsing two sequential DB round-trips into a single correlated subquery (and corrects the retention filter from createdAt to startedAt), expands parseJsmErrorMessage to cover all Atlassian error shapes, adds an optional fields parameter to the Jira search block, and fixes the agent handler so structured responses include the model field via createResponseMetadata.

Confidence Score: 5/5

Safe to merge — all remaining findings are P2 style issues that do not affect correctness or runtime behaviour.

All five changes are self-contained and correct. The log-cleanup refactor is a clear efficiency win (one DB round-trip instead of three) with no logic regressions. The agent-handler fix is verified by a new test assertion. The only finding is non-TSDoc inline comments in jsm/utils.ts, which is a style violation per project standards but has no runtime impact.

apps/sim/tools/jsm/utils.ts — non-TSDoc inline comments should be removed per project standards.

Important Files Changed

Filename Overview
apps/sim/app/api/logs/cleanup/route.ts Refactored cleanup to use a single Drizzle subquery instead of two sequential DB fetches; also corrects the retention filter from createdAt to the more semantically appropriate startedAt.
apps/sim/tools/jsm/utils.ts Extends parseJsmErrorMessage to handle all Atlassian error formats (singular errorMessage, errorMessages array, RFC 7807 errors array, field-level errors object, generic message); contains non-TSDoc inline comments that violate project standards.
apps/sim/blocks/blocks/jira.ts Adds optional fields subBlock and input for the Jira search operation, splitting and trimming the comma-separated input before passing it to the tool params.
apps/sim/executor/handlers/agent/agent-handler.ts Moves model field from processStandardResponse into createResponseMetadata so structured responses (which only call createResponseMetadata) also include the model name.
apps/sim/executor/handlers/agent/agent-handler.test.ts Adds model field to the structured-response test assertion, verifying the fix in agent-handler.ts.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[GET /api/logs/cleanup] --> B[Build freeWorkspacesSubquery\nworkspace LEFT JOIN subscription\nWHERE subscription.id IS NULL]
    B --> C{Batch loop\nbatchesProcessed < MAX_BATCHES}
    C --> D[SELECT logs WHERE\nworkspaceId IN subquery\nAND startedAt < retentionDate\nLIMIT 2000]
    D --> E{logs.length > 0?}
    E -- No --> F[hasMoreLogs = false\nExit loop]
    E -- Yes --> G[Archive to storage]
    G --> H[Delete files from storage]
    H --> I[Delete log from DB]
    I --> J[batchesProcessed++]
    J --> C
    F --> K[Cleanup orphaned snapshots]
    K --> L[Return JSON response]
Loading

Reviews (1): Last reviewed commit: "fix(agent): include model in structured ..." | Re-trigger Greptile

Comment on lines +53 to +76
// JSM Service Desk: singular errorMessage
if (errorData.errorMessage) {
return `JSM Forms API error: ${errorData.errorMessage}`
return errorData.errorMessage
}
// Jira Platform: errorMessages array
if (Array.isArray(errorData.errorMessages) && errorData.errorMessages.length > 0) {
return errorData.errorMessages.join(', ')
}
// Confluence v2 / Forms API: RFC 7807 errors array
if (Array.isArray(errorData.errors) && errorData.errors.length > 0) {
const err = errorData.errors[0]
if (err?.title) {
return err.detail ? `${err.title}: ${err.detail}` : err.title
}
}
// Jira Platform field-level errors object
if (errorData.errors && !Array.isArray(errorData.errors)) {
const fieldErrors = Object.entries(errorData.errors)
.map(([field, msg]) => `${field}: ${msg}`)
.join(', ')
if (fieldErrors) return fieldErrors
}
// Generic message fallback
if (errorData.message) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Non-TSDoc inline comments violate project standards

The added // comments (// JSM Service Desk: singular errorMessage, // Jira Platform: errorMessages array, etc.) are non-TSDoc comments. The project's global standards explicitly forbid non-TSDoc comments — all documentation should use TSDoc format or be removed.

Context Used: Global coding standards that apply to all files (source)

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3efbd1d. Configure here.

cost?: any
}) {
return {
model: result.model,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metadata model field silently overwrites structured response data

Low Severity

Moving model into createResponseMetadata means it now gets spread over user-defined structured output in processStructuredResponse. Since metadata is spread after extractedJson, a user whose response schema includes a model field (e.g., product model, car model) will have that value silently overwritten by the provider's model identifier. Unlike the other metadata keys (tokens, toolCalls, providerTiming, cost), model is a common real-world field name, making collision more likely.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3efbd1d. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants