Skip to content

chore(sdk): share process kill between commands and PTY, share CLI --language parser, drop unused internal exports - #1993

Merged
mishushakov merged 1 commit into
mainfrom
devin/1792393434-sdk-dead-code
Oct 19, 2026
Merged

mishushakov merged 1 commit into
mainfrom
devin/1792393434-sdk-dead-code

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A mechanical de-duplication and dead-export cleanup across the SDKs and CLI. Behavior and public API stay the same.

Removed / de-duplicated

  • Process kill (JS, Python sync and async): Commands.kill and Pty.kill had the same SendSignal(SIGKILL) body, with NotFound → false and health-check error mapping. Both now delegate to one shared helper:
    • JS: killProcess(rpc, pid, signal, checkHealth) in packages/js-sdk/src/envd/rpc.ts
    • Python: kill_process / akill_process in packages/python-sdk/e2b/envd/rpc.py, which follow the existing handle_rpc_exception_with_health / ahandle_… pairing
    • Removes the Code / ConnectError / Signal imports that are no longer used.
  • CLI --language option parser: the same validator was inlined in template init and template migrate. It is now one shared parseLanguage in commands/template/generators/types.ts, with the same error message.
  • Unused exports in JS SDK internals: these are only used in their own module and are not reachable from src/index.ts, so they are no longer exported (un-exported, not deleted):
    • isFetchTransportFailure and getEnvdApiErrorMessage (envd/api.ts)
    • formatSandboxUnreachableError (envd/rpc.ts)

I grepped the whole monorepo (tests, examples, other packages) for each symbol before changing it.

Public-API candidates deliberately left in place

  • Python Sandbox.create(secure=…) / AsyncSandbox.create(secure=…): the parameter is ignored but documented as deprecated. Removing it is a breaking change.
  • JS VolumeMetadataOptions / VolumeWriteOptions: deprecated aliases exported from the entry point for backwards compatibility.
  • JS ConnectionConfig.validateApiKey and ConnectionConfig.envdPort: unused inside the SDK, but they are public members of an exported class.
  • JS types used in public signatures but not exported from src/index.ts: PtyCreateOpts, PtyConnectOpts, SandboxUrlOpts, FilesystemListOpts, FilesystemRequestOpts, WatchOpts, GitHubMcpServer, UploadBody. knip flags them as unused exports, but they appear in public method signatures. If anything they should be exported from the entry point, not removed, so I left them for a separate decision.

Not included, to avoid overlap or non-mechanical changes

Checks

  • pnpm run format, pnpm run lint and pnpm run typecheck pass.
  • JS: tests/sandbox/commands/kill.test.ts, tests/sandbox/pty/kill.test.ts, sandboxKilledDuringRun, commandHandle and tests/envd pass (111 tests).
  • Python: test_cmd_kill, test_pty_kill and test_sandbox_killed_during_run pass for both sync and async (10 tests).
  • CLI: template/init.test.ts and template/migrate.test.ts pass (42 tests), and the parseLanguage accept/reject paths were spot-checked.
  • I added a patch changeset (.changeset/share-process-kill.md).

Link to Devin session: https://app.devin.ai/sessions/84e5e0cd7f224b44b138783a32169203
Open in Devin Desktop: https://app.devin.ai/desktop/session/84e5e0cd7f224b44b138783a32169203?variant=devin


Devin Review

…language parser, drop unused internal exports

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@cla-bot cla-bot Bot added the cla-signed label Oct 19, 2026
@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 968edec

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
e2b Patch
@e2b/python-sdk Patch
@e2b/cli Patch
@e2b/code-interpreter-python Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T07:08:52.998063Z 968edec PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TASTE.md review: no violations found in the changed code — parity (T-1, T-1a, T-2), signal threading via getSignal (T-46), kill returning false on NotFound (T-32/T-60) and docstrings (T-69–T-71) checked; the shared killProcess / kill_process / akill_process helpers are internal and keep the public surface unchanged.

Written by Devin

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +251 to +256
export async function killProcess(
rpc: Client<typeof ProcessService>,
pid: number,
signal: AbortSignal | undefined,
checkHealth: SandboxHealthCheck
): Promise<boolean> {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Shared kill paths lack regression coverage

When killProcess replaces both kill implementations, no tests are created or updated for its error paths. Existing kill tests cover success and missing processes, leaving transport failures untested.

Learn more

The repository requires creating or updating tests for affected codepaths. This PR adds shared kill helpers in killProcess, kill_process, and akill_process without changing any tests. Existing kill integration tests cover ordinary success and missing PIDs, but do not cover failures handled by the helpers.

Example: If sendSignal rejects with a transport failure, the helper must preserve the health-check mapping; no new or updated test asserts that behavior.

Recommended fix: Add focused tests for the shared helpers' success, not-found, and health-check failure branches in JS and both Python modes. Update CLI tests for the extracted parseLanguage parser, then run the affected tests.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@github-actions

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 8582191. Download artifacts from this workflow run.

JS SDK (e2b@2.56.1-devin-1792393434-sdk-dead-code.0, with @e2b/dockerfile-utils@0.1.2-devin-1792393434-sdk-dead-code.0):

npm install ./e2b-dockerfile-utils-0.1.2-devin-1792393434-sdk-dead-code.0.tgz ./e2b-2.56.1-devin-1792393434-sdk-dead-code.0.tgz

CLI (@e2b/cli@2.22.1-devin-1792393434-sdk-dead-code.0):

npm install ./e2b-cli-2.22.1-devin-1792393434-sdk-dead-code.0.tgz

Code Interpreter JS SDK (@e2b/code-interpreter@2.9.1-devin-1792393434-sdk-dead-code.0):

npm install ./e2b-code-interpreter-2.9.1-devin-1792393434-sdk-dead-code.0.tgz

Desktop JS SDK (@e2b/desktop@2.5.1-devin-1792393434-sdk-dead-code.0):

npm install ./e2b-desktop-2.5.1-devin-1792393434-sdk-dead-code.0.tgz

Python SDK (e2b==2.56.0+devin.1792393434.sdk.dead.code, with e2b-dockerfile-utils==0.1.1+devin.1792393434.sdk.dead.code):

pip install ./e2b_dockerfile_utils-0.1.1+devin.1792393434.sdk.dead.code-py3-none-any.whl ./e2b-2.56.0+devin.1792393434.sdk.dead.code-py3-none-any.whl

Code Interpreter Python SDK (e2b-code-interpreter==2.11.0+devin.1792393434.sdk.dead.code):

pip install ./e2b_code_interpreter-2.11.0+devin.1792393434.sdk.dead.code-py3-none-any.whl

Desktop Python SDK (e2b-desktop==2.7.0+devin.1792393434.sdk.dead.code):

pip install ./e2b_desktop-2.7.0+devin.1792393434.sdk.dead.code-py3-none-any.whl

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this PR and didn't find any bugs. The refactor looks behavior-preserving, but the repo's CODEOWNERS file covers every path, so a code owner should still sign off.

What was reviewed:

  • JS killProcess and Python kill_process/akill_process: they send the same SIGKILL request, return false on NotFound, and route other errors through the health-check handlers. The signal and timeout values reach the RPC exactly as they did before.
  • The new imports don't create a cycle. e2b.envd.utils, process_pb and process_connect don't import e2b.envd.rpc, and in the JS SDK process_pb doesn't import envd/rpc.
  • The un-exported helpers (isFetchTransportFailure, getEnvdApiErrorMessage, formatSandboxUnreachableError) are only referenced in their own modules. parseLanguage keeps the same validation and error message.
Extended reasoning...

The change moves duplicated SIGKILL logic in the JS SDK and both Python SDKs (sync and async) into shared helpers. It also shares the CLI --language parser and stops exporting three internal JS helpers. It touches no auth, crypto or data-exposure code. The code matches the old inline logic, and I found no import cycles or remaining external uses of the removed exports. I deferred because CODEOWNERS assigns the whole repository to one owner, which rules out an automatic approval.

@mishushakov
mishushakov merged commit 999782e into main Oct 19, 2026
46 of 50 checks passed
@mishushakov
mishushakov deleted the devin/1792393434-sdk-dead-code branch October 19, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant