Skip to content

Conversation

@xxchan
Copy link
Collaborator

@xxchan xxchan commented Jan 21, 2026

Summary

Add E2B sandbox integration to kaos, enabling execution of kaos operations in E2B cloud sandboxes.

To run:

uv run examples/kimi-cli-e2b-kaos/main.py

Changes

  • E2BKaos implementation: Add E2BKaos class in kaos.contrib.e2b that implements the Kaos interface for E2B sandboxes, supporting:

    • File operations (read/write text and bytes, stat, exists, mkdir, rm, glob, etc.)
    • Process execution with streaming output
    • Path manipulation for sandbox environments
  • New optional dependency: Add contrib optional dependency group with e2b>=2.10.2,<3.0.0

  • Example project: Add kimi-cli-e2b-kaos example demonstrating how to use E2BKaos with kimi-cli

  • Skill update: Update pull-request skill to wait for CI after PR submission


Open with Devin

- Add E2BKaos implementation in kaos.contrib.e2b
- Add contrib optional dependency group with e2b>=2.10.2,<3.0.0
- Add kimi-cli-e2b-kaos example project
- Update pull-request skill to wait for CI after PR submission
Copilot AI review requested due to automatic review settings January 21, 2026 08:54
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5296a45db6

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds E2B sandbox integration to the kaos package, enabling execution of kaos operations in E2B cloud sandboxes. The implementation includes a new E2BKaos class that implements the Kaos protocol interface, along with supporting infrastructure and an example demonstrating its usage.

Changes:

  • Add E2BKaos class implementing the Kaos interface for E2B sandboxes
  • Add optional contrib dependency group with e2b>=2.10.2,<3.0.0
  • Add example project demonstrating E2BKaos integration with kimi-cli
  • Update pull-request skill to wait for CI after PR submission

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
uv.lock Adds e2b package and its dependencies (bracex, dockerfile-parse, protobuf, wcmatch) to the lock file
packages/kaos/src/kaos/contrib/e2b.py Implements E2BKaos class with file operations, process execution, and path manipulation for E2B sandboxes
packages/kaos/src/kaos/contrib/__init__.py Adds contrib module docstring explaining optional integrations
packages/kaos/pyproject.toml Adds contrib optional dependency group with e2b requirement
packages/kaos/CHANGELOG.md Documents the addition of E2BKaos and contrib dependency group
examples/kimi-cli-e2b-kaos/pyproject.toml Configures example project dependencies and workspace sources
examples/kimi-cli-e2b-kaos/main.py Implements example demonstrating E2BKaos usage with sandbox selection and lifecycle management
examples/kimi-cli-e2b-kaos/agent.yaml Configures agent to exclude Grep tool which only supports local KAOS
examples/kimi-cli-e2b-kaos/README.md Documents example usage, requirements, and configuration options
.agents/skills/pull-request/SKILL.md Adds CI monitoring step to wait for checks to pass after PR creation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

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

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.

View issue and 5 additional flags in Devin Review.

Open in Devin Review

Comment on lines +226 to +242
async def glob(
self, path: StrOrKaosPath, pattern: str, *, case_sensitive: bool = True
) -> AsyncGenerator[KaosPath]:
if not case_sensitive:
raise ValueError("Case insensitive glob is not supported in current environment")
abs_path = self._abs_path(path)
entries: list[EntryInfo] = await self._sandbox.files.list(
abs_path,
depth=1,
user=self._user,
request_timeout=self._request_timeout,
)
for entry in entries:
if entry.path == abs_path:
continue
if self._fnmatch(entry.name, pattern):
yield KaosPath(entry.path)

Choose a reason for hiding this comment

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

🔴 E2BKaos.glob only searches immediate children and matches against filename only, breaking recursive and path-based patterns

The glob method in E2BKaos is fundamentally broken for any pattern that contains path separators or recursive wildcards.

The issue:

  1. It only lists files at depth=1 (immediate children of the directory)
  2. It matches the pattern against entry.name (just the filename, not the relative path)

This means patterns like **/*.py, src/*.py, or subdir/file.txt will never match anything.

Comparison with other implementations:

  • LocalKaos.glob at packages/kaos/src/kaos/local.py:104 uses local_path.glob(pattern) which properly handles recursive patterns
  • SSHKaos.glob at packages/kaos/src/kaos/ssh.py:217 uses self._sftp.glob(f"{real_path}/{pattern}") which also handles recursive patterns

Impact:
The Glob tool (src/kimi_cli/tools/file/glob.py:114) calls dir_path.glob(params.pattern) expecting patterns like **/*.py to work. With E2BKaos, these calls will return no results or incorrect results, silently failing to find files that exist in subdirectories.

Recommendation: Implement proper glob pattern matching that handles recursive patterns (**) and path-based patterns. Either use the E2B SDK's built-in glob functionality if available, or implement recursive directory traversal when the pattern contains ** or path separators. The pattern should be matched against the relative path from the base directory, not just the filename.

Open in Devin Review

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

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.

2 participants