Skip to content

@blaxel/core 0.3.19: forks take their env on the fork request - #7151

Merged
saddlepaddle merged 3 commits into
mainfrom
blaxel-sdk-fork-envs
Sep 4, 2026
Merged

saddlepaddle merged 3 commits into
mainfrom
blaxel-sdk-fork-envs

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Sep 4, 2026 •

Copy link
Copy Markdown
Collaborator

What

@blaxel/core 0.3.11 → 0.3.19, and forks take their env on the fork request.

Blaxel's fork doc added envs on fork(). That replaces the spec update, and the restart it caused, that used to hand a fork its identity: forkSandbox is one call, promoting a workspace blanks its identity on the fork request instead of stripping it afterwards, and updateSandbox is gone from the module.

bunfig.toml excludes @blaxel/core from the 3-day release-age guard. 0.3.17 through 0.3.19 all shipped within a day, the pin is exact, and this SDK ships sandbox fixes we depend on within hours.

One caveat, verified twice

Fork envs reach processes only when the sandbox runtime baked into the image is current. On a golden built 2026-09-02 they landed in the spec and no process saw them, PID 1 included, because a fork resumes the source's runtime with the source's env. On a golden rebuilt 2026-09-03 every process saw them, and fork plus get took under half a second. So the boot script's exec carries the same env as a guard for goldens from before that rebuild, and docs/cloud-sandbox-mismatches.md records it. Both goldens were re-released on the rebuilt base with this code: dev env-internal-mtm5u71e, prod env-internal-mtm5z9zc, every probe check green.

Evidence

  • bun run sandbox:release (dev, full base rebuild on 0.3.19): golden checks and the fork probe all pass, host-service answering 18 s after the fork started, dependencies intact, both provider keys reachable, Electron up.
  • Through the desktop: a workspace created from the Superset (fork) environment with Claude reached ready in 12 s instead of about 25 s; the marker was written, the claude process ran with its prompt, and it answered in the adopted pane.
  • fork(name, { envs }) on the rebuilt golden: exec_sees_fork_env=yes, every process has it, 475 ms for fork plus get.
  • Empty values override inherited ones, which is what promote relies on: a golden's NODE_ENV=production came back as an empty, set variable on a fork that passed NODE_ENV="".

Not in this PR

Summary by CodeRabbit

  • Bug Fixes

    • Forked sandboxes now receive workspace environment variables correctly during creation.
    • Empty environment variable values override inherited values as expected.
    • Environment promotion now removes inherited identity and credential variables.
    • Forked sandbox startup processes receive the appropriate workspace variables.
  • Documentation

    • Clarified environment variable override behavior and how to apply egress routing changes to existing forks.
  • Chores

    • Updated the Blaxel SDK version used by the project.

…request

The fork request carries the workspace's env now, so the spec update and the
restart that used to follow a fork are gone: a workspace from the Superset
environment reaches ready in 12s instead of ~25s, and host-service, the
launched agent and the terminals all see their identity. The boot script's
exec carries the same env for goldens whose sandbox runtime predates the
feature (verified: a golden built 2026-09-02 shows fork envs to no process,
one rebuilt 2026-09-03 shows them to all). Promoting a workspace blanks its
identity on the fork request instead of stripping it with a spec update, so
updateSandbox is gone from the module.

bunfig excludes @blaxel/core from the release-age guard: the pin is exact and
the SDK ships sandbox fixes we depend on within hours.
@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 5260f00c-b753-4fb4-a448-21253b8237c9

📥 Commits

Reviewing files that changed from the base of the PR and between 3ad74c6 and 86b4092.

📒 Files selected for processing (2)
  • docs/cloud-sandbox-mismatches.md
  • package.json

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The Blaxel SDK is upgraded to 0.3.19. Forked sandboxes receive workspace environment variables during creation and host-service startup. Environment promotion clears inherited identity variables through empty overrides. Documentation records the overwrite behavior and routing update procedure.

Changes

Sandbox environment propagation

Layer / File(s) Summary
SDK version and release configuration
bunfig.toml, package.json, packages/trpc/package.json
The Blaxel SDK version changes to 0.3.19. The package is excluded from the release-age guard. The check:i18n script is removed.
Fork environment propagation
packages/trpc/src/lib/blaxel/blaxel.ts
forkSandbox passes workspace variables in the fork request and to the asynchronous host-service startup process.
Promotion identity cleanup
packages/trpc/src/lib/blaxel/blaxel.ts, docs/cloud-sandbox-mismatches.md
Golden-sandbox forks set inherited identity variables to empty strings. The follow-up sandbox update is removed. Documentation describes overwrite behavior and post-fork routing updates.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 86b40

Forked sandboxes now receive workspace environment variables during creation, while promoted sandboxes clear inherited identity values. No concrete current-head issue remains that blocks merge.

Sequence Diagram(s)

sequenceDiagram
  participant forkSandbox
  participant BlaxelAPI
  participant host-service
  forkSandbox->>BlaxelAPI: Create fork with workspace environment variables
  BlaxelAPI->>host-service: Start process with workspace environment variables
Loading

Suggested reviewers: kitenite

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the core SDK upgrade and the related fork environment change. It is directly related to the main changes, although it does not use the repository's conventio…
Description check ✅ Passed The description explains what changed, why the change was needed, compatibility caveats, testing evidence, and out-of-scope behavior. It is mostly complete, although it does not include the template's…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title clearly and concisely identifies the core SDK upgrade and the related fork environment change. It is directly related to the main changes, although it does not use the repository's conventional commit format.

Full details: Description check

Explanation

The description explains what changed, why the change was needed, compatibility caveats, testing evidence, and out-of-scope behavior. It is mostly complete, although it does not include the template's exact headings or checklist.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch blaxel-sdk-fork-envs

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.

@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR upgrades @blaxel/core to 0.3.19 and moves cloud-sandbox identity assignment and cleanup into fork requests, with a boot-script environment fallback for older goldens.

  • Passes workspace environment values directly when creating sandbox forks.
  • Blanks inherited workspace identity when promoting a sandbox into a reusable environment.
  • Exempts the exactly pinned SDK from Bun’s minimum release-age guard and documents the runtime compatibility caveat.
  • Accidentally removes an i18n command that the required CI workflow still invokes.

Confidence Score: 4/5

The sandbox changes appear sound, but the removed root i18n script must be restored or its CI caller updated before merging.

The required lint workflow still invokes bun run check:i18n after this change deletes that root script, so CI will fail before validating generated locale files.

Files Needing Attention: package.json, .github/workflows/ci.yml

Important Files Changed

Filename Overview
packages/trpc/src/lib/blaxel/blaxel.ts Replaces post-fork spec mutation with fork-time environment injection and blanks inherited identity during environment promotion.
package.json Upgrades the SDK but also removes the root i18n script still required by CI.
bunfig.toml Adds the exactly pinned SDK to the minimum-release-age exception list.
docs/cloud-sandbox-mismatches.md Documents fork environment propagation differences between old and rebuilt golden runtimes.
bun.lock Locks @blaxel/core 0.3.19 and its updated dotenv dependency.
packages/trpc/package.json Aligns the tRPC package with @blaxel/core 0.3.19.

Sequence Diagram

sequenceDiagram
  participant Provisioner
  participant Golden as Golden sandbox
  participant Fork as Workspace fork
  participant Host as /app/start.sh
  Provisioner->>Golden: "fork(name, { envs: workspaceEnv })"
  Golden-->>Fork: Fork with workspace identity
  Provisioner->>Fork: exec /app/start.sh with workspaceEnv
  Fork->>Host: Start host service
  Host-->>Provisioner: Readiness via health polling
Loading
Prompt To Fix All With AI
### Issue 1
package.json:47
**Removed script breaks CI**

When the lint workflow runs, it still invokes `bun run check:i18n` from the repository root, but this change removes that script, causing the required CI job to fail before locale changes are validated.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(sandbox): @blaxel/core 0.3.19, fork..." | Re-trigger Greptile

Comment thread package.json
"clean:workspaces": "turbo clean",
"release": "bun scripts/release/release.ts",
"release:desktop": "bun scripts/release/desktop.ts",
"release:cli": "bun scripts/release/cli.ts",

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 Removed script breaks CI

When the lint workflow runs, it still invokes bun run check:i18n from the repository root, but this change removes that script, causing the required CI job to fail before locale changes are validated.

Prompt To Fix With AI
This is a comment left during a code review.
Path: package.json
Line: 47

Comment:
**Removed script breaks CI**

When the lint workflow runs, it still invokes `bun run check:i18n` from the repository root, but this change removes that script, causing the required CI job to fail before locale changes are validated.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@github-actions

github-actions Bot commented Sep 4, 2026 •

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 Admin (Vercel) ✅ Open Preview
Vercel Docs (Vercel) ✅ Open Preview

Preview updates automatically with new commits

@cubic-dev-ai cubic-dev-ai Bot left a comment •

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.

1 issue found across 6 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/trpc/src/lib/blaxel/blaxel.ts">

<violation number="1" location="packages/trpc/src/lib/blaxel/blaxel.ts:222">
P2: The promote path now blanks identity envs (including the git token) with empty-string values on the fork request instead of removing them from the spec. This is secure only if the fork server actually applies empty-string overrides to inherited values; if it ignores or skips them, the golden keeps the promoter's token and every later workspace inherits it. Confirm empty-value override semantics on a fork, and add a test that a public-repo workspace forked from the promoted golden does not see SUPERSET_SANDBOX_GIT_TOKEN from the promoter.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant Workspace as Workspace Service
    participant Blaxel as Blaxel Sandbox API
    participant Sandbox as Forked Sandbox
    participant Runtime as Sandbox Runtime
    participant Boot as /app/start.sh
    participant Host as Host Service
    participant Proc as Workspace Processes

    Note over Workspace,Blaxel: Workspace fork and promotion use environment values at fork creation time

    Workspace->>Blaxel: Get source sandbox
    Blaxel-->>Workspace: Source sandbox handle

    alt Workspace fork
        Workspace->>Blaxel: fork(name, { envs: workspaceEnv })
        Note over Blaxel,Sandbox: Fork inherits source environment and applies workspaceEnv, values cannot be removed after creation
        Blaxel->>Sandbox: Create fork with requested envs
    else Promote workspace to golden environment
        Workspace->>Blaxel: fork(goldenName, { envs: inheritedIdentity = "" })
        Note over Blaxel,Sandbox: Identity and credential variables are blanked at fork creation
        Blaxel->>Sandbox: Create golden with blank identity values
    end

    Blaxel-->>Workspace: Fork created
    Workspace->>Blaxel: get(name)
    Blaxel-->>Workspace: Sandbox instance

    Workspace->>Sandbox: exec("/app/start.sh", background)
    alt Current sandbox runtime in golden
        Sandbox->>Runtime: Apply fork env to process environment
        Runtime->>Boot: Start boot script with fork env
    else Older sandbox runtime
        Sandbox->>Runtime: Resume source runtime environment
        Runtime->>Boot: Start boot script
        Note over Workspace,Boot: Boot exec receives workspaceEnv explicitly as a compatibility guard
    end

    Boot->>Host: Start host-service
    Host->>Proc: Launch agent and terminal processes
    Proc-->>Host: Processes inherit fork environment
    Host-->>Workspace: Health endpoint becomes ready
    Workspace->>Host: Poll readiness
    Host-->>Workspace: Ready

    Note over Workspace,Blaxel: Egress proxy credentials remain creation-only, fork requests do not set network configuration
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread package.json Resolved
// request: every later workspace forked from this environment would
// otherwise carry the promoter's git token and launch the promoter's agent.
await source.fork(args.goldenName, {
envs: [...INHERITED_IDENTITY_ENVS].map((name) => ({ name, value: "" })),

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.

P2: The promote path now blanks identity envs (including the git token) with empty-string values on the fork request instead of removing them from the spec. This is secure only if the fork server actually applies empty-string overrides to inherited values; if it ignores or skips them, the golden keeps the promoter's token and every later workspace inherits it. Confirm empty-value override semantics on a fork, and add a test that a public-repo workspace forked from the promoted golden does not see SUPERSET_SANDBOX_GIT_TOKEN from the promoter.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/trpc/src/lib/blaxel/blaxel.ts, line 222:

<comment>The promote path now blanks identity envs (including the git token) with empty-string values on the fork request instead of removing them from the spec. This is secure only if the fork server actually applies empty-string overrides to inherited values; if it ignores or skips them, the golden keeps the promoter's token and every later workspace inherits it. Confirm empty-value override semantics on a fork, and add a test that a public-repo workspace forked from the promoted golden does not see SUPERSET_SANDBOX_GIT_TOKEN from the promoter.</comment>

<file context>
@@ -226,7 +214,13 @@ export async function promoteSandboxToEnvironment(args: {
+	// request: every later workspace forked from this environment would
+	// otherwise carry the promoter's git token and launch the promoter's agent.
+	await source.fork(args.goldenName, {
+		envs: [...INHERITED_IDENTITY_ENVS].map((name) => ({ name, value: "" })),
+	});
 
</file context>

Comment thread docs/cloud-sandbox-mismatches.md Resolved

This branch was previously deployed

1 inactive deployment
preview — 86b4092e Deployed Sep 4, 2026 by saddlepaddle via Deploy API #9103
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.

1 participant