Skip to content

test(ui-server): qualify EDQUOT, cancellation and crash recovery under the Git workload (#3513) - #4072

Merged
schlessera merged 9 commits into
mainfrom
test/3513-git-workload-latency-recovery
Nov 16, 2026
Merged

schlessera merged 9 commits into
mainfrom
test/3513-git-workload-latency-recovery

Conversation

@schlessera

@schlessera schlessera commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Refs #3513

Extends case 19 of the reference pool proof (scripts/native-proof/reference-efficiency.ts) with the criteria #3676 left open under the generated Odysseus Git workload: write-time EDQUOT, cancellation, crash/restart recovery and per-step I/O counters. The backend-latency criterion stays open: it is blocked by #4079 (see below).

What changes

  • I/O and peak per step. Every row gains io, taken since the previous row and after sync. It holds the pool loop device's block counters (/proc/diskstats) and this process's I/O with its reaped transport workers (/proc/self/io), from scripts/native-proof/pool-io.ts. Cold, warm, refresh and refused-refresh rows add peak, the combined charge and reservations sampled every 50 ms. A warm read must reserve nothing.
  • Write-time EDQUOT, worktree. A managed worktree writing past its allowance must be refused by write() with EDQUOT. Neither its sibling nor its source may be charged.
  • Write-time EDQUOT, refresh. A commit 8 MiB over one operation's allowance must be refused inside the fetch with Git's quota error. Past the refresh window the previous commit's validation has lapsed too, so the request must reject as capacity: the previous root is neither served nor withdrawn, and the staging root is released and observed reclaimed.
  • Cancellation. A refresh whose only requester aborts once its staging root is writable must reject as cancelled, publish nothing, and have its staging released and reclaimed.
  • Crash and restart. A second app instance on the same database (reference-efficiency-crash-child.ts) is killed with SIGKILL while its staging root is writable. The manager must keep that root writable and charged. The next instance's startup recover() must release it, retain nothing and keep the previous source, and the space must be observed reclaimed. The changed refresh then runs on the restarted instance.

Hosted evidence

  • Round 1 (run 43794917101, checkout 381ee1de8): case 19 passed through the new worktree EDQUOT step. Measured: cold acquisition 1,512 ms and 15,675,392 B charged; repeat read 0 ms and +0 B; unchanged refresh 82 ms and +0 B; two worktrees +196,608 B.
    • The refresh EDQUOT step failed on my expectation of a stale fallback. Git did hit quota (fatal: write error: Disk quota exceeded), and the product rightly refused a stale copy whose validation had lapsed. The assertion was corrected in 4e63c9983.
  • Round 2 (run 43810765015, checkout 4e63c9983, per proof-checkout.json): Reference pool proof passed. That covers every case including all new case-19 steps, with receipts in the runtime-host-proof artifact. The pi UID 0 cell failed as its labelled expected-failure control.
  • Round 3, mutation M1 (run 43829272038, head 99e26925d): recover() skipped a writable staging root. Case 19 failed for the intended reason: the stranded root 6d0190a9…, recorded writable after the SIGKILL, was still writable after recovery. The failing assertion was REFERENCE_EFFICIENCY_RESTART_STAGING_RELEASED, the settle check immediately before the named REFERENCE_EFFICIENCY_RESTART_RELEASES_STAGING, which guards the same property. Every earlier case-19 step passed on the merged tree, including refresh EDQUOT and cancellation.
    • The only other failure was the existing unit guard of the same behaviour, restart recovery releases interrupted staging and roots the catalog lost (packages/ui-server/tests/reference-source.test.ts:444), the one failure among 2,233 unit tests in that shard. Every other category passed.
    • M1 is reverted in 39a1a4316, whose tree equals the merged tree ec681ea48. The restored case-19 inputs are round 2's, apart from that merge's unrelated reference-pool.native.ts case.

Integrated cell: blocked by #4079, moved out

Both rounds also ran the opt-in integrated cell through a temporary probe commit, since reverted. It never got past Claude's first reference_source call.

Local receipts

  • bun run test ./tests/native-pool-io.test.ts: 4 pass. Mutation: decoding the loop minor as rdev & 0xff fails decodes a loop minor above 255 from its dev_t and reads the pool device's row, not a device sharing its low minor bits; the latter matched loop125. Restored: 4 pass.
  • Root tsc --noEmit and bun run lint clean. check:pr at the final head 39a1a4316 is below.

Changeset

None: proof and report only, with no package behaviour or contract change. Mutation M1 is reverted (39a1a4316).

Collisions

bun scripts/collisions.ts --json --pr 4072 at head 39a1a4316: no path collisions; 18 closure-only overlaps with broad open PRs.

{"version":1,"kind":"brain-check-pr-receipt","head":"551fac56d118c0fe89b02e4216547cac615ac85e","base":"origin/main","mode":"focused","startedAt":"2026-11-16T15:19:23.638Z","finishedAt":"2026-11-16T15:20:49.888Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12522.757395999999},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":124.55249999999978},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":97.4539369999984},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":20.11275399999795},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":73463.041042}]}

🤖 Generated with Claude Code

schlessera and others added 2 commits November 15, 2026 22:13
…kend latency under the Git workload (#3513)

Case 19 of the reference pool proof now also records per-step pool-device and
process I/O and peak allocation around cold, warm and refresh reads, and
exercises write-time EDQUOT in a managed worktree and inside a refresh fetch,
cancellation mid-fetch, and a SIGKILLed app instance recovered by the next
instance's startup recovery, all on the generated repository.

The integrated cell's repository gains incompressible charts, its first turn
ends with a warm source read, and the parent samples health, WebSocket
ping/pong, pool peak and device I/O through every turn on both backends. The
child times each reference tool call at the model boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce cell (#3513)

Reverted before the PR is ready.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schlessera schlessera added this to the 0.45.0 milestone Nov 15, 2026
@schlessera schlessera added type: test Coverage, harness or proof work with no behaviour change. area: ui-sdk Wire protocol, runtime schemas, the server and client SDK surfaces. area: ui-server Hono app factory: turn coordinator, auth, session catalog, routes, cron. labels Nov 15, 2026
…grated receipts uploadable (#3513)

The first hosted baseline showed Git's write-time quota error inside the
refresh fetch, rejected as capacity: past the refresh window the previous
commit's validation has lapsed too, so no stale copy may be served. Assert
that rule instead of a stale fallback.

The integrated cell left its UID 1000 app data owner-only in the artifact
tree, so the whole runtime-host receipt upload failed. Make the tree readable
on exit, print the app's warnings into the job log, and sample peak
allocation from sysfs rather than polling the shared manager mid-turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
schlessera and others added 4 commits November 16, 2026 07:45
…lets it run (#3513)

Both hosted baselines stopped the integrated cell at its first
reference_source call: the turn's own scratch check and the reference
transport's Git command each need the whole default maintenance budget, and
the second is refused (#4079). The cell's latency assertions were never
measured, so they leave this change; the instrument is kept on its own
branch for the follow-up. Case 19 passed in full on hosted runtime_host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… writable staging root (#3513)

Expected to fail REFERENCE_EFFICIENCY_RESTART_RELEASES_STAGING in case 19.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schlessera schlessera changed the title test(ui-server): qualify EDQUOT, cancellation, crash recovery and backend latency under the Git workload (#3513) test(ui-server): qualify EDQUOT, cancellation and crash recovery under the Git workload (#3513) Nov 16, 2026
schlessera added a commit that referenced this pull request Nov 16, 2026
…ce cell (#4079)

Copied from #4072's probe so hosted runtime_host runs the integrated cell. Reverted before the PR is ready.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… skips a writable staging root (#3513)"

This reverts commit 99e2692.
@schlessera
schlessera marked this pull request as ready for review November 16, 2026 15:23
@schlessera
schlessera merged commit ba8980f into main Nov 16, 2026
24 of 26 checks passed
@github-actions

Copy link
Copy Markdown

This PR's squash ba8980f78848acb348838b81db64e9169291e48a landed on main while main was red at 05bf0d6a02fb12fd1ead402b8a7638031ddcbeec (incident #4098) without being a declared fix. Merge blocking while red is cooperative; this report is the detection.

schlessera added a commit that referenced this pull request Nov 16, 2026
…fore refusing its first reference call (#4079) (#4080)

* CONTRACT: fix(ui-server,ui-sdk): wait for a turn's own maintenance before refusing its first reference call (#4079)

Every maintenance command reserves the whole default 256 MiB maintenance
budget, and admission refuses rather than waits. A reference Git command
that overlapped the turn's scratch check, or the boot-time scratch prune,
was refused at once, and the tool answered the generic `unavailable` with
no retry guidance. The scratch check refused the other way round left
`.brain/scratch/` read-only for the turn.

- The reference transport waits up to REFERENCE_ADMISSION_WAIT_MS (30 s)
  per Git command for the budget to free, then refuses as `busy`. The
  reference source maps that to its existing `busy` code on resolution and
  on fetch or checkout. The tool classifies any raw maintenance-busy error
  that reaches it as `busy` too, never `unavailable`.
- An awaited scratch check waits up to SCRATCH_ADMISSION_WAIT_MS (3 s) on
  one deadline across its Git queries. The synchronous check and bind-time
  revalidation of lapsed sources still refuse at once.
- MaintenanceTempBusyError gains freedWithin(ms, signal), a bounded freed().

Neither wait adds an allowance; both stay inside the existing budget.
The MCP contract component states the new bound for `busy`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(scripts): TEMPORARY hosted probe running the integrated reference cell (#4079)

Copied from #4072's probe so hosted runtime_host runs the integrated cell. Reverted before the PR is ready.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ui-sdk,ui-server): place the scratch admission brain where a maintenance worker sees it; import an exported type (#4079)

Hosted heavy feedback showed two test faults in this PR, not in the fix:

- The writable-scratch test built its brain under the OS /tmp, which a
  maintenance worker replaces with its own, so the worker's git query could
  not see it and scratch stayed read-only after the wait had worked. The
  brain now lives in the repository's gitignored tmp/, as the worker
  sandbox tests place theirs, and the assertion prints the mount's reason.
- The reference admission test imported MaintenanceTempReservation, which
  the SDK's internal entry does not export (TS2305 in strict typecheck).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Revert "chore(scripts): TEMPORARY hosted probe running the integrated reference cell (#4079)"

The probe ran the integrated cell on hosted runtime_host in heavy feedback run 43854394276: Integrated reference proof passed (claude, pi).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ui-sdk): give the scratch admission test's maintenance worker a fixture input lease (#4079)

Candidate confirmation showed the writable-scratch test still read-only:
"git could not run to confirm .brain/scratch/ is gitignored". The wait
had worked, but the worker never ran git. It had no prepared startup
view, which every real-worker writable test supplies through
createFixtureMaintenanceHost. The test now uses that host, with its
ledger state beside the brain in the repository's gitignored tmp/ and
masked from the worker, as maintenance-temp-helpers.test.ts does. It
passes locally, where the worker now runs, and still fails on main with
the "(held by: git)" busy refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
schlessera added a commit that referenced this pull request Nov 17, 2026
…ured thresholds (#3513) (#4103)

* test(ui-server): sample health, WebSocket and tool latency in the integrated reference cell (#3513)

The integrated cell's repository gains three incompressible charts, its first
turn ends with a warm read of the same source, and the parent samples
/api/health, WebSocket ping/pong, the pool's sysfs peak allocation and the
pool device's block I/O through every turn on both backends. The child times
each reference tool call at the model boundary. The measurements land in
reference-integration-latency.json and are held to INTEGRATED_TOLERANCES.

The cell also makes its artifact tree readable on exit, so the receipt upload
survives the app's owner-only data, and prints the app's warnings into the
job log.

Ported from the instrument branch onto main after #4072 and #4079.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(scripts): TEMPORARY hosted probe measuring the integrated reference cell's baseline (#3513)

Reverted before the PR is ready.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Revert "chore(scripts): TEMPORARY hosted probe measuring the integrated reference cell's baseline (#3513)"

This reverts commit ea71984.

* test(ui-server): hold the integrated reference cell to its measured hosted baseline (#3513)

INTEGRATED_TOLERANCES now comes from the hosted runtime_host baseline: two
integrated cells per backend at ea71984 (draft heavy feedback run
43969834503). Each bound records the worst measured value beside it. The warm
source bound is per backend, because Pi's model-boundary time includes its
agent loop's round trip through the offline provider.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(scripts): TEMPORARY hosted mutation round for the integrated cell's tolerances (#3513)

Each backend's integrated cell runs once with the measured bounds, which must
pass, and once with one bound set below its measured value, which must fail
first on that bound's named assertion. Reverted before the PR is ready.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Revert "chore(scripts): TEMPORARY hosted mutation round for the integrated cell's tolerances (#3513)"

This reverts commit 639585b.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ui-sdk Wire protocol, runtime schemas, the server and client SDK surfaces. area: ui-server Hono app factory: turn coordinator, auth, session catalog, routes, cron. type: test Coverage, harness or proof work with no behaviour change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant