Skip to content

ui-server: the automatic index refuses as maintenance-busy when a turn's scratch-mask query admits first #3461

Closed

Description

@schlessera

Context

Ready-candidate run 41622134234, job 125870809756 for PR #3456 (merge ref dd4eec8919eafa9ca6881daf6a4e1b30b3bd36bc = base d38eb1eb5b3a9b1f3228d8e317990dc14471be08 + head 3cbdf5a3e93e32f272ef19e9d371f57ded957240) failed runtime_host. The native hosted Claude UID-1000 cell failed its queued-refresh drain (const failed, scripts/native-proof/hosted-app.test.ts:404-405):

NATIVE_AUTOMATIC_INDEX_COMPLETED: WorkerStateError: Maintenance temporary storage is busy: this command needs 256 MiB, 1 maintenance reservations hold 256 MiB of the separate 256 MiB budget. Nothing ran.

That PR changes no file under packages/ui-sdk, packages/ui-server/src/brain or scripts/native-proof. It changes only a ui.db write on session creation. Main's runtime_host passed on the same base and on later main commits (runs 41613050490, 41609299806, 41617586180).

What the retained artifact shows (runtime-host-proof, run-claude-uid1000-2CXSm0/run/)

events.jsonl (wall-clock ms):

wallAt event
…999220 worker_exit attempt 1
…999276 automatic_index_started ordinal 1
…000393 automatic_index_failed ordinal 1: maintenance-busy, as above
…000476 fake_provider_enter attempt 2
…000740 automatic_index_started ordinal 2
…001193 backend_log warn: worker scratch area is read-only this turn: .brain/scratch/ could not be checked (Maintenance temporary storage is busy …)
…001201 fake_provider_enter attempt 3
…012462 automatic_index_failed ordinal 2: Server shutting down

In native-operations.jsonl, the checkpoint release before the index's admission ran subvolume sync /brain-fixture 263 for 1006 ms (…999278 → …000284), and a concurrent filesystem sync ended with code 137. Every other subvolume sync in this run took under 5 ms. In all five cells of passing main run 41617586180, the first subvolume sync after automatic_index_started ordinal 1 took 1.4–1.7 ms. (Two of main's Pi cells had ~30 s syncs later in the run, so a long sync on its own is not unusual; its position ahead of the index's admission is what differs here.)

The two consumers of one 256 MiB budget

  • The automatic index admits only after it has prepared its native input (view = await prepareInput(...), packages/ui-server/src/brain/host-boundary.ts:717, then worker = await launchMaintenanceWorkerAsync, packages/ui-server/src/brain/host-boundary.ts:727, which reserves at function* launchMaintenanceWorkerSteps, packages/ui-sdk/src/server/maintenance-worker.ts:261-263).
  • Every turn's scratch-mask query is also a maintenance worker (const result = await runMaintenanceWorker, packages/ui-server/src/brain/scratch-mask-query.ts:37-39). Its comment says it "serializes with its existing owner".
  • Admission is immediate and refusing, with no queue (export function reserveMaintenanceTemp, packages/ui-sdk/src/server/maintenance-temp-budget.ts:163-181). With a 256 MiB allowance in a 256 MiB budget, the two commands cannot overlap; whichever admits second is refused.

Passing main hits the same race in the other direction. In run 41617586180, all five cells (Claude UID 0/1000, Pi UID 0 ×2, Pi UID 1000) log the same scratch-area could not be checked (Maintenance temporary storage is busy …) warning on attempts 2 and 3. There the index admitted first and the turn's scratch check lost, which the proof tolerates. In the failing run, the 1006 ms checkpoint sync delayed the index's admission past attempt 2's scratch query, so the index lost, and the drain treats that as fatal.

The ledger does not record which command held the reservation. Attempt 2's scratch query is the only maintenance consumer this run's evidence places in that window, and the opposite collision is visible on every passing run. That is an inference, not a captured owner.

Distinct from open #3019 (root createFixtureTurnHost fixtures on the per-UID fallback ledger) and open #2921 (NativeBrainManagerError / AbortError index aborts). Related closed #1967 (checkpoint release sync aborting index completion).

Out of scope

Scope

Decide how the automatic index and the per-turn scratch-mask query should share maintenance admission. Options include: the index waits or queues for admission rather than refusing; the scratch query yields to a pending index; a refused automatic index is requeued as pending work rather than recorded as a failure. Then implement the chosen correction. Record the reservation owner kind in the busy diagnostic so the next occurrence is attributable.

Acceptance criteria

  • A deterministic keyless test holds a live scratch-query-shaped maintenance reservation while an automatic index reaches admission. Before the fix it reproduces automatic_index_failed with the maintenance-busy message; after the fix the index completes, or stays pending and later completes, with production budgets unchanged. A mutation that removes the correction fails the test on the named assertion.
  • The opposite order (index holds, a turn's scratch check arrives) keeps its documented outcome, or changes it only under the ruling.
  • The maintenance-busy diagnostic names the holder kind (for example index, scratch query, git, sync) without paths or identities.
  • The native hosted proof's queued-refresh drain passes with the existing assertions unchanged.

Verification

Use the retained artifact of run 41622134234 (runtime-host-proof) and the passing main control 41617586180 as the starting evidence. Run the new unit/integration test failing-first and with a mutation, then bun run check:pr --base origin/main. Hosted runtime_host is the native receipt.

Contract impact

None expected for admission semantics. A changed diagnostic string, or a changed automatic-index status that consumers can see, needs its own assessment against docs/integration-contract.md.

Activity

  1. added
    type: fix
    area: ui-sdk
    area: ui-server
    priority: p2
    needs: decision
    on Nov 3, 2026
  2. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-03): requeue a refused automatic index.

    • When the index is refused at maintenance admission because the budget is busy, it is recorded as pending work and retried once the budget frees, not reported as automatic_index_failed.
    • Turn behaviour and production budgets are unchanged. A turn's scratch check keeps its current outcome when the index holds the budget.
    • The maintenance-busy diagnostic names the holder kind (index, scratch query, git, sync) without paths or identities.

    Assess any status a consumer can see against the integration contract, and use CONTRACT: if it changes.

  3. added
    agent-ready
    and removed
    needs: decision
    on Nov 3, 2026
  4. added this to the 0.45.0 milestone on Nov 3, 2026
  5. self-assigned this
    on Nov 3, 2026
  6. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Claiming (token wi-3461-0778), branch fix/maintenance-admission-requeue from origin/main d990c0ab3. Implementing the 2026-11-03 ruling: a refused automatic index is requeued as pending and retried when the budget frees; the busy diagnostic names the holder kind. Path collisions on packages/ui-server/src/brain/host-boundary.ts with open #3393, #3443, #3448; closure-only overlap with several others.

  7. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Another occurrence, on ready-candidate run 41625377355, job 125881852728 for landing PR #3443 (merge ref = base d990c0ab3418e4446c76e8c3c1f08c2c91c41740 + head f3b97e31d9275963a0a0c27173224b646d8a5c40). The native hosted Claude UID-1000 cell failed the queued-refresh drain with the same NATIVE_AUTOMATIC_INDEX_COMPLETED: WorkerStateError: Maintenance temporary storage is busy: this command needs 256 MiB, 1 maintenance reservations hold 256 MiB of the separate 256 MiB budget.

    The retained runtime-host-proof artifact (run-claude-uid1000-6WymmA/run/) has the same sequence this issue describes:

    wallAt (…) event
    4393667 worker_exit attempt 1
    4393719 automatic_index_started ordinal 1
    4393721 → 4394729 subvolume sync /brain-fixture 263, 1007.7 ms; a concurrent filesystem sync ends with code 137
    4394861 automatic_index_failed ordinal 1: maintenance-busy
    4395285 automatic_index_started ordinal 2
    4395750 backend_log warn: scratch area could not be checked (Maintenance temporary storage is busy …)
    4407014 automatic_index_failed ordinal 2: Server shutting down

    Every other subvolume sync in the run took 1.2–2.9 ms. The batch (#3282, #3335, #3394) touches the turn path. #3335 refuses unmanaged governed and strict turn views (assertManagedTurnStartupView), and #3394 tags egress-proxy operations by relay. Neither adds, moves or holds a maintenance reservation, and neither touches maintenance-temp-budget.ts, maintenance-worker.ts, scratch-mask-query.ts or the automatic index. Per the strict-flake rule this is not being rerun into green. The landing of #2745, #3314 and #3246 now waits on this fix, so this issue is raised to priority: p0 to match #2745 (a blocker carries at least the priority of what it blocks).

  8. added
    priority: p0
    and removed
    priority: p2
    on Nov 3, 2026
  9. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Implemented in draft #3467 (head 89bb5dd22), per the 2026-11-03 ruling. A refused automatic index stays pending inside brainClient.index and runs once the budget frees. The busy refusal names holder kinds. Turn behaviour, a requested index and production budgets are unchanged, and there is no contract change (assessment in the PR). Local receipts: failing-first, requeue and diagnostic mutations, opposite order, and check:pr passing. Remaining: hosted ready-candidate confirmation, including native runtime_host.

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: p0type: fix

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions