-
Notifications
You must be signed in to change notification settings - Fork 406
feat(kaos): add E2B sandbox integration #659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- 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
There was a problem hiding this 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".
There was a problem hiding this 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
E2BKaosclass implementing theKaosinterface for E2B sandboxes - Add optional
contribdependency group withe2b>=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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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) |
There was a problem hiding this comment.
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:
- It only lists files at
depth=1(immediate children of the directory) - 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.globatpackages/kaos/src/kaos/local.py:104useslocal_path.glob(pattern)which properly handles recursive patternsSSHKaos.globatpackages/kaos/src/kaos/ssh.py:217usesself._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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Add E2B sandbox integration to kaos, enabling execution of kaos operations in E2B cloud sandboxes.
To run:
Changes
E2BKaos implementation: Add
E2BKaosclass inkaos.contrib.e2bthat implements theKaosinterface for E2B sandboxes, supporting:New optional dependency: Add
contriboptional dependency group withe2b>=2.10.2,<3.0.0Example project: Add
kimi-cli-e2b-kaosexample demonstrating how to use E2BKaos with kimi-cliSkill update: Update pull-request skill to wait for CI after PR submission