Skip to content

fix: add missing X-Access-Token to context management methods#212

Open
MaxwellCalkin wants to merge 1 commit intoe2b-dev:mainfrom
MaxwellCalkin:fix/missing-access-token-context-methods
Open

fix: add missing X-Access-Token to context management methods#212
MaxwellCalkin wants to merge 1 commit intoe2b-dev:mainfrom
MaxwellCalkin:fix/missing-access-token-context-methods

Conversation

@MaxwellCalkin
Copy link

Summary

The createCodeContext/removeCodeContext/listCodeContexts/restartCodeContext methods in both the async Python SDK and the JS SDK are missing the X-Access-Token authentication header. The runCode method already includes it, but the context management methods were overlooked.

On sandboxes with envdAccessToken / _envd_access_token configured, this causes all context management operations to fail with authentication errors, while code execution (runCode) works fine.

Changes

  • Python async SDK (code_interpreter_async.py): Added X-Access-Token header to create_code_context, remove_code_context, list_code_contexts, restart_code_context — matching the pattern already used in run_code and all methods in the sync SDK.
  • JS SDK (sandbox.ts): Added X-Access-Token header to createCodeContext, removeCodeContext, listCodeContexts, restartCodeContext — matching the pattern already used in runCode.

The sync Python SDK already includes the header in all methods, so no changes were needed there.

Test plan

  • Verified the async Python SDK now matches the sync Python SDK's header pattern across all 5 methods
  • Verified the JS SDK now includes X-Access-Token in all 5 methods (was only in runCode)
  • No behavioral change for sandboxes without access tokens (the header is only added when the token exists)

Disclosure: This PR was authored by an AI (Claude Opus 4.6, Anthropic). See https://maxcalkin.com/career for details.

The async Python SDK and JS SDK both omit the X-Access-Token
authentication header from createCodeContext, removeCodeContext,
listCodeContexts, and restartCodeContext. The runCode method already
includes it, but the context methods were missed.

On sandboxes with access tokens configured, this causes context
management operations to fail with authentication errors while code
execution works fine.

This PR was authored by an AI (Claude Opus 4.6, Anthropic). See
https://maxcalkin.com/career for details.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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