Repository navigation
fix(resume): require write access to resume a paused run on the legacy route - #8896
waleedlatif1 wants to merge 7 commits into
Conversation
…y route
POST /api/resume/[workflowId]/[executionId]/[contextId] authorized with
validateWorkflowAccess, which checks workspace read permission, so a
read-only member (or their API key) could answer a human-in-the-loop pause
and continue the run with arbitrary input. The route now authenticates with
the internal workflow session/API-key policy and runs the resumeWorkflowRun
use case, the same write-role operation the v2 resume route uses.
resumeWorkflowRun takes the calling surface ('legacy' | 'v2') so the legacy
route keeps its streaming and job-id polling responses, and forwards the
request signal and headers a streamed resume needs.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
[Critical impact] The PR appears safe to merge; no actionable new issues were found. SummaryThe legacy resume POST now requires write access through
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 8 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
…ite-authz # Conflicts: # apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.test.ts # apps/sim/app/api/resume/resume-handler.ts
… and tighten comments
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 8 files
Confidence score: 3/5
- In
resume-run.ts, session-authenticated legacy requests now returnstartedafter launching detached work, bypassing the API execution modes and potentially breaking streaming, synchronous failure responses, and async job-ID handling. Preserve the execution-mode behavior for these requests.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/workflows/application/resume-run.ts">
<violation number="1" location="apps/sim/lib/workflows/application/resume-run.ts:35">
P1: Session-authenticated legacy requests now bypass the API execution-mode branches and return `started` after launching detached work, instead of preserving streaming, synchronous failure responses, and async job-ID polling. Treat legacy requests as API callers regardless of principal kind.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
Also drop two unused exports from the v2 Project file search contract that fail check:unused-exports on staging.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
POST /api/resume/[workflowId]/[executionId]/[contextId]authorized throughvalidateWorkflowAccess, which only checks workspace read, so a read-only member or their API key could answer a human-in-the-loop pause and continue the run with their own inputinternalWorkflowSessionOrApiKeyAuthand runsresumeWorkflowRun, the sameworkflows.runs.resumeoperation (write role) the v2 resume route uses, which also brings the run-to-workflow scope check and cross-tenant concealmentresumeWorkflowRuntakes the callingsurface(legacy|v2) so the legacy route keeps streaming and job-id polling, and forwards the request signal/headers a streamed resume needsresume-handler.tspresenter into the route, keeping its legacy-only "failed sync run → 400{ error }" answer; the GET detail handler stays readType of Change
Testing
resumeRunis lowered toread[contextId]/route.test.ts,resume/poll/route.test.ts,run-control.test.ts, v2resume/route.test.ts(53/53)bun run lint; generators in sync; remaining audits, type-check, and the full suite run in CIChecklist
test-auditauthoring gate)🤖 Generated with Claude Code