Skip to content

feat: add direct sandbox workspace preview#7316

Draft
c121914yu wants to merge 2 commits into
labring:mainfrom
c121914yu:feat-sandbox-preview
Draft

feat: add direct sandbox workspace preview#7316
c121914yu wants to merge 2 commits into
labring:mainfrom
c121914yu:feat-sandbox-preview

Conversation

@c121914yu

Copy link
Copy Markdown
Collaborator

What changed

  • Add a read-only workspace preview server to fastgpt-ide-agent and expose it through agent-sandbox-proxy at /preview/{token}/{path}.
  • Sign two-hour preview tickets in FastGPT, verify them through the existing backchannel, and resolve the matching sandbox endpoint without exposing an upstream host to the browser.
  • Support GET, HEAD, ETag, content length/type, and single byte ranges while rejecting traversal and symlinks that escape the workspace root.
  • Replace HTML preview and sandbox_get_file_url S3 uploads with direct workspace URLs so relative HTML assets continue to work.
  • Send proxy verification tickets in X-Sandbox-Ticket, document token redaction requirements, and keep the proxy origin separate from the FastGPT application origin.
  • Remove the unsupported E2B provider implementation, configuration, dependency, environment variables, and tests. OpenSandbox and Sealos Devbox remain supported.
  • Update the sandbox design and Chinese/English self-hosting environment documentation.

Why

The previous preview flow uploaded generated files to S3 and returned independent object URLs. That added storage work and made multi-file previews unreliable because relative assets such as CSS, JavaScript, and images no longer resolved against the sandbox workspace.

The proxy now treats the signed ticket as a time-limited read-only capability for the workspace and streams files directly from the running sandbox.

Impact and rollout

  • Preview links expire after two hours and grant read-only access to the ticket's workspace.
  • Preview tickets share the proxy browser origin; cross-ticket browser storage isolation is not provided under the current product assumption that unrelated users do not open previews in the same browser profile.
  • FastGPT, agent-sandbox-proxy, and the sandbox runtime image must be deployed together. Mixed-version rolling deployment is not supported.
  • Absolute asset paths such as /assets/app.js remain unsupported; generated previews must use relative asset paths.
  • Existing editor upload/download and workspace archive paths are unchanged.

Validation

  • pnpm --filter @fastgpt-sdk/sandbox-adapter test (226 passed, 55 skipped)
  • pnpm --filter @fastgpt/service test (3,280 passed, 35 skipped)
  • pnpm --filter @fastgpt/app typecheck
  • pnpm --dir document exec fumadocs-mdx
  • git diff --check upstream/main...HEAD
  • Rebased onto current upstream/main; git range-diff confirms both feature commits are unchanged.

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 18.43% 1632 / 8855
🔵 Statements 18.41% 1713 / 9300
🔵 Functions 16.21% 342 / 2109
🔵 Branches 15.1% 759 / 5024
File CoverageNo changed files found.
Generated in workflow #1464 for commit cd49829 by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown

Admin Preview Image Ready!

ghcr.io/labring/fastgpt-pr:admin_cd498290d675add4928d4b3a2ed36f3cfdc85a6c

🕒 Time: 2026-07-16 16:27:07 (UTC+8)

@github-actions

Copy link
Copy Markdown

Docs Preview Deployed!

🔗 👀 Click here to visit preview

ghcr.io/labring/fastgpt-docs-pr:cd498290d675add4928d4b3a2ed36f3cfdc85a6c

🕒 Time: 2026-07-16 16:27:22 (UTC+8)

@github-actions

Copy link
Copy Markdown

Build Successful - Preview fastgpt Image for this PR:

ghcr.io/labring/fastgpt-pr:fastgpt_cd498290d675add4928d4b3a2ed36f3cfdc85a6c

🕒 Time: 2026-07-16 16:31:32 (UTC+8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant