Skip to content

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

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

feat(copilot): let Run agent cancel workflow runs#7151
j15z wants to merge 13 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 runs by workflow and execution ID
  • route internal, Copilot, and v2 cancellations through the same authorized application operation
  • preserve queued, active, paused, resumed, and workflow-group cancellation behavior
  • preserve the v2 terminal no-op response contract while internal and Copilot callers retain conflict behavior

Type of Change

  • New feature

Testing

  • bun run lint
  • bun run apps/sim/scripts/check-block-registry.ts origin/staging
  • bun run check:audits
  • focused Vitest coverage for the cancellation service, application use case, internal and v2 routes, and Copilot handler
  • app and auth type-check

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 28, 2026 12:54am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds workflow-run cancellation to the Run agent and consolidates internal, Copilot, and v2 cancellation behind one authorized application operation.

  • Preserves transport-specific terminal-run response behavior.
  • Handles queued, active, paused, resumed, and workflow-group cancellation paths.
  • Strengthens abort rollback and active-resume reconciliation so cancellation finalizes only after required stop signals are confirmed.

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.ts Centralizes cancellation reconciliation and confirms all relevant active-resume stops before publishing or completing paused cancellation.
apps/sim/lib/workflows/application/cancel-run.ts Provides the shared authorized application operation used by all cancellation transports.
apps/sim/lib/copilot/tools/handlers/workflow/mutations.ts Delegates Run-agent cancellation through the shared use case with the trusted principal and abort signal.
apps/sim/app/api/v2/workflows/[workflowId]/runs/[runId]/cancel/route.ts Uses the shared cancellation operation while retaining the v2 terminal no-op projection.
apps/sim/app/api/workflows/[id]/executions/[executionId]/cancel/route.ts Reduces the internal route to authentication, input mapping, and application-operation delegation.

Sequence Diagram

sequenceDiagram
  participant Caller as Internal / Copilot / v2
  participant App as cancelWorkflowRun
  participant Auth as Workflow authorization
  participant Exec as Cancellation reconciliation
  Caller->>App: principal + workflowId + runId + AbortSignal
  App->>Auth: authorize write access and resolve run context
  Auth-->>App: canonical workflow/run context
  App->>Exec: cancel execution
  Exec->>Exec: stage paused state and signal active work
  Exec->>Exec: confirm original and replacement resume stops
  Exec->>Exec: publish terminal event and finalize state
  Exec-->>App: cancellation result or terminal error
  App-->>Caller: transport-specific response
Loading

Reviews (10): Last reviewed commit: "fix(workflows): confirm every active res..." | 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 Outdated
@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 Outdated
Comment thread apps/sim/lib/execution/cancel-workflow-execution-post-auth.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 Outdated
@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

@j15z

j15z commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

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

j15z commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

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

j15z commented Aug 28, 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