Skip to content

feat(copilot): let Run agent cancel workflow runs - #7151

Open
j15z wants to merge 8 commits into
stagingfrom
feat/let-mship-cancel-workflow-runs
Open

feat(copilot): let Run agent cancel workflow runs#7151
j15z wants to merge 8 commits into
stagingfrom
feat/let-mship-cancel-workflow-runs

Conversation

@j15z

@j15z j15z commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • let the Run agent cancel workflow executions using workflow and execution IDs
  • use the same internal cancellation route as the logs UI

Type of Change

  • New feature

Testing

  • bun run lint
  • bun run apps/sim/scripts/check-block-registry.ts origin/staging
  • bun run check:audits
  • targeted Copilot adapter, router, tool display, and cancellation route tests

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 27, 2026 5:35am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a Copilot tool for cancelling workflow runs and extracts cancellation behavior into a shared implementation used by both Copilot and the HTTP route.

  • Registers and displays the approval-gated cancel_workflow_run tool.
  • Preserves workflow authorization and workspace scoping across both adapters.
  • Adds abort-aware rollback and post-commit reconciliation for paused, resumed, and workflow-group executions.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/execution/cancel-workflow-execution-post-auth.ts Centralizes authorized cancellation and includes rollback before commit plus reconciliation after irreversible cancellation effects.
apps/sim/app/api/workflows/[id]/executions/[executionId]/cancel/route.ts Reduces the HTTP route to authentication, contract parsing, scope mapping, and delegation to the shared cancellation implementation.
apps/sim/lib/copilot/tools/handlers/workflow/mutations.ts Adds trusted-context cancellation delegation with workspace scoping and AbortSignal propagation.
apps/sim/lib/copilot/tool-executor/register-handlers.ts Registers the new cancellation handler in the Copilot tool executor.
apps/sim/lib/copilot/tools/tool-display.ts Adds user-facing display metadata for the cancellation tool.
apps/sim/app/api/workflows/[id]/executions/[executionId]/cancel/route.test.ts Covers workspace concealment, abort rollback, failed rollback reconciliation, and durable workflow-group commit behavior.

Sequence Diagram

sequenceDiagram
  participant Caller as HTTP route / Copilot
  participant Cancel as Shared cancellation boundary
  participant Auth as Workflow authorization
  participant State as Execution and pause state
  participant Stop as Queue / local / durable stop
  Caller->>Cancel: workflowId, executionId, userId, scope
  Cancel->>Auth: authorize write access
  Auth-->>Cancel: workflow workspace
  Cancel->>State: load execution and stage paused cancellation
  alt aborted before commit
    Cancel->>State: roll back staged cancellation
    Cancel-->>Caller: 409 aborted
  else cancellation commits
    Cancel->>Stop: signal and record cancellation
    Cancel->>State: finish terminal reconciliation
    Cancel-->>Caller: cancellation result
  end
Loading

Reviews (7): Last reviewed commit: "improvement(copilot): simplify cancellat..." | Re-trigger Greptile

Comment thread apps/sim/lib/copilot/tools/handlers/workflow/mutations.ts Outdated
Comment thread apps/sim/lib/copilot/tools/handlers/workflow/mutations.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/sim/lib/copilot/tools/handlers/workflow/mutations.ts Outdated
@j15z

j15z commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/lib/execution/cancel-workflow-execution-post-auth.ts
@j15z
j15z force-pushed the feat/let-mship-cancel-workflow-runs branch from 106a466 to 2a37dbe Compare August 27, 2026 04:35
@j15z

j15z commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/lib/execution/cancel-workflow-execution-post-auth.ts
Comment thread apps/sim/lib/execution/cancel-workflow-execution-post-auth.ts
@j15z

j15z commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/lib/execution/cancel-workflow-execution-post-auth.ts
@j15z

j15z commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z
j15z force-pushed the feat/let-mship-cancel-workflow-runs branch from 4bd0e2a to 00e58f0 Compare August 27, 2026 04:53
@j15z

j15z commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z
j15z force-pushed the feat/let-mship-cancel-workflow-runs branch from 00e58f0 to e6c8777 Compare August 27, 2026 05:35
@j15z

j15z commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

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.

1 participant