Skip to content

docs(sandbox): a box's host-service is as new as its last boot - #8854

Closed
superset-app[bot] wants to merge 4 commits into
mainfrom
harshith/attachments-docs-cold-wake
Closed

superset-app[bot] wants to merge 4 commits into
mainfrom
harshith/attachments-docs-cold-wake

Conversation

@superset-app

@superset-app superset-app Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Stacked on #8704. #8704 rewrites the same paragraph in docs/cloud-sandbox-mismatches.md (the clipboard and ingress text), so this branch is built on #8704's head. The base is main; this PR's own change is the last commit. Merge after #8849, which defines the ATTACHMENT_PARTS_MIN_HOST_VERSION it names.

Summary

The docs step of the attachments plan (v6): replace the "frozen host-service" assumption in docs/cloud-sandbox-mismatches.md with 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)

  • A new Lifecycle entry, "A box's host-service is as new as its last boot":
    • A bundle release repins every live environment (release.ts sets environments.bundleSha).
    • Every wake builds the claim from the environment (wakeCloudWorkspace → buildSandboxClaim).
    • On boot, superset-boot installs the pinned bundle when its hash differs (ensure_bundle).
    • A cold wake, a restart or a new box therefore runs the current host-service. A warm resume, or a box that never sleeps, keeps the one it last booted with.
    • Gate new host features on the reported version, as for a remote host.
  • The ingress paragraph from fix(desktop,host-service): send attachments through storage, not host-service bodies #8704 now points to that entry: a box gets the body-buffering fix at its next boot, and one that never sleeps keeps the race until it restarts.

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, and packages/sandbox/src/environments/release.ts (repins all non-archived environments).

Testing

Docs only. No code changes and no tests.

Known limitations

saddlepaddle and others added 4 commits October 20, 2026 23:44
…-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 #8712 commit folded into this branch was based on a newer main that had
changed cloud-workspace.ts's imports. Keep both: listPullRequests from main,
and reapWorkspaceFiles from #8712.
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.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 74b05f56-3711-45c0-b704-93692e68046d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) ✅ View Branch
Vercel API (Vercel) ✅ Open Preview
Vercel Web (Vercel) ✅ Open Preview
Vercel Marketing (Vercel) ✅ Open Preview
Vercel Docs (Vercel) ✅ Open Preview

Preview updates automatically with new commits

@expo

expo Bot commented Oct 24, 2026

Copy link
Copy Markdown

Preview update published for development build db42788c (fingerprint e28b4b490ccc). Open the build on your phone and scan:

Update group ad433110

@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[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

  1. P1 Older hosts reject attachments ▶
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.

Summary

Documents when sandbox boxes receive a newer host-service bundle. The full stacked diff also changes how desktop attachments reach a workspace.

  • Desktop attachments travel through storage and land in the workspace as files.
  • Host-service waits for each tRPC request body before it starts a response.
  • Attachment reads follow workspace visibility and can report missing files individually.
  • Permanently deleted cloud workspaces release their attachment files.
  • The sandbox guide explains which host-service version a box runs.

Acknowledged by superset-app[bot]: the clipboard paragraph intentionally describes the current storage route for relay-reached hosts; a later desktop attachment PR changes it. The author also states that the documented version-floor constant comes from a prerequisite PR and that no live cold-wake update was observed.

Diagram

sequenceDiagram
  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
Loading

Reviews (1) · Last reviewed commit: "docs(sandbox): a box's host-service is a..." · Reviewed by Greptile

Comment on lines +32 to +35
const materialize =
workspaceTrpc.attachments.materializeIntoWorkspace.useMutation();
const materializeRef = useRef(materialize.mutateAsync);
materializeRef.current = materialize.mutateAsync;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Copy link
Copy Markdown
Collaborator

Folded into #9064, which now carries the whole attachments plan (commit list in its description). Closing in favor of that PR.

This branch was previously deployed

1 inactive deployment
preview — cf58cd89 Deployed Oct 24, 2026 by superset-app[bot] via Deploy Docs #12701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants