Repository navigation
docs(sandbox): a box's host-service is as new as its last boot - #8854
superset-app[bot] wants to merge 4 commits into
Conversation
…-service bodies (SUPER-2658) Pasting or dropping an image into a cloud workspace failed with "Failed to send the file to the remote workspace" (terminal) or "Couldn't attach files / value$1 is not iterable" (chat). The desktop was shipping the bytes as a base64 `filesystem.writeFile` body over the streaming tRPC link. tRPC answers a streamed batch before it has read the request body, and a Vercel sandbox's ingress treats that early response as the end of the exchange and drops the upload still in flight — a race, not a size limit: a 500 KB body on a home uplink loses it about half the time. Desktop: the chat composer, the terminal rich input, and the terminal paste/drop override now take the route every other composer already takes (mobile, the new-workspace modal): `attachment.createUpload`, a presigned PUT to storage, `cloudWorkspace.attachFiles` for a box, then `attachments.materializeIntoWorkspace` on the host. The host-service request carries ids, never bytes. `uploadPastedFiles` is replaced by `sendAttachmentsToWorkspace` + `useSendAttachments`. host-service: `/trpc/*` buffers the request body before handing it to tRPC so no response can start before the request is complete; the integration test fails without it. `materializeIntoWorkspace` and the chat image writer share one helper that creates `.superset/attachments` with its `.gitignore`, which the former never wrote.
…ap files with the box
First API step of the attachment plan (SUPER-2874, seam 6).
- attachment.resolve no longer signs a URL for any composer upload in the
org. A kept (ready) file resolves only through a cloud workspace the
caller can see. An upload still in flight (pending) stays org-wide: a
host resolves with its owner's credential, and the sender can be a
teammate on that host. A box still sees only its own workspace's files.
- New attachment.resolveEach returns one entry per id, with
{ fileId, missing: true } for a file that is gone or not visible, so a
transcript can render the rest. resolve keeps its output and errors for
released hosts.
- The archive's final reap stage (and the fallback when it cannot be
queued) detaches and deletes the files anchored to the workspace.
The doc assumed deployed boxes never update their host-service. They do: a bundle release repins every live environment, every wake builds the claim from it, and superset-boot installs the pin when its hash differs. Only a box that never boots again keeps an old bundle. Features gate on the version a box reports, like a remote host.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
|
Preview update published for development build |
[High impact] The PR changes attachment flows and request handling across desktop and host-service workflows. The attachment change needs an older-host fallback before merging. Findings
Fix with agent prompt### Issue 1
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/hooks/useSendAttachments/useSendAttachments.ts:32-35
`useSendAttachments` now always calls `attachments.materializeIntoWorkspace`, but supported remote hosts can lack that procedure. It was added while `host-service` was on version `1.28.0`; `MIN_HOST_SERVICE_VERSION` still permits `1.21.0`. On an older host, attaching a file now uploads it to storage and then fails, where the previous `filesystem.writeFile` path worked.
Check the host's version and keep the direct-write fallback for hosts without this procedure.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryDocuments when sandbox boxes receive a newer host-service bundle. The full stacked diff also changes how desktop attachments reach a workspace.
Acknowledged by DiagramsequenceDiagram
participant Desktop
participant API
participant Storage
participant Host
Desktop->>API: Create attachment upload
API-->>Desktop: File ID and upload URL
Desktop->>Storage: PUT file bytes
opt Cloud workspace
Desktop->>API: Attach file IDs to workspace
end
Desktop->>Host: Materialize file IDs
Host->>API: Resolve file IDs
API-->>Host: Download URLs
Host->>Storage: Download files
Host-->>Desktop: Worktree-relative paths
Reviews (1) · Last reviewed commit: "docs(sandbox): a box's host-service is a..." · Reviewed by Greptile |
| const materialize = | ||
| workspaceTrpc.attachments.materializeIntoWorkspace.useMutation(); | ||
| const materializeRef = useRef(materialize.mutateAsync); | ||
| materializeRef.current = materialize.mutateAsync; |
There was a problem hiding this comment.
Older hosts reject attachments
useSendAttachments now always calls attachments.materializeIntoWorkspace, but supported remote hosts can lack that procedure. It was added while host-service was on version 1.28.0; MIN_HOST_SERVICE_VERSION still permits 1.21.0. On an older host, attaching a file now uploads it to storage and then fails, where the previous filesystem.writeFile path worked.
Check the host's version and keep the direct-write fallback for hosts without this procedure.
Knowledge Base Used: Local host service runtime
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/hooks/useSendAttachments/useSendAttachments.ts
Line: 32-35
Comment:
**Older hosts reject attachments**
`useSendAttachments` now always calls `attachments.materializeIntoWorkspace`, but supported remote hosts can lack that procedure. It was added while `host-service` was on version `1.28.0`; `MIN_HOST_SERVICE_VERSION` still permits `1.21.0`. On an older host, attaching a file now uploads it to storage and then fails, where the previous `filesystem.writeFile` path worked.
Check the host's version and keep the direct-write fallback for hosts without this procedure.
**Knowledge Base Used:** [Local host service runtime](https://app.greptile.com/personal-org-6810/-/custom-context/knowledge-base/superset-sh/superset/-/docs/host-service-runtime.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
Folded into #9064, which now carries the whole attachments plan (commit list in its description). Closing in favor of that PR. |
Summary
The docs step of the attachments plan (v6): replace the "frozen host-service" assumption in
docs/cloud-sandbox-mismatches.mdwith how boxes actually update, on cold wake.Why
On main, the clipboard paragraph says the paste path was "chosen over a new host endpoint because deployed sandboxes never update their baked host-service". #8704 removes that line but adds "a sandbox provisioned before that bundle still has the race", which assumes the same thing. Neither is true today. Design decisions were built on that assumption: the plan's version gate for attachment parts exists because boxes do update, but not all at once.
How it works (what the doc now says)
release.tssetsenvironments.bundleSha).wakeCloudWorkspace→buildSandboxClaim).superset-bootinstalls the pinned bundle when its hash differs (ensure_bundle).I checked each claim against the code on main:
packages/sandbox/bundle/rootfs/usr/local/bin/superset-boot(ensure_bundle),packages/trpc/src/lib/sandbox/claim.ts(SUPERSET_BUNDLE_SHA: environment.bundleSha),packages/trpc/src/router/cloud-workspace/wake.ts, andpackages/sandbox/src/environments/release.ts(repins all non-archived environments).Testing
Docs only. No code changes and no tests.
Known limitations
filesystem.writeFile. That PR updates the paragraph, so the doc changes in the same PR as the behaviour.