Repository navigation
Description
Context
These came out of the reviews of #3816's PR and were left for later. Both main defects are narrow states in which a recoverable condition still blocks or hides work. Neither happens on a default host without several coinciding failures.
1. Quarantined stage charges alone can refuse all staging as "busy, retry later"
prepareStage (packages/ui-sdk/src/server/native-brain-manager.ts:557, mapped at packages/ui-sdk/src/server/worker-native-output.ts:641-642) gives a stage that cannot fit the code capacity. Users see that as worker_state_busy ("Retry after another conversation finishes").
When the charge comes only from quarantined stages, nothing frees it while the process runs, so the retry never succeeds. Scenario: the manager crashes while a stage is active, the stage directory and allowance survive, and that stage's intent later becomes unreadable. With a budget of one allowance:
- the boot report shows
stagingChargedBytesequal to the allowance; /api/statusstays healthy;- every new stage is refused as busy, until a restart that follows a manual repair.
A throwaway test during review reproduced exactly this. On a default host it needs one surviving quarantined stage per concurrent session.
2. Unresolved journal records are not shown to the owner
A persistent I/O error (for example EACCES) while verifying a journal object leaves that record unresolved and its reservation charged (packages/ui-server/src/brain/journal-accounting.ts:249-257). That is correct: an unknown stays unknown. But the only signal is one stderr line per boot. The owner cannot see the count anywhere (rule 5 of proportionate containment).
3. Smaller items
- One unreadable allowance sets the quarantined charge to Infinity. Every later quarantined ID then fails the safe-integer check and records a false "exceeds safe accounting range" diagnostic (
native-brain-manager.ts:355-359). - The non-UUID skip at
native-brain-manager.ts:351is untested. Removing it leaves every test green, because a non-UUID name with no directory charges 0 anyway. Creatingstages/invalid/in the "a non-UUID receipt is quarantined" test would make it able to fail. - The recovery refusal text does not say that a manager restart is needed after the repair. The decision record does.
Scope
- Classify a stage refusal by whether waiting can clear it. If quarantined charges plus the request exceed the budget, return the recovery-style refusal instead of
capacity, and report that state so/api/statusshows it as unhealthy. If it can be proven that no storage survives behind a quarantined directory at manager boot (stage processes die with their parent), charging nothing for it is acceptable, but only with that proof recorded. - Show the count of unresolved journal records, and their first cause, on authenticated
/api/status. - Fix the three smaller items.
Out of scope
- Releasing any charge whose storage might still exist.
- Changing budget defaults.
Acceptance criteria
- With a budget of one allowance and one surviving quarantined stage, a new stage is refused with the recovery code and copy, not
capacity./api/statusreports unhealthy with the cause. The test fails on the current tree and has a mutation receipt. - A journal record left unresolved by an I/O error appears on authenticated
/api/statuswith its count and first cause, and an unauthenticated request does not see it. Tested. - An Infinity charge records no false overflow diagnostic for later IDs. Tested.
- The non-UUID skip test fails when the skip is removed.
Verification
Unit tests in packages/ui-sdk/tests and packages/ui-server/tests with deterministic doubles. No btrfs is needed for the classification. Run bun run check:pr --base origin/main.
Contract impact
Additive /api/status fields, which need a CONTRACT: commit and the HTTP contract entry.
Part of #3813.
Blocked by #3816
Activity
schlessera commentedon Nov 10, 2026
Claiming #3826 for implementation. Claim token: staging-journal-3826-20261110. Branch:
fix/3826-staging-journal-recovery, starting at freshly fetchedorigin/main. Blocker #3816 is delivered by #3824. Scope and cited source behavior verified; I will preserve uncertain charges, add authenticated recovery diagnostics, and leave the PR ready for coordinated confirmation and merge. Collision scan: closure: #3054, #3056, #3059, #3069, #3116, #3393, #3437, #3464, #3581, #3622, #3662, #3726, #3735, #3761, #3772, #3786, #3805, #3827, #3832; path: #3806.schlessera commentedon Nov 10, 2026
Implementation is ready in #3839 at
003333e02ff2a7df85640eebd2bb61ec7acd0a3d, with milestone 0.45.0. All four acceptance criteria have passing focused proof and restored mutation controls. The PR records the passing preflight, seven mutation receipts, and exact limits of the broader local attempts. Existing #2769 and new #3834 / #3838 track unrelated fixture/timing failures; broad local proof is not claimed green. No confirmation or merge was run. The PR remains ready for the coordinator.