跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

提交记录
修改internal/workbench/control_recovery_test.go+23 −0看文件
@@ -211,3 +211,26 @@ func TestDesktopWaitsForRetiringController(t *testing.T) {
211211 t.Fatalf("did not resume after shutdown: %v", err)
212212 }
213213}
214新增:
215新增:func TestPrepareUpdateWaitsForRetiringController(t *testing.T) {
216新增: profile := t.TempDir()
217新增: lock, err := openControllerLock(profile, os.O_CREATE|os.O_RDWR)
218新增: if err != nil {
219新增: t.Fatal(err)
220新增: }
221新增: defer lock.Close()
222新增: if err := lockController(lock); err != nil {
223新增: t.Fatal(err)
224新增: }
225新增: // Shutdown has removed control.json but has not released the profile yet.
226新增: released := make(chan struct{})
227新增: go func() { time.Sleep(100 * time.Millisecond); _ = unlockController(lock); close(released) }()
228新增: defer func() { <-released }()
229新增: result, err := PrepareUpdate(filepath.Join(profile, "config.json"), false)
230新增: if err != nil || result.Status != "prepared" {
231新增: t.Fatalf("retiring controller prevented update: %+v %v", result, err)
232新增: }
233新增: if !controllerLockFree(profile) {
234新增: t.Fatal("update accepted before the controller released its lock")
235新增: }
236新增:}
修改internal/workbench/desktop.go+6 −1看文件
@@ -243,7 +243,12 @@ func desktopLaunch(profile string, gateway bool, options DesktopOptions, start f
243243// PrepareUpdate is shared by the explicit migration button and the installer.
244244// It returns only after the old service has released its profile lock.
245245func PrepareUpdate(configPath string, stop bool) (DesktopResult, error) {
246删除: c, err := connectController(filepath.Dir(configPath))
246新增: // A closing controller stops accepting requests before releasing its lock.
247新增: // Use the same bounded retirement wait as desktop startup; the lock and VM
248新增: // checks below still decide whether replacing the application is safe.
249新增: ctx, cancel := context.WithTimeout(context.Background(), 12*time.Second)
250新增: defer cancel()
251新增: c, err := waitControllerReady(ctx, filepath.Dir(configPath))
247252 if errors.Is(err, errControllerUnavailable) {
248253 lock, lockErr := openControllerLock(filepath.Dir(configPath), os.O_RDWR)
249254 if lockErr == nil {