Commit Graph

8 Commits

Author SHA1 Message Date
7aab7da8aa fix(windows): 超时终止链弃用 CTRL_BREAK_EVENT,修复后端自杀式崩溃
根因(日志实证):沙箱命令超时后 _interrupt_subprocess 发送的
CTRL_BREAK_EVENT 会投递到本进程自身(即使子进程带
CREATE_NEW_PROCESS_GROUP),无保护的后端收到后直接终止,
终端仅显示 ^C、无任何报错。沙箱 git 病态缓慢导致频繁超时,
是该崩溃的触发器(已由上一个提交的 git 配置修复)。

- terminal_ops/run.py: Windows 超时中断直接 taskkill /F /T 杀整棵树
  (抽出共用 _taskkill_tree),不再尝试 CTRL_BREAK 优雅中断
- background_command_manager.py: _terminate_pid 同步弃用 CTRL_BREAK
- 拆除全部 [SBX-DEBUG] 诊断埋点,删除 modules/sbx_debug.py
  (探针会吞掉 Ctrl+C,诊断任务完成,归还正常信号行为)
2026-07-31 19:33:43 +08:00
04c9db8a5b feat(windows): 沙箱最小根文件系统与崩溃排查调试埋点 2026-07-31 17:51:05 +08:00
493ac160eb fix(windows): 平台适配与稳定性修复(进程终止/编码/原子写/事件竞态/子智能体)
- 进程终止:Windows 用 CTRL_BREAK + taskkill /F /T 替代不存在的 killpg/SIGKILL,
  超时/取消全路径有界;_is_pid_alive 改 ctypes(原 os.kill(pid,0) 在 Windows 会真杀进程);
  reader 任务 finally 收口,消除 Task was destroyed but it is pending / unclosed transport
- 子智能体调度链:_run_coro 超时 60s + 失败 cancel/close 防幽灵协程;create 改先调度后提交、
  失败回滚;state 归属守卫 + 新建 120s 宽限期防误标已终止;_ensure_event_loop 加锁;
  子智能体 todo 改 per-agent 隔离存储,不再串到主智能体前端
- 子智能体执行环境(execution_env_text.py):创建/切换/恢复三时点注入环境说明,
  Windows 下 sandbox=WSL2 bash、direct=cmd;inject_notification 纯通知不触发新一轮工作,
  tool 序列中延迟到安全点 flush;传统子智能体按既定语义不通知
- 编码:git 侧边栏 subprocess 显式 utf-8 + errors=replace(修中文 Windows GBK
  _readerthread 崩溃导致侧边栏空白);check_environment/install_package 用 self.python_cmd
- 安全/路径:permission.py Windows deny 列表生效 + 驱动器根拦截;路径比较统一 normcase;
  /tmp 白名单平台分流;正斜杠判断归一化;os-release 平台守卫;PowerShell -ExecutionPolicy Bypass
- 稳定性:任务事件轮询持锁快照(修 deque mutated during iteration);
  原子写新增 replace_with_retry(修 WinError 5/32 瞬时持锁);
  共享文件兜底链 symlink→os.link 硬链接→copy2
- 部署:新增 _bootstrap.bat / setup.bat / start.bat Windows 启动脚本
2026-07-31 11:33:57 +08:00
42cd99d2d8 feat(windows): WSL2 沙箱执行环境与执行环境提示词平台拆分
- Windows 宿主机模式基于 WSL2 实现沙箱执行:只读/批准/自动审核识别、
  工作区可写+区外只读挂载、网络档位(受限/开放/禁止)、敏感目录屏蔽
- 新增 scripts/setup-wsl-sandbox.ps1 一键准备 WSL 沙箱发行版
- 执行环境提示词按平台拆分骨架:prompts/execution_mode/macos.txt
  (原 execution_mode.txt,mac/dockerweb 沿用)与 windows.txt
  (骨架+动态注入环境与路径、当前规则、网络档位、切换一致性说明)
- Windows 执行环境切换通知改为完整命令写法说明(双向),mac 保持原样
- 附调研与 PoC 验证报告:wsl2-sandbox-research.md、
  windows-sandbox-research.md、wsl2-sandbox-poc-report.md
2026-07-30 13:06:34 +08:00
ccdc101192 chore(terminal): 删除无调用的 _derive_pip_from_python 死代码 2026-07-20 15:53:16 +08:00
bfc039a9a9 fix(terminal): 移除命令执行前的 python/pip 路径重写,按用户原始命令执行
run_command 与后台 run_command 此前会把命令中的 python/python3/pip/pip3 正则替换为解析出的容器或本地解释器路径,删除该重写逻辑后命令按原样执行。
2026-07-20 15:51:21 +08:00
d1a9a51bb8 fix(terminal_ops): ssh 远程命令中避免重写 /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9/pip 路径 2026-06-24 17:33:12 +08:00
f661dc6456 refactor(server,modules,utils,frontend): split oversized modules into packages and fix regressions
- Split server/chat.py, server/status.py, server/tasks.py into sub-packages
- Split utils/context_manager.py, utils/conversation_manager.py into mixin packages
- Split modules/file_manager.py, persistent_terminal.py, terminal_ops.py, mcp_client_manager.py into packages
- Split core/main_terminal_parts/context.py into base + mixins
- Split static/src/app/methods/{ui,message,upload,taskPolling,conversation} into sub-modules
- Fix flattened method exports, dynamic import paths, missing cross-module imports
- Add missing permission/network/execution mode constants and _PERMISSION_MODE_LABEL
- Update AGENTS.md, CLAUDE.md and project memories to reflect new structure
2026-06-20 15:54:48 +08:00