improvement(execute): reuse the resolved workspace access and dedupe export failures - #6444
Conversation
…export failures Route the remaining sandbox-export failure responses through the existing exportFailure helper so the two export helpers build their 400/500 bodies one way instead of two. Body and status are unchanged for every case. Pass the already-resolved workspace access into the workspace file writer from the two copilot callers that were discarding it, so the write no longer re-queries permissions it just resolved.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview The execute handler also denies function runs when the body Copilot Reviewed by Cursor Bugbot for commit e78cdff. Configure here. |
Greptile SummaryThe PR consolidates sandbox-export error responses, rejects nonexistent workspaces during execution authorization, and avoids a redundant permission lookup for immediate copilot file creation. The follow-up revision preserves a fresh write-time authorization check after long-running downloads.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/function/execute/route.ts | Consolidates export failure construction and explicitly denies execution when the requested workspace does not exist. |
| apps/sim/lib/copilot/tools/server/files/create-file.ts | Passes freshly resolved workspace access directly to the file writer with no asynchronous authorization gap. |
| apps/sim/lib/copilot/tools/server/files/download-to-workspace-file.ts | Fixes the prior stale-authorization issue by withholding pre-download access from the writer, forcing permission revalidation after the download. |
Reviews (2): Last reviewed commit: "fix(copilot): re-resolve workspace acces..." | Re-trigger Greptile
…of reusing it The pre-download access check cannot stand in for the write-time one: the fetch in between can be long, and a permission revoked during it must still block the write. create_file keeps the reuse, where nothing awaits between the two.
Summary
exportFailurehelper so the two export helpers build their bodies one way instead of two — body and status unchanged in every caseType of Change
Testing
Type-check, lint, and the API validation audit pass. 1310 tests pass across the touched areas.
Checklist