Fix CLI missing specVersion in "run_cancelled" event payload#1078
Conversation
The CLI's `cancelRun` in `packages/cli/src/lib/inspect/run.ts` sent `{ eventType: 'run_cancelled' }` without `specVersion`, causing the Vercel API's `/v2/runs/{id}/events` endpoint to reject the request with a 400 error. The core runtime's `cancelRun` already handled this correctly, so the fix removes the redundant CLI wrapper and calls the core implementation directly.
The bug was introduced in 4966b72 ("implement event-sourced architecture (#621)") which changed the CLI cancel from `world.runs.cancel(runId)` to `world.events.create(runId, ...)` but omitted `specVersion` from the payload. The same commit correctly included it in `Run#cancel()` in core — it was simply missed in the CLI path. A later commit (86a7930) added v1Compat branching but still never added specVersion. The final merged state in a2b688d (PR #894) still omits it.
Also adds a CLI cancel e2e test that starts a long-running workflow, cancels it via the CLI command, and verifies the run status.
🦋 Changeset detectedLatest commit: da5e23e The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (45 failed)mongodb (1 failed):
turso (44 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the CLI's cancelRun function was missing the specVersion field in the "run_cancelled" event payload, causing the Vercel API to reject requests with a 400 error. The fix removes the buggy CLI-specific implementation and uses the core runtime's cancelRun function directly, which correctly includes specVersion. The PR also adds e2e test coverage for canceling a running workflow.
Changes:
- Removed buggy
cancelRunimplementation from CLI that omittedspecVersion - Updated cancel command to import
cancelRunfrom core runtime instead - Added e2e test that cancels a running workflow and verifies the cancellation
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/lib/inspect/run.ts | Removed buggy cancelRun function that was missing specVersion in event payload |
| packages/cli/src/commands/cancel.ts | Changed import to use core runtime's cancelRun instead of CLI wrapper |
| packages/core/e2e/utils.ts | Added cliCancel utility function for CLI-based cancel testing |
| packages/core/e2e/e2e.test.ts | Added test that cancels a running workflow and verifies status |
| .changeset/purple-paths-pump.md | Added changeset entry for the CLI fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
404cee5 to
da5e23e
Compare

The CLI's
cancelRuninpackages/cli/src/lib/inspect/run.tssent{ eventType: 'run_cancelled' }withoutspecVersion, causing the Vercel API's/v2/runs/{id}/eventsendpoint to reject the request with a 400 error. The core runtime'scancelRunalready handled this correctly, so the fix removes the redundant CLI wrapper and calls the core implementation directly.The bug was introduced in 4966b72 ("implement event-sourced architecture (#621)") which changed the CLI cancel from
world.runs.cancel(runId)toworld.events.create(runId, ...)but omittedspecVersionfrom the payload. The same commit correctly included it inRun#cancel()in core — it was simply missed in the CLI path. A later commit (86a7930) added v1Compat branching but still never added specVersion. The final merged state in a2b688d (PR #894) still omits it.Also adds a CLI cancel e2e test that starts a long-running workflow, cancels it via the CLI command, and verifies the run status.