Skip to content

ui-server: two-app isolation fixture can refuse its first CLI search as maintenance busy #3628

Open

Description

@schlessera

Context

two differently configured apps isolate exec wrappers and login/passkey buckets (#2752) (test, packages/ui-server/tests/app-state-isolation.test.ts:51) intermittently fails its first authenticated CLI search with HTTP 500 instead of 200 (expect(response.status,, :106):

Maintenance temporary storage is busy: this command needs 256 MiB,
1 maintenance reservations hold 256 MiB of the separate 256 MiB budget
(held by: command). Nothing ran.

Cause, reproduced naturally on main 631bbae2c, 4 failures in 100 runs of the unchanged file on a clean 4-CPU VM beside 6 busy loops: receipt, ledger dump and timeline.

  • Both fixture apps use DB_PATH: ":memory:" (:19, :76). An in-memory database selects no admission domain (const tempDomain, packages/ui-server/src/brain/host-boundary.ts:370), so both apps share one domain with room for one 256 MiB command.
  • Each app starts a boot prune that nothing joins (void tick(), packages/ui-server/src/cron/scratch-prune.ts:133, in startScratchPrune, :41).
  • The ledger dump taken at the refusal shows one 256 MiB command row whose owner is the test's own process. The second app's boot prune overlaps the first app's first search. It is contention inside the fixture, not the cross-process cause in ui-server: root turn fixtures observe refusals through shared maintenance admission #3019 and not a leak of the private ledger.

Hosted sightings. PR #3625's candidate run 42065255803, and main run 41661689070 on 2026-11-03, inside a run that was cancelled as a whole. The receipt links both.

Scope

Stop the two fixture apps from contending for one admission slot, in the test only. Either gives each app its own admission domain (a file-backed DB_PATH under the test's owned scratch directory does that), or joins each app's boot prune before the first search if an existing handle allows it. The implementer picks one and says why.

Out of scope

  • Production behaviour: maintenance budgets, admission, reservation cleanup, the unjoined boot prune itself, retries and Apify behaviour.
  • Test deadlines, the isolation assertions for exec wrappers and login/passkey buckets, the native namespace guards and the foreign-holder lifetime checks in privateMaintenanceTest (packages/ui-server/tests/helpers/private-maintenance-test.ts:34).
  • Releasing or deleting another process's reservation.
  • Treating a later isolated pass as the repair.

Acceptance criteria

  • With the repair, the unchanged assertions pass and the file shows 0 failures in 300 runs beside 6 busy loops on a 4-CPU host with unprivileged user namespaces. The PR records the count and the load.
  • With only the repair removed, the same loop fails again on the status assertion at :106 with the busy text above. The PR records how many of how many runs. A deterministic overlap, built by holding the second app's boot prune while the first app searches, is accepted in place of the loop.
  • Workers are joined and owned reservations drained on success and on failure.
  • The PR states which repair was chosen and that no file under packages/*/src changed.

Verification

bun run test packages/ui-server/tests/app-state-isolation.test.ts

The case needs unprivileged user namespaces. A host that refuses unshare --user --map-root-user stops it before the native path; use a hosted runner or a VM for the loop. Run bun run check:pr --base origin/main before marking the PR ready.

Contract impact

None. Test fixture only.

Triage 2026-11-14 at main c82e30ae4: rewrote the brief around the demonstrated same-fixture contention and a test-only repair, with checkable loop counts. Added agent-ready. type: test, priority: p1 and no milestone are unchanged.

Earlier brief, receipts and triage history. The sections above replace it where they differ.

Out of scope

No change to Apify behavior, production maintenance budgets, reservation cleanup, retries, test deadlines, assertions or native namespace guards. Do not release or delete another process's reservation. Do not treat a subsequent isolated pass as repair of the original failure.

Context

PR #3625's candidate run 42065255803, unit shard 2 job 127378461556, failed two differently configured apps isolate exec wrappers and login/passkey buckets (#2752) at the authenticated CLI-search status assertion (current expect(response.status,, packages/ui-server/tests/app-state-isolation.test.ts:106).

The first authenticated CLI search returned HTTP 500 instead of 200:

Maintenance temporary storage is busy: this command needs 256 MiB,
1 maintenance reservations hold 256 MiB of the separate 256 MiB budget
(held by: command). Nothing ran.

The enclosing private-maintenance harness printed its foreign-holder acknowledgement, OWNED_MAINTENANCE_HOLDER_STILL_RESERVED, and OWNED_MAINTENANCE_HOLDER_RELEASED_AND_JOINED; the test still failed ISOLATED_TEST_PASSES_WHILE_FOREIGN_RESERVATION_IS_LIVE. The refusal does not identify the actual holder in the inner test's ledger. Do not infer that it was the intentional foreign holder or another suite.

The candidate is 0b53b7f558ae367ccf93ba7414662891e5dce7af, base 4e6a2d8c840bcf2c74e20641d4603968b7b77476, synthetic merge checkout 66865b1112098e898ecfa69eca005d3719eaa2b0. The app-state test, its private-maintenance helper, native app fixture, scratch pruner and maintenance-budget implementation are byte-unchanged between base and head. The original draft-heavy run at implementation head dcb46d48f passed its unit shard 2; the current run passed all other selected categories. Neither observation explains this failure.

Source facts worth investigating:

  • test, packages/ui-server/tests/app-state-isolation.test.ts:51-86, creates two real app instances with in-memory databases before searching each.
  • const tempDomain, packages/ui-server/src/brain/host-boundary.ts:370, selects the fallback admission domain for an in-memory database.
  • startScratchPrune, packages/ui-server/src/cron/scratch-prune.ts:41-52, schedules a boot pass (void tick(), line 133) without joining it at app construction. This is a possible same-fixture contender, not established holder evidence.
  • privateMaintenanceTest, packages/ui-server/tests/helpers/private-maintenance-test.ts:34-46, supplies owned ledger namespaces; its live-holder check is at const result, lines 99-104.

Related #3019 covers different root turn fixtures. This report names the two-app runtime test specifically; no common cause is established.

Scope

Capture the inner reservation owner, ledger identity, app identity and lifecycle at the rejected search. Establish whether this is same-fixture bootstrap concurrency, another command in the private domain, or a different namespace/lifetime defect. Select a bounded fixture repair only after that evidence exists.

Acceptance criteria

  • Retain this failed run and source identities, plus matched unchanged base/head diagnostics.
  • Reproduce the named HTTP-status assertion with the actual inner owner and ledger identity captured; a namespace/setup refusal does not qualify.
  • Preserve independent app exec-wrapper and login/passkey assertions, original production budget limits and foreign-holder lifetime checks.
  • If a repair is selected, removing only that repair fails the intended runtime assertion; restoration passes with joined workers and owned reservations drained on success and failure.

Verification

A local full-file attempt passed the login-bucket case but stopped the two-app case at unshare: write failed /proc/self/uid_map: Operation not permitted; it did not reach the reported failure. Unchanged hosted single-file controls were dispatched through the existing diagnostic probe: base, head. The unchanged head control completed with two passes and zero failures at the exact recorded head; its BRAIN_RED_MAIN_PROBE receipt reports exit 0. The unchanged base control also completed with two passes and zero failures, with an exit-0 receipt at the exact recorded base. The isolated head pass is recovery evidence, not causal attribution or repair. These probes are diagnostic evidence, never candidate proof.

Contract impact

None expected for a fixture correction. Any product admission change needs separate scope and evidence.

Needs reproducible inner-holder evidence before agent-ready. No causal repair is claimed.

Updated 2026-11-05: retained the passing unchanged head control; both unchanged single-file controls passed, and the inner-holder evidence gap is unchanged.

Triage 2026-11-08 at main 1619741f291f525d17cde4970a5ada40644117c1: Preserved the existing 0.45.0 commitment and sorted it as p1. Verified current fixture/helper anchors. The local namespace probe refuses /proc/self/uid_map before native execution; no inner reservation-owner witness or causal repair is added, so needs: repro remains.

Local attempt — 2026-11-09

At main fb999b8baeabbb3a9cb5756a19862eee45467ebf, every anchor above still resolves: test("two differently configured apps, app-state-isolation.test.ts:51, the status assertion at line 106, const tempDomain at host-boundary.ts:366, startScratchPrune at scratch-prune.ts:41 with void tick() at line 133, and privateMaintenanceTest at private-maintenance-test.ts:34 with const result at line 99. This host refuses unshare --user --map-root-user (write failed /proc/self/uid_map: Operation not permitted), both inside and outside the command sandbox. The two-app case cannot reach its native path here, and no loaded local attempt was possible. The inner reservation-owner witness is still missing, so needs: repro remains. Completing it needs a host or CI runner with unprivileged user namespaces, running this case under load with the inner ledger's holder identity logged at the rejected search.

Triage 2026-11-09 at main fb999b8ba: re-verified the citations and recorded that this host cannot run the namespace fixture. P1/0.45.0 kept. #736 is full, and this is not browser work for #2753, so it stays standalone.

Hosted observation, 2026-11-10 triage: the same held by: command refusal text appears in passing ui-server cases on main CI. Job 128983721784 at 4d376943c logged it twice in ws tests (scratch qualification refused, so the turn ran with scratch read-only). Job 128614069929 at 1619741f2 logged the governed profile is unavailable (worker_host_unavailable): Maintenance temporary storage is busy. So default-domain maintenance contention recurs in hosted unit shards. The log does not name the inner holder, so this is not the missing owner witness.

Triage 2026-11-10 at main 3aadc8df5: repaired the const tempDomain pointer (host-boundary.ts:366 → :370, moved by #3458). The other anchors are unchanged. From 2026-11-08 to 2026-11-10, no failed main CI job shows this case. It passed in job 128779514190. P1/0.45.0 and needs: repro kept, and it stays standalone.

Reproduction and cause — 2026-11-13

Reproduced naturally and in isolation on main 631bbae2c: 4 failures in 100 runs of the unchanged file on a clean 4-CPU VM beside 6 busy loops, with this issue's exact signature. Receipt, ledger dump and timeline.

  • The holder is the test's own process. A ledger dump taken at the refusal shows one 256 MiB command row whose owner PID is the test process, with a live child worker. The foreign holder in the outer ledger is a different process. So this is contention inside the fixture, not a leak of the private ledger and not ui-server: root turn fixtures observe refusals through shared maintenance admission #3019's cross-process cause.
  • Why. Both apps use DB_PATH: ":memory:", share one admission domain with room for one command, and each runs --version then scratch prune unjoined at boot. The second app's boot prune overlaps the first app's first search.
  • Third hosted sighting: main run 41661689070 on 2026-11-03, inside a cancelled run.

The reproduction criterion is met. Repair criteria: each fixture app admits through its own domain, or each app's boot prune is joined before the first search; the isolation assertions are unchanged; with that change removed, the 100-run loop fails again, and with it restored it passes.

Triage 2026-11-13 at main 631bbae2c: added the reproduction, the holder's identity and the third hosted sighting; marked the reproduction criterion met and stated the repair criteria; removed needs: repro.

Activity

  1. added this to the 0.45.0 milestone on Nov 5, 2026
  2. added
    type: test
    area: ui-server
    needs: repro
    priority: p1
    on Nov 5, 2026
  3. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    Triage 2026-11-09 at main fb999b8ba: all cited anchors still resolve. This host refuses unprivileged user namespaces (unshare … uid_map: Operation not permitted) inside and outside the sandbox, so the two-app case cannot run locally. Recorded the attempt in the body. needs: repro, p1 and 0.45.0 kept. No suitable open epic has room: #736 is full and #2753 is browser-only.

  4. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    2026-11-10 triage at main 3aadc8df5: repaired the const tempDomain pointer (host-boundary.ts:366 → :370, moved by #3458). Added that the held by: command maintenance-busy refusal recurs in passing hosted unit shards; the inner holder is still unnamed. No failed main CI job from 2026-11-08 to 2026-11-10 shows the two-app case, and it passed in job 128779514190. needs: repro, p1 and 0.45.0 kept.

  5. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Another occurrence, 2026-11-10, in candidate confirmation run 42843236638 (job 129924481094, unit), for PR #3851 at head b49ac2af7. That PR changes only scripts/integrate.ts, scripts/test-health* and skill docs; the unit category was selected through the root-tooling closure.

    two differently configured apps isolate exec wrappers and login/passkey buckets (#2752) failed in both its runs (2476 ms, then 5085 ms in isolation) at app-state-isolation.test.ts:106. ithaca: authenticated CLI search got 500, not 200: Maintenance temporary storage is busy: this command needs 256 MiB, 1 maintenance reservations hold 256 MiB of the separate 256 MiB budget (held by: command). Nothing ran. The isolated rerun runs under the private maintenance-ledger harness (PRIVATE_MAINTENANCE_TEST_COMPLETES) and failed the same way.

  6. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Test-health run th-20261110163814-571eb3 (cluster 0), at main 0129244ad: not reproduced. bun scripts/test-health.ts measure ran packages/ui-server/tests/app-state-isolation.test.ts 10 times, shuffled and together with four other ui-server files (brain-client, close-cancels-shared-runs, cron-scratch-prune, brain-sse-terminal), on a local host at load average of about 37-41. All 10 runs passed, including the private-maintenance child of the two-app case (median 8.8 s for that case). A clean result does not show the refusal cannot happen. needs: repro stays.

  7. removed this from the 0.45.0 milestone on Nov 11, 2026
  8. schlessera commented on Nov 13, 2026

    @schlessera
    OwnerAuthor

    Reproduced naturally and in isolation (2026-11-13). It is not rare, and it is not another process: the test's own two apps contend for one budget.

    Reproduction. Main 631bbae2c, a clean 4-CPU Ubuntu 24.04 VM with nothing else running, the unchanged file, beside 6 busy loops:

    Runs Failures Signature
    100 4 (runs 21, 23, 43, 67) ithaca: authenticated CLI search: {"error":"Maintenance temporary storage is busy: … 1 maintenance reservations hold 256 MiB of the separate 256 MiB budget (held by: command) …"}, expected 200, received 500

    Every failure is the first search of the first app, as in the hosted failures. Idle it passed 3 of 3, and a first batch of 20 beside 8 busy loops passed 20 of 20, so this needs load but not much of it.

    A third hosted sighting, on main. Run 41661689070, unit (1) at dc832c3ad on 2026-11-03, has the same failure. It was inside a run that was cancelled as a whole, which is why earlier scans of failed runs missed it. It predates this issue.

    Who holds the budget. I dumped the ledger at the moment of refusal, with no other instrumentation, and a failure came at run 15 of that loop. The ledger held exactly one row: 256 MiB, kind command, with an owner PID equal to the test process's own PID (65540) and an attached worker (65725) that is a child of the test process. The wrapper's deliberate foreign holder was a different process (65489) in the other ledger, so the private ledger did its job. The holder is a command this test process launched itself: one of the two apps' boot commands, still running.

    Why the two apps collide. Both fixture apps use DB_PATH: ":memory:", so neither selects its own admission domain (const tempDomain, packages/ui-server/src/brain/host-boundary.ts:370) and both fall back to the one per-UID ledger, which the test's private wrapper replaces with one private ledger for the whole test. The budget admits exactly one 256 MiB command. Each app runs --version and then scratch prune at boot, unjoined (void tick(), packages/ui-server/src/cron/scratch-prune.ts:133). A timeline from an instrumented run, relative to boot start:

    App --version scratch prune First search
    ithaca +1.0 s +1.3 s +2.2 s
    pylos +1.8 s +2.1 s +2.4 s

    The second app's boot prune starts about 50 to 300 ms before the first app's first search. When that search is admitted while the boot command still holds the budget, it is answered 500. Under load the two overlap.

    What did not reproduce it, which is worth knowing.

    • Holding the fake CLI's scratch prune for 4 s, in either app or both: 13 of 13 runs passed. Where I recorded the timeline, the first search waited until the held prune had finished and then returned 200. I do not know what decides between that wait and the refusal; I record it so nobody repeats the experiment expecting a refusal.
    • A timeline patch in the exec wrapper (one date call per command): 0 failures in 68 runs under the same load, against 4 in 100 without it. The instrumentation shifts the timing enough to hide the collision. The ledger dump above runs only on refusal for that reason.

    Fix direction, all inside the test. Give each fixture app its own admission domain (a real DB_PATH under the test's root instead of :memory:), or join each app's boot prune before the first search. Either keeps the isolation assertions as they are. A removal mutation is easy to state: with the join removed, the loop above fails again.

    needs: repro comes off. #3019 is a different mechanism (a foreign process on the shared per-UID ledger); this one happens under a private ledger with nothing else running.

  9. added
    agent-ready
    and removed
    needs: repro
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-serverpriority: p1type: test

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions