fix(notebooks): fall back to SITE_URL for sandbox callback URLs in prod#73018
Draft
sinan-ku wants to merge 1 commit into
Draft
fix(notebooks): fall back to SITE_URL for sandbox callback URLs in prod#73018sinan-ku wants to merge 1 commit into
sinan-ku wants to merge 1 commit into
Conversation
The SQLV2 kernel sandbox was handed http://host.docker.internal:8000 as its callback and data-plane base URL whenever SANDBOX_API_URL was unset — a dev-only Docker alias that is unreachable from a remote sandbox, so kernel-lane runs never delivered their result envelope and stayed RUNNING forever. Keep the host.docker.internal fallback for DEBUG (the kernel runs in local Docker, where SITE_URL would be an unreachable localhost) and fall back to SITE_URL otherwise, matching the tasks sandbox URL resolution. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Kernel-lane SQLV2 notebook runs (python/duckdb) never complete outside local dev. The sandbox is handed its callback and data-plane base URL by
_backend_base_url(), which falls back tohttp://host.docker.internal:8000wheneverSANDBOX_API_URLis unset. That's a dev-only Docker alias, unreachable from a remote sandbox, so the kernel executes the code but can never POST the result envelope back to/internal/notebooks/runs/<run_id>/result/(or reach the data plane). The run row staysRUNNINGforever and the node spins indefinitely, even for a trivialprint(1+2).Changes
_backend_base_url()now resolves in order:SANDBOX_API_URLif set (e.g. an ngrok tunnel for driving a Modal sandbox from local dev)http://host.docker.internal:8000underDEBUG(the local kernel runs in Docker, whereSITE_URLwould be an unreachable localhost)SITE_URLotherwiseThis matches how the tasks product resolves its sandbox API URL (
SANDBOX_API_URL or SITE_URL), with the extra dev branch because notebooks' local kernel lives in a Docker container.How did you test this code?
Added
TestSQLV2BackendBaseURL(parameterizedSimpleTestCase, no DB) covering the three branches throughbuild_callback_url. It catches the regression that shipped: a deployed environment withoutSANDBOX_API_URLhanding the sandbox a dev-only unreachable URL - no existing test exercised these URL builders. Ran locally: 3 passed.Automatic notifications
Docs update
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Authored with Claude Code. Skills invoked: /writing-tests. Root cause was diagnosed in an earlier session by tracing prod run rows and service logs: stuck-running kernel runs with zero requests ever hitting the callback or data-plane endpoints, pointing at the unreachable fallback URL. Considered fixing this purely via deployment env (
SANDBOX_API_URLon the worker fleet) but the code-sideSITE_URLfallback works with no deploy coordination and mirrors the existing tasks sandbox behavior; the env override remains available on top.