Repository navigation
@blaxel/core 0.3.19: forks take their env on the fork request - #7151
Conversation
…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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe Blaxel SDK is upgraded to ChangesSandbox environment propagation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to 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
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Title checkExplanation 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 checkExplanation 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 CoverageExplanation 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.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThe PR upgrades
Confidence Score: 4/5The 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 Files Needing Attention: package.json, .github/workflows/ci.yml
|
| 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
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
| "clean:workspaces": "turbo clean", | ||
| "release": "bun scripts/release/release.ts", | ||
| "release:desktop": "bun scripts/release/desktop.ts", | ||
| "release:cli": "bun scripts/release/cli.ts", |
There was a problem hiding this comment.
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.
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
There was a problem hiding this comment.
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
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| // 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: "" })), |
There was a problem hiding this comment.
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>
… spec update is named as such
What
@blaxel/core0.3.11 → 0.3.19, and forks take their env on the fork request.Blaxel's fork doc added
envsonfork(). That replaces the spec update, and the restart it caused, that used to hand a fork its identity:forkSandboxis one call, promoting a workspace blanks its identity on the fork request instead of stripping it afterwards, andupdateSandboxis gone from the module.bunfig.tomlexcludes@blaxel/corefrom 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.mdrecords it. Both goldens were re-released on the rebuilt base with this code: devenv-internal-mtm5u71e, prodenv-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.readyin 12 s instead of about 25 s; the marker was written, theclaudeprocess 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.NODE_ENV=productioncame back as an empty, set variable on a fork that passedNODE_ENV="".Not in this PR
forkstill takes nonetwork, so the egress proxy remains creation-only; environment-level proxy credentials are parked in Proxy credentials for environments #7132 until that changes.Summary by CodeRabbit
Bug Fixes
Documentation
Chores