Skip to content

ui-server: qualify allocation and latency across repository acquisition and managed worktrees #3513

Closed

Description

@schlessera

Out of scope

New storage providers, host provisioning, replacing the existing allocator, portable fallback clones, unrelated native-proof repairs, changing Git history policy without a separate decision, and blanket workspace journal exclusions.

Context

acquire (packages/ui-server/src/brain/reference-source.ts:404) snapshots prior source for refresh; allocate (packages/ui-server/src/brain/reference-worktrees.ts:427) creates worktrees from sealed source. createNativeReferencePool (packages/ui-sdk/src/server/native-reference-pool.ts:272) owns allocation/admission. COPY_FLAGS (packages/ui-server/src/brain/turn-data-tree.ts:101) requests best-effort reflinks, while copies are used at lines 144 and 161. Native proof entry: scripts/native-proof/README.md:270 and scripts/prove-reference-pool.ts.

Read docs/decisions/{reference-worktrees,reference-source-acquisition,managed-worktrees,reference-pool-accounting,native-brain-storage,provider-history}.md. Existing #3209 owns its case-18 unstable-assessment harness defect; use its result rather than refiling/fixing that defect here. #3138's decided ordinary selected-repository path must stay independent of managed native availability.

Scope

Extend the existing offline native proof with a bounded Git workload and publish an efficiency/coverage report against exact candidate identities. Distinguish Git object reuse, checked-out file extent sharing and separate temporary-copy allocation. Investigate unsupported repository features rather than silently claiming coverage.

Acceptance criteria

  • Use generated Odysseus repositories: many small source files, incompressible large files and changed commits. Exercise cold acquisition, repeat reads, unchanged and changed refresh, multiple managed worktrees from one source, isolated edits, preserved local commits, release/restart and source deletion while referenced.
  • Record unique allocated data/metadata, per-owner squota charge, combined allocation, reservations and observed reclamation with declared metric basis. Include Git objects, checkout/index metadata and transient staging; no logical-size or st_blocks sum is called unique usage.
  • Prove repeat reads avoid extra checkout roots; snapshot worktrees share inherited data; edits affect only their worktree; refresh only fetches required new objects. Set explicit fixture-based regression tolerances from measured baseline before asserting them; do not promise zero metadata cost.
  • Compare relevant same-filesystem reflink and cross-filesystem copy paths, report concurrent peak disk use and admission behavior, and identify any copy-budget gap with a separately filed issue rather than an unbounded fallback here.
  • Include concurrent readers/refresh, both backend tool paths, fresh/revoked authorization, write-time EDQUOT, cancellation and crash/recovery. Record health/WS latency, elapsed time, I/O and peak allocation for cold/warm runs with measured thresholds and exact kernel/Bun/btrfs-progs/candidate identities.
  • Document clone depth/partial-object, LFS/submodule and linked-Git-worktree support or explicit refusal, repack/GC sharing loss and retained-owner accounting limits; verify against installed Git and upstream documentation.
  • Retain a named mutation that replaces a snapshot with independent full-copy behavior or adds an avoidable checkout on warm reuse; prove the allocation/reuse assertion fails for the intended reason and passes after restore.

Verification

Run bun scripts/prove-reference-pool.ts and the relevant --integrated --backend=claude / --integrated --backend=pi cells using existing offline fixtures. Run focused tests through bun run test, required typecheck/lint and bun run check:pr --base origin/main for a PR. No provider API keys or test network; real Btrfs proof cannot be replaced by directory-backed doubles. Reverify source citations at pickup.

Contract impact

Proof/report only: no new public contract or behavior intended. Any actual runtime gap discovered is filed separately with contract/changeset assessment.

Primary sources

2026-11-08 pickup at main 1619741f2: the turn-data-tree.ts citations had drifted by one line (COPY_FLAGS 100→101, copies 143/160→144/161) and are corrected above. All other citations held.

Blocked by #4079 (the backend-latency criterion only; the rest is in #4072).

Activity

  1. added
    type: test
    area: ui-sdk
    area: ui-server
    priority: p2
    agent-ready
    on Nov 3, 2026
  2. self-assigned this
    on Nov 8, 2026
  3. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Claimed (token claim-3513-3bb6cefa) on branch test/3513-storage-efficiency from main 1619741f2; draft PR #3676. Collision check on the native reference-pool proof paths: closure-only overlaps with broad draft PRs (#3054, #3056, #3059 and others), no direct path collisions. The local host cannot attach loop devices under rootless Docker, so the native cells are exercised through hosted runtime feedback.

  4. added this to the 0.45.0 milestone on Nov 8, 2026
  5. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Partial delivery merged: PR #3676, squash 2b468ab8a5928c66273b6ce54cf726f04f2db31e on main (candidate confirmation run 42520812699, milestone 0.45.0).

    Delivered: case 19 of the required reference pool proof (scripts/native-proof/reference-efficiency.ts), documented in scripts/native-proof/README.md. It covers:

    • Cold acquisition, repeat read, unchanged/changed/concurrent refresh, two managed worktrees from one source, an isolated edit with a preserved local commit, repack and linked Git worktree sharing loss, reflink/full/cross-filesystem copy paths, and revocation with observed reclamation.
    • Per-step charged/owner/reservation/extent-census metrics with kernel, btrfs-progs, Git, Bun and candidate identities, in reference-efficiency.json.
    • Submodule/LFS/depth/linked-worktree/repack/retained-owner behaviour, measured and documented.
    • EFFICIENCY_TOLERANCES, set from the hosted baseline (run 42475041809 at 59caf001).
    • Named mutation receipt: worktree full-copy mutation 43b0f549 failed REFERENCE_EFFICIENCY_WORKTREES_SHARE_SOURCE in run 42479022403. The restored head passed run 42482120806.
    • The copy-budget gap (the turn data tree's cross-filesystem full copy) is recorded with measurements on ui-server: a turn's data tree holds a full copy per concurrent turn; place it by reflink on the managed volume #2911, which already owns it.

    Remaining for this issue:

    • Both backend tool paths (--integrated --backend=claude|pi) under this Git workload, with health/WS latency and cold/warm elapsed thresholds.
    • Write-time EDQUOT, cancellation and crash/restart recovery under the Git workload (cases 3 and 10 cover synthetic roots only).
    • Per-step I/O counters.

    To resume, extend case 19 or the integrated cell in scripts/native-proof/reference-integration.native.ts, iterating through bun scripts/request-heavy-feedback.ts <pr>. The local host cannot attach loop devices.

    Releasing my claim; the issue stays open and agent-ready for the remaining criteria.

  6. 7 remaining items

  7. added
    blocked
    on Nov 16, 2026
  8. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Progress on the remaining criteria, draft PR #4072:

    Blocked by #4079

  9. removed
    blocked
    on Nov 16, 2026
  10. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Claimed for implementation. Claim token: claim-5f8283ed. Branch: test/3513-integrated-latency-thresholds.

    resumes after #4072 and #4079 (the previous claim, claim-6f21a113, ended with #4072's merge and is released here); path overlap with draft #4002 on scripts/native-proof/README.md; closure-only overlaps with other broad drafts

  11. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Merged in #4103 as 40779d498 through the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-sdkarea: ui-serverpriority: p2type: test

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions