Repository navigation
Description
Context
#2431 removes managed worktrees through the reference pool's poolRelease. The worktree service checks that no access generation holds the root, then records its receipt and releases it, and it runs grants and removals of one worktree one at a time within the server process (docs/decisions/managed-worktrees.md#hygiene-and-cleanup).
The pool's own release does not refuse a writable worktree that an access generation holds. async function release (packages/ui-sdk/src/server/native-reference-pool.ts:685-727) verifies the root's identity and deletes it, whatever intent.access says. A second process sharing the manager could grant the worktree between the worktree service's last check and its release, and that grant would be deleted. The manager runs each request in order, so a refusal inside release would be atomic with respect to poolAccess. An independent review of #2431 raised this.
Part of #2390.
Out of scope
Supporting more than one server process per pool. Changing park, close or checkpoint semantics.
Scope
Make the native pool refuse to release a worktree root while an access generation holds it, or accept an explicit expected-access precondition, so the native boundary rejects deletion of a granted worktree atomically.
Acceptance criteria
- Releasing a worktree root whose record names an access generation is refused, with nothing deleted and the charge kept. A native proof assertion shows this and fails without the guard.
- Every existing caller still works: generation close parks before any release, the worktree service releases only unheld roots, and unfinished allocations release roots that were never granted. The existing native pool cases still pass.
- Any change to the client or manager protocol is recorded in the package-API contract.
Verification
flock-held bun scripts/prove-reference-pool.ts with a named failing-first assertion and a mutation receipt; focused ui-sdk and ui-server suites.
Contract impact
Possibly additive (package API), depending on whether this is a refusal or a new precondition field. The refusal option needs a ruling on whether it is breaking.
Corrected 2026-10-23: the release citation moved to 685-727 after #2728.
Activity
schlessera commentedon Oct 23, 2026
Claim
claim-2729-20261023T2116Z: implementing on branchfix/2729-pool-release-refuses-held-044(refusal in the native pool'srelease, native proof assertion in case 17).chore(ui-sdk): give the held-worktree release refusal its own changeset
CONTRACT: fix(ui-sdk): refuse to release a worktree an access generat…
CONTRACT: feat(ui-server): reconcile managed worktree retention and c…