Skip to content

feat(runtime-host): close managed Write/Edit mutation recovery - #10

Closed
zhiiw wants to merge 9 commits into
codex/managed-workspace-mutation-runtime-admission-m2-3bfrom
codex/managed-workspace-write-edit-production-m2-4
Closed

feat(runtime-host): close managed Write/Edit mutation recovery#10
zhiiw wants to merge 9 commits into
codex/managed-workspace-mutation-runtime-admission-m2-3bfrom
codex/managed-workspace-write-edit-production-m2-4

Conversation

@zhiiw

@zhiiw zhiiw commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

Compose managed Write/Edit from immutable Git base content through a detached worker transform, immutable candidate capture, atomic SQLite successor acceptance, and crash-convergent projection publication.

Primary invariant

A managed Write/Edit is determined by the exact accepted base blob, exact operation, and exact resulting blob. The mutable worktree is only a disposable projection and is never the transform data plane. After durable intent, every observable combination of path, registration, HEAD/index, and lock converges or fails closed; Git porcelain is not treated as an atomic transaction.

  • Owner: Runtime Host composition across the already-separated Runtime, SQLite, Git candidate, registration-reconciliation, and projection owners
  • Atomic boundary: T1 fixes durable mode; worker transforms immutable base content; SQLite atomically accepts T2 + successor + head; projection publication uses same-filesystem directory rename
  • Failure states: successor committed, no-workspace-change committed, operation-failed-no-effect committed, or unsettled
  • Rollback/recovery: never rerun a committed effect; durable intent reconciles partial Git registration and projection states

What changed

  • adds detached Git transform protocol v7 for managed Write/Edit
  • removes managed mutation worker access to the workspace filesystem
  • binds base content/OID and result content/OID end to end
  • builds candidates directly from Runtime-owned result content through a private Git index
  • separates worktree add --no-checkout registration from candidate materialization
  • preserves and rebuilds registration-only, path-only, and incomplete-checkout staging artifacts
  • removes git worktree move; publication now uses atomic directory rename followed by idempotent git worktree repair
  • reconciles both path-ahead-of-registration and registration-ahead-of-path split states
  • gives old quarantine and new canonical projection different per-worktree gitdirs, HEADs, and indexes
  • proves quarantine reset/add cannot mutate canonical HEAD/index or the managed ref
  • rejects symlink/junction identity replacement without deleting through child paths
  • uses compact owner-owned projection carrier paths for the Windows Git path budget; full identity remains in durable evidence

Stack position

This is M2.4, the fifth Draft in this review stack.

Base: codex/managed-workspace-mutation-runtime-admission-m2-3b

Validation

  • core/runtime/storage/runtime-host builds passed
  • full candidate suite: 16 passed, 5 platform/stress skips, 0 failed; reverse registration/path split targeted regression also passed
  • strict Windows recovery inventory: 31 total, 30 passed, 1 explicit packaged-worker skip, 0 failed
  • production-shaped projection test kills a real child process after staging registration, after each directory rename before repair, and after each repaired publication boundary
  • deterministic tests cover registration-only, path-only, incomplete checkout, and both registration/path split directions
  • Windows junction tamper and quarantine Git-control isolation regressions passed
  • formatting and git diff --check passed

Draft limitations

  • API-only Draft: Desktop and CLI do not create this managed coding mode yet
  • quarantine/partial-artifact quota, diagnostics, and Git-owned safe GC remain M4 work
  • full conversation continuation remains M3; this PR closes the managed Write/Edit effect/version seam
  • power-loss durability is not claimed
中文说明

概要

本层闭合 managed Write/Edit 的 effect/version seam:transform 不读取或覆盖可变 worktree,而是从 accepted Git base 的不可变内容计算结果;candidate 绑定 exact result blob;SQLite 原子提交成功 T2、successor 与 canonical head。

这轮不再假设 git worktree add/move 是原子操作:

  • staging 用 worktree add --no-checkout 把 registration 与 checkout 拆开;
  • registration-only、path-only、未完成 checkout 都会整体保留并从 immutable candidate 重建;
  • 删除 git worktree move,目录发布只用同文件系统原子 rename;
  • rename 后用 git worktree repair 根据实际存在路径幂等修复 registration;
  • path 先移动或 registration 先前进的两个方向都有回归测试。

旧 quarantine 与新 canonical projection 仍拥有不同的 per-worktree gitdir、HEAD 与 index,因此从 quarantine 执行 git resetgit add 不会改变 canonical projection 或 managed ref;外部用户字节完整保留。

当前仍是 API-only Draft,Desktop/CLI 尚未接入。完整对话 continuation 属于 M3;quarantine/partial artifact 的配额、诊断以及先撤销 Git registration 再清理目录的安全 GC 属于 M4。

@zhiiw
zhiiw force-pushed the codex/managed-workspace-write-edit-production-m2-4 branch from 04ed4fe to 1aea261 Compare August 19, 2026 02:33
@zhiiw
zhiiw force-pushed the codex/managed-workspace-mutation-runtime-admission-m2-3b branch from 643f893 to 3825677 Compare August 19, 2026 02:33
@zhiiw

zhiiw commented Aug 30, 2026

Copy link
Copy Markdown
Owner Author

Closed as an obsolete extraction/integration slice. The current delivery path is the merged Gitoxide foundation followed by #40 -> #41 -> #42. This PR remains available as design and implementation history.

中文说明

该 PR 属于旧 extraction/integration 栈,现已失去独立合并价值。当前交付路径是已合并的 Gitoxide 基础,然后依次审查 #40#41#42。这里继续保留设计、实现与审查历史。

@zhiiw zhiiw closed this Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant