Repository navigation
fix(sandbox): 修复分页、PTY 断连及 Envd/Git 鉴权 - #476
Merged
miclle merged 14 commits intoNov 18, 2026
Merged
Conversation
DROWNING2003
marked this pull request as ready for review
November 18, 2026 01:57
Contributor
Author
|
/review |
Contributor
Author
|
/review |
Contributor
Author
|
/review |
There was a problem hiding this comment.
No reportable defects were found after reviewing every changed file and tracing pagination, process selectors, PTY lifecycle and callbacks, signed file URLs, and Git credential cleanup. All 353 local tests passed with both Requests 2.34.2 and 2.27.1; 12 live integration tests were skipped because external credentials were unavailable.
Reviewed head commit: 575b85911b5bcc86fa862b87818e71ccf08cf419
miclle
reviewed
Nov 18, 2026
Contributor
|
LGTM |
miclle
approved these changes
Nov 18, 2026
Merged
miclle
added a commit
that referenced
this pull request
Nov 18, 2026
准备发布 Python SDK v7.20.0,包含已合并的 #476。更新包版本和 CHANGELOG,说明 Sandbox 分页返回格式的迁移方式,以及 PTY、Git 凭据和 Envd 文件访问的变化。 发布附件为 wheel、源码包和 SHA256SUMS。
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.
沙箱列表没有交付响应头游标,PTY 缺少实时字节与断流入口,读取和清理并发时还可能重复归还 HTTP 连接;临时 Git 凭据可能被已有 helper 保存,Envd 请求还会在重定向时带出访问 token。本 PR 补齐运行时能力并修正这些请求行为。
Client.list_sandboxes使用/v2/sandboxes,直接返回{'items': [...], 'nextToken': ...};删除重复的_page/_v2入口,高层分页器和调用同步迁移,响应头游标优先。+、&、=、%、中文和空格;已格式化的字符串仍直接传递。SandboxError并关闭响应,避免凭据或请求内容发往跳转目标。process: {'pid': ...}或{'tag': ...},移除错误的selector嵌套,修复重连、输入、关闭 stdin、PTY 缩放和 kill 的 501 错误;PTY 集成测试不再把此类错误直接跳过。create()/connect()支持on_data(bytes)。首帧含 PTY 输出时,回调在调用线程执行,异常从create()/connect()直接抛出。后续帧由后台线程调度on_data。未提供on_data时,首次wait()启动后台读取,传给wait()的 stdout/stderr 回调仍在调用线程执行。disconnect()立即冻结已处理的输出并释放等待者,包括首个wait(),远端进程可重连。已调度的回调可以稍后执行,迟到的输出和异常不会改写冻结结果。实际非零退出和原始异常按选项传播。credential.username,临时 Git 命令隔离继承的 helper。独立目录、askpass、命令和清理使用同一指定用户,清理错误不会覆盖原异常。验证:以下 HTTP 清理修复的本地基线为 Sandbox 353 项通过、12 项云端用例跳过,公开 CI 用例 421 项通过,flake8 和旧版语法检查通过。真实本地 HTTP 回归覆盖 keep-alive 和
Connection: close,旧实现可复现同一连接被归还两次,修复后只归还一次。urllib3 1.26 和 2.8 的断连回归通过。Windows 用例由服务端结束流,覆盖 shutdown 未立即唤醒读线程的情况。另通过本地 Git/credential store、重定向鉴权和原始 Go metadata 解码验证。远端 CI:
cdca6bd的 Linux 七项和 Windows 三项全部通过。CI 结果真实云端验证(七牛扬州环境):模板列表、创建/执行命令/文件读写/删除、特殊 metadata 筛选、安全沙箱文件访问及签名下载通过。新增两个进程交互用例均通过,无跳过:覆盖按 PID/tag 重连、stdin 写入/EOF、kill,以及 PTY 重连、输入输出、缩放和 kill。修复前可稳定复现 501,修复后同一沙箱中的对应操作通过。测试沙箱均已清理。补测使用沙箱内隔离的 HTTPS Git 服务,实际认证 clone/commit/push/pull、远端文件内容、remote 凭据清理及 credential store 隔离均通过;外部 Git 托管平台的权限和组织策略尚未验证。
兼容 SDK 另测:
e2b-code-interpreter 2.6.0 + e2b 2.7.0的 Python/JavaScript 执行、日志/结果流、上下文、代码异常、PNG 和超时恢复通过;e2b-desktop 2.3.0 + e2b 2.7.0的截图、鼠标、实际 ASCII 键盘输入和开启认证的 noVNC 页面通过。补测e2b-code-interpreter 2.10.0 + e2b 2.44.0,用官方E2B_VALIDATE_API_KEY=false开关关闭本地格式检查后,解释器执行、上下文、PNG 和超时恢复均通过。更新版本的POST /v2/sandboxes创建接口仍与扬州环境不兼容;中文桌面输入存在丢字,完整视觉 Agent 未测试;已同步 skill PR #13。本轮 review:后台命令句柄被丢弃后,未读完的 HTTP 流在回收时归还连接池槽位。显式凭据 clone 会移除输入 URL 原有的用户名和密码,并以显式用户名认证。迁移示例列出已移除的
list_sandboxes_v2/listSandboxesV2和单页的['items']写法。d4fd0dd的本地 Sandbox 测试 354 项通过,12 项云端用例跳过。