Repository navigation
feat(desktop): import local files from the background executor - #8672
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@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.
All reported issues were addressed across 16 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Turn on auto-fix | Re-trigger cubic
|
de04c40 to
93a0f75
Compare
bd60686 to
bf50837
Compare
bf50837 to
9da5c3c
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
f6d9127 to
6cf16e3
Compare
f8152fc to
262a715
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
262a715 to
0dd29c7
Compare
1aa2322 to
684261b
Compare
1e17305 to
90f104d
Compare
|
@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 26 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
|
@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 26 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
A chat whose turn runs on the desktop can now import a local file or folder into the workspace while the user is elsewhere, instead of the background executor answering import_local_files as not run. - Sim: PUT /api/desktop/tool/import stores one entry of a claimed import. The entry is admitted before its body is read: the caller's session must own the device, the call must be a running import_local_files bound to that device, and the request must carry the token that claimed it. The target workspace and folder come from Sim's record of the call, never from the request, and writing there is authorized as any file creation is. Each path segment becomes a folder under the target, reusing folders already there (find or create, converging when two land at once); a file never overwrites one already there. - Desktop: the runner reads the manifest from the call's own arguments, sends each directory, then each file in chunks checked against the manifest's revision, and reports what landed. A failure part way reports the partial result as outcome unknown, not to be retried. Stop aborts between entries and mid-upload. - The chunked read, the size check and the result projections move to @sim/desktop-bridge/tool-results, so the chat view's import and the background one report the same shapes.
…d their folders - The proxy no longer runs for the desktop's raw upload routes (import, and the browser file transfer that has the same shape). Running it made Next buffer the body and cut it off at its 10 MB proxy limit. The import route also requires a declared length and refuses a body that does not match it, so a cut-off file is never stored as complete. - A file entry with no body is refused instead of stored as an empty file. - A name Sim cannot store (one with a backslash) is refused for the whole import before anything lands, and at the contract. - A chunk that runs past the size the manifest listed is refused, like one that ends early. - A rate-limited entry is sent again after the limit clears. A 429 means nothing was stored, so a large tree no longer fails part way. - Folders an import creates are audited as folder creations and announced to the workspace's file views, as folders made by hand are. - Tests record what the fake Sim stored instead of asserting mock calls. The integration suite removes its audit rows.
…ask for again When Sim's rate limit outlasts every retry, it refused the entry outright, so the result lists exactly what landed instead of being outcome unknown. An import where nothing landed is no longer marked do-not-retry.
- The desktop import and browser file routes refuse the dedicated MCP host themselves, as the proxy did before they left its matcher. - The import's execution token travels in a header, not the query string, so it stays out of load balancer, CDN and trace URLs. - A name that trims to nothing or to a dot segment is refused at the contract and, for the whole import, before anything lands, through one shared rule. Such a name no longer surfaces as a 500 part way through. - The browser download route also requires a declared length and refuses a body that does not match it. - Route tests cover 411, 413, a length mismatch, an entry that is not admitted reading no body, the 401 mappings, the missing token header and an unstorable name.
…red length The truncation check applies whenever a download declares its length. A shell already in use that streams one without a length is still accepted under the byte ceiling. The E2E fixture's import route now refuses a file without a declared length, as Sim's does, so the device is proven to send one.
797cb63 to
06877f0
Compare
|
@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 26 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
Summary
A chat whose turn runs on the desktop can now import a local file or folder into the workspace while the user is in another chat, tab or workspace. Until now the background executor answered
import_local_filesas not run.Builds on #8668 (the background executor), now on staging.
Sim
PUT /api/desktop/tool/importstores one entry of a claimed import, either a directory or a file whose bytes are the raw body, capped at 64 MB.import_local_filesbound to that device;x-sim-execution-tokenheader rather than the query, so the token stays out of load balancer, CDN and trace URLs./api/desktop/tool/importand/api/desktop/tool/fileare left out of the proxy matcher. Running the proxy makes Next buffer the body and cut it at 10 MB, which also silently truncated staging's browser downloads above that. Both routes refuse the dedicated MCP host themselves, as the proxy did. The download route also checks a declared length against what arrived; a download without one is still accepted from shells already in use.Desktop
@sim/desktop-bridge/tool-results. The chat view's import and the background import report the same shapes.Tests
Integration (
import.integration.ts, real Postgres and file storage):Unit (
runner.test.ts, real files on disk):These were verified red against the previous runner.
E2E, scenario D in
background-executor.spec.ts: a folder holding a 9 MB file, which crosses Electron in several chunks, is imported while the window shows another chat. Sim receives the tree once, byte for byte. The full suite (A–H) passes.Type of Change
Checklist