Repository navigation
Description
Out of scope
No change to #3185's normal live-dialogue/app-close delivery, retry handlers (#3217), provider calls, native release/releaseStage RPC lifetimes, worker termination, early reader close, initial boot acquisition deadlines, deployment behavior or unrelated cleanup refactoring. Discovery does not authorize implementation in #3216.
Context
Source inspection at fetched main 5edcc3c38e6451d01ea6e1c6cd68f85ee4adead7 found standalone cleanup awaits without a caller storage-settlement bound:
- The cron context close awaits
leases.close()before closing its tracking database, and its error path also awaits it (return { boundary: execution.boundary,packages/ui-server/src/bin/brain-ui-cron.ts:154-157). - Failed app boot drains registered cleanup then awaits
nativeLeases.close()before surfacing the boot outcome (for (const close of bootCleanup.reverse()),packages/ui-server/src/app.ts:1493-1494at mainc82e30ae4). This path does not run the normal app-close guard from ui-server: bound live dialogue drain when a storage write never settles #3185 / CONTRACT: bound dialogue failure drains and retain owned cleanup #3216. - The concrete native lease owner joins pending operations, commits deletion intents/receipts and awaits its own writer before its reader (
let closing,packages/ui-server/src/brain/native-brain-leases.ts:274-288;async function releaseOwned,packages/ui-server/src/brain/native-brain-leases.ts:110-119). A native SQLite request that never acknowledges can keep these awaited promises pending. Native RPC waits are a different boundary and must not acquire a SQLite deadline.
These are factual unbounded source awaits, not a reproduced cron/failed-boot hang or proof of a real fsync failure. Independent #3216 review identified them as outside the original normal app-close scope. #3185 covers live dialogue and normal app close; #3217 covers retry catalog waits. Neither owns standalone cron teardown or failed-boot cleanup.
Duplicate search on 2026-10-31 covered lease/cleanup, native/close/hung and cron/lease across open and closed issues. Inspected #3185 and #3217; no dedicated matching follow-up was found. Historical #2850/#3004 address off-loop write ownership, not this bounded caller outcome.
Scope
Reproduce and bound caller waits caused by actual pending lease SQLite requests during standalone cron teardown and failed app boot, retaining genuine underlying cleanup ownership. Reuse the existing concrete native pending-request observation where appropriate. Keep native RPC lifetime and original primary/aggregate boot failure reporting honest.
Acceptance criteria
- A deterministic keyless file-backed/native-worker fixture holds a lease SQLite request, invokes actual cron cleanup and a genuine failed app boot cleanup, and establishes the currently pending caller outcome. Release and join all test-owned storage in teardown.
- Actual unresolved native SQLite cleanup produces a bounded typed indeterminate outcome under a documented technical budget, without reporting write completion, cancellation or safe worker disposal.
- The original continuation retains pending operations, SQLite writer and reader until real return; release after the boundary completes the genuine write/cleanup in ownership order. A confirmed lease deletion is never fabricated.
- Failed boot preserves the original boot error and represents any separate indeterminate cleanup outcome without replacing it with a false successful cleanup receipt.
- Healthy teardown and genuine errors retain their behavior. A held native release/releaseStage RPC with no pending SQLite request does not acquire this deadline.
- Restoring the unbounded SQLite cleanup path fails a named real runtime assertion; existing offline and ownership controls remain enabled. Audit equivalent cron and failed-boot cleanup branches without broadening into initial acquisition deadlines.
Verification
Build the held-writer fixture from the first acceptance criterion and record the pending caller outcome before bounding it. That fixture is this issue's first deliverable, not a prerequisite for starting. Use the repository root test wrapper, explicit runtime identity and task-owned native fixtures; no network beyond loopback, API keys, provider or live-service calls. The native fixtures need unprivileged user namespaces. Static source inspection and #3216's normal-app runtime do not supply the fixture. Run bun run check:pr --base origin/main before marking the PR ready.
Contract impact
Preserve FULL durability, native authority and cleanup ownership. Assess reuse of the existing StorageSettlementIndeterminate/cleanup observation contract; document any actual additional caller surface and supply CONTRACT/API/changeset changes where required. No priority, release milestone, blocker relation or epic membership is inferred.
2026-11-02 triage at main a84d9bfbcb4e608b504aa0a9feb1144ad9a0b77e: Refreshed moved cleanup/lease anchors. The bounded host capability probe unshare --user --map-root-user --net /bin/true failed before any fixture with write failed /proc/self/uid_map: Operation not permitted. This is an environment limitation, not reproduction of a cron/failed-boot hang. Actual held-writer cleanup evidence is still missing, so retain needs: repro and no readiness. Wanted unscheduled follow-up is p2; no native RPC deadline or cleanup policy is selected.
2026-11-04 triage at main 53b862123d7b8e4c9d039859fabdc9fc6ad4cd36: Refreshed the active named-source navigation after inspecting the current declarations; existing decisions, historical receipts, child prerequisites and readiness remain unchanged. No new runtime qualification or implementation is claimed.
Triage 2026-11-08 at main 8752570331ffebdbb9233196412781f6cd71f3d9: Verified the moved active source anchors and refreshed navigation. Historical measurements and source-bound failure receipts keep their identities; existing scope, rulings, needs, priority, assignment and release attribution are preserved. This source review supplies no new runtime qualification or epic completion.
Source check — 2026-11-10
At main 3aadc8df5, the cron anchors (brain-ui-cron.ts:154-157) and lease anchors (native-brain-leases.ts:110-119, :274-288) still match. The failed-boot cleanup moved to app.ts:1428-1429 (repaired above). #3822 (e4c4c1c99) moved it and does not change it: the path still awaits every bootCleanup entry and then nativeLeases.close() with no bound. Since 2026-10-31, the only cron change (3624e5cb1, one config field) does not touch teardown. No merged PR bounds these awaits.
No runtime attempt was made. No existing test holds a lease SQLite request across cron teardown or failed boot, so a reproduction means building the fixture that acceptance criterion 1 describes. That is the issue's own first deliverable, not a bounded triage rerun. Note that unshare -Ur succeeds on the 2026-11-10 triage host, so the 2026-11-02 namespace limit is not universal.
What would complete the reproduction: a keyless fixture that holds one lease-store SQLite write unacknowledged, then calls real cron close() and a real failed createApp boot. It must record that each caller stays pending, with no bound, while the write is held.
Epic fit: compared with #3813 (proportionate containment). That epic's tasks are refusals and latches found by its audit. This issue is about how long a cleanup await may stay pending, with the boot error already decided, so it stays standalone.
2026-11-11 source refresh: the failed-boot cleanup is now at app.ts:1458-1459; both awaits remain unbounded. The held-writer runtime reproduction is still missing, so needs: repro remains.
Triage 2026-11-14 at main c82e30ae4: the cron and lease anchors hold; the failed-boot cleanup moved to app.ts:1493-1494 and is still unbounded. Replaced needs: repro with agent-ready: no failure was ever reported here, and the missing "reproduction" is the fixture that acceptance criterion 1 asks the implementer to build. type: fix, priority: p2 and no milestone are unchanged.
Activity
schlessera commentedon Nov 10, 2026
2026-11-10 triage at main
3aadc8df5: Repaired the failed-boot cleanup citation toapp.ts:1428-1429. #3822 moved it and does not bound it. The cron and lease anchors still hold, and no merged PR bounds these awaits. No runtime attempt was made: a reproduction means building the held-writer fixture in acceptance criterion 1. The body now names the evidence that completes it. Compared with epic #3813 and left this issue standalone: that epic covers guard refusals and latches, and this issue covers how long a cleanup await may stay pending.needs: reproandpriority: p2are unchanged.