Skip to content

fix(sdk): route Go SDK envd RPCs to the envd port (49983)#821

Merged
ls-ggg merged 1 commit into
TencentCloud:masterfrom
chaojixinren:fix/go-sdk-envd-port
Jul 9, 2026
Merged

fix(sdk): route Go SDK envd RPCs to the envd port (49983)#821
ls-ggg merged 1 commit into
TencentCloud:masterfrom
chaojixinren:fix/go-sdk-envd-port

Conversation

@chaojixinren

@chaojixinren chaojixinren commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #816. Every envd data-plane RPC in the Go SDK was routed to the sandbox's Jupyter port (49999) instead of the envd port (49983), so Commands.Run, Files.*, Filesystem.*, and the Pty from #815 all failed against real deployments (non-2xx — 404 or 502 depending on the template's Jupyter upstream). Only RunCode (/execute) worked, since /execute genuinely lives on the Jupyter port.

Root cause

newEnvdRequest — the shared request builder for all envd RPCs — hardcoded s.GetHost(JupyterPort). CubeProxy routes by the <port>-<sandboxID>.<domain> host prefix, so these requests reached the Jupyter kernel gateway, which does not serve /process.Process/*, /files, or /filesystem.Filesystem/*.

Changes

  • Add a dedicated EnvdPort = 49983 constant (sandbox.go).
  • Use s.GetHost(EnvdPort) in newEnvdRequest (envd.go); RunCode's /execute stays on JupyterPort.
  • Update the affected unit-test host assertions (sdk_test.go) and the README proxy example.

This matches the Python (ENVD_PORT) and Node SDKs, which keep the two ports separate. It's effectively a one-line routing fix — every newEnvdRequest-based API (including the PTY in #815) recovers automatically.

Testing

  • gofmt / go vet ./... clean; go test -race ./... green.
  • Live E2E against a real CubeSandbox (api=127.0.0.1:13000, proxy=127.0.0.1:11080, domain=cube.app): /files read/write and /filesystem.Filesystem/* (mkdir/list/stat) now succeed on 49983. Same-sandbox A/B confirms the routing: identical GET /files returns non-2xx on 49999 but 200 on 49983 — the port prefix is the only difference.

Scope

Routing fix only. A separate, independent framing bug on the streaming /process.Process/Start request (its body isn't Connect-enveloped in startProcess, unlike Python and the Go PTY) is tracked separately and will be its own PR; it does not affect /files or /filesystem.Filesystem/*.

@chaojixinren chaojixinren requested a review from tinklone as a code owner July 8, 2026 11:31
@ls-ggg

ls-ggg commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

LGTM @tinklone @wbzdssm cc

newEnvdRequest — the shared request builder for every envd data-plane
RPC (commands, files, filesystem, and the PTY added in TencentCloud#815) — hardcoded
the Jupyter port (49999) as the virtual host prefix. CubeProxy routes by
that prefix, so these requests reached the Jupyter kernel gateway, which
does not serve /process.Process/*, /files, or /filesystem.Filesystem/*,
yielding a non-2xx error (HTTP 404 or 502, depending on the template's
Jupyter upstream) against real deployments. Only RunCode (/execute)
worked, since /execute genuinely lives on the Jupyter port.

Add a dedicated EnvdPort (49983) constant and use it in newEnvdRequest,
matching the Python (ENVD_PORT) and Node SDKs; RunCode's /execute stays
on JupyterPort. Update the affected unit-test host assertions and the
README proxy example.

Verified against a live CubeSandbox: /files read/write and
filesystem.Filesystem/* now succeed on 49983 (previously non-2xx on
49999).

Closes TencentCloud#816

Signed-off-by: chaojixinren <chaoji_xinren@163.com>
@chaojixinren chaojixinren force-pushed the fix/go-sdk-envd-port branch from 23d4160 to 762660b Compare July 8, 2026 13:20
@ls-ggg ls-ggg merged commit 929ab2a into TencentCloud:master Jul 9, 2026
4 checks passed
@chaojixinren chaojixinren deleted the fix/go-sdk-envd-port branch July 9, 2026 02:32
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.

[Bug Report] Go SDK sends envd data-plane RPCs to the Jupyter port (49999) instead of envd (49983)

4 participants