Skip to content

ui-sdk: the reference pool releases a worktree that an access generation holds #2729

Closed

Description

@schlessera

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

  1. 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.
  2. 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.
  3. 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

  1. added
    type: fix
    area: ui-sdk
    on Oct 23, 2026
  2. added this to the 0.44.0 milestone on Oct 23, 2026
  3. added
    priority: p1
    on Oct 23, 2026
  4. self-assigned this
    on Oct 23, 2026
  5. schlessera commented on Oct 23, 2026

    @schlessera
    OwnerAuthor

    Claim claim-2729-20261023T2116Z: implementing on branch fix/2729-pool-release-refuses-held-044 (refusal in the native pool's release, native proof assertion in case 17).

  6. added 2 commits that reference this issue on Oct 23, 2026
    5e6446a
    dc5d3c7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: ui-sdkpriority: p1type: fix

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions