Skip to content

fix: harden managed workspace lifecycle - #49

Merged
Duang777 merged 106 commits into
mainfrom
agent-1/issue-23
Oct 7, 2026
Merged

Duang777 merged 106 commits into
mainfrom
agent-1/issue-23

Conversation

@Duang777

@Duang777 Duang777 commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • harden managed worktree preparation, promotion, removal, acknowledgement, and crash recovery against path replacement and stale filesystem identities
  • preserve session, PTY cleanup, CLI, and TUI state semantics across failures and restart paths
  • bind BSD checkout temporary files to opened identities and Git blob IDs while keeping file-descriptor use bounded
  • add cross-platform workspace compile checks and macOS/Windows runtime coverage

This is a follow-up to #44. It does not close #23 again.

Validation

  • Bits Code Guard on the final BSD checkout increment: no P0-P2 findings
  • Go 1.24.2 and Go 1.27.1: go vet ./... and both CLI binary builds passed
  • scripts/check-workspace-platforms.sh: all 15 configured targets passed
  • BSD checkout replacement, identity cleanup, SHA-256, entry-type, and bounded-FD race tests passed
  • replacement regression test failed against the pre-fix implementation and passed after the fix
  • daemon API-acceptance timing test passed 5 consecutive race runs after one load-related full-suite timeout

GitHub CI is the final full-suite gate for Go 1.24.2, current stable, macOS workspace runtime, Windows workspace runtime, and the platform compile matrix.

Record recovery previously scanned before settling interrupted deletion transactions, and workspace status could observe the internal namespace as user dirt. Recover at both record-operation boundaries and before Git status so retries converge without special-casing internal paths.
Record cleanup previously closed the validated directory handle before deleting a fixed pathname, so a replacement could be removed and concurrent recoveries could split across flock domains. Hold a stable parent lock, isolate directories through identity-checked no-replace renames, and fail closed where the platform cannot provide that primitive.
@Duang777

Duang777 commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

前述 Windows 评审项已在 head 89d8196 完成验证。

  • 最终 CI run 37657328591 六个 job 全绿;Windows workspace runtime 用时 7m21s。
  • 这里的资源生命周期不是 Manager.Close:成功的 Prepare 持有 preparation lease,session 元数据持久化后必须调用 AcknowledgePreparation 释放源仓库、private Git dir 和 common Git dir 句柄。相关成功路径测试已补齐 acknowledgement,Windows 全包测试和临时仓库清理均通过。
  • 测试仓库启用 core.longpaths=true,此前触发 260 字符限制的深路径用例已在 Windows 全包测试中通过。
  • Windows record unlink 使用兼容共享标志,并仅在已验证的最终 post-unlink 目录 flush 上容忍 ERROR_ACCESS_DENIED;此前的 sync 与其他错误仍严格返回。

PR 当前 MERGEABLE、mergeStateStatus=CLEAN,无 review thread。Node 20 action warning不影响本次验证,action 大版本升级未混入这次生命周期修复。

@Duang777
Duang777 merged commit d876756 into main Oct 7, 2026
6 checks passed
@Duang777
Duang777 deleted the agent-1/issue-23 branch October 7, 2026 17:22
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.

[可选] 每个 agent 使用独立 git worktree 隔离(drove up --worktree)

1 participant