Repository navigation
Conversation
Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>
This branch has not been deployed
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.
Fixes #5874
Description
The E2B connection wizard can fail with a 401 saying the authorization header is missing. The Go E2B SDK sends the configured key in
X-API-Key. E2B-compatible gateways that require bearer authentication can reject that request even when the key itself is valid.Keep
X-API-Keyas the default. When the configured control plane explicitly returns the missing-header 401, retry once with the same key asAuthorization: Bearer. The shared E2B transport applies the fallback to connection checks, template discovery, and lifecycle requests. Existing API-key endpoints still authenticate in one request, and ordinary invalid-key errors still reach the caller.Type of Change
Related Issue
Fixes #5874
Testing
Tests:
go test -count=1 -v ./internal/handler -run '^TestSandboxConnectionCheckE2BControlPlaneAuth$'.Result: go test -count=1 -v ./internal/handler -run '^TestSandboxConnectionCheckE2BControlPlaneAuth$': base exit 1 with the reproduced 401 and a failed OK assertion; patched exit 0 with all three cases passing.
Result: go test -count=1 ./internal/sandbox ./internal/handler -run 'Test(E2B|SandboxConnectionCheckConfig|SandboxCheckReason|.*RemoteTemplate)' -skip '^TestE2BRemoteClient(ControlPlaneBearerFallback|DoesNotRetryBearerOutsideControlPlane)$': existing tests passed before the production fix. The initial broader-regex run overlapped a test-only edit and failed to compile the handler; the clean rerun passed both packages.
Result: go test -count=1 ./internal/sandbox/... ./internal/handler: all five packages passed on the final patch.
Result: go test -count=1 ./internal/application/service -run '^Test(QueryTemplates|SanitizeSandboxConfig)': passed.
Result: node --test frontend/src/components/SandboxConfigEditorDrawer.template.test.mjs frontend/src/components/SandboxConfigEditorDrawer.network.test.mjs: 16 passed.
Result: /tmp/oss5874-lint/golangci-lint-2.12.2-linux-amd64/golangci-lint run --new-from-patch=/tmp/oss5874-lint/changes.patch ./internal/sandbox ./internal/handler: final exit 0, 0 issues.
Regression coverage:
internal/handler/sandbox_check_test.go.The regression uses a local HTTP gateway fixture. The reporter's live deployment and the full repository gate were outside the verification scope.
Checklist
git diff --check origin/main...HEADpassesgolangci-lint run --new-from-rev=origin/main ./...)website-docs/, Swagger annotations, etc.)Screenshots / Recordings
Backend authentication change.