Skip to content

ui-server: boot degraded instead of refusing over a secondary backend, a warning setting or a recoverable gate #3817

Closed

Description

@schlessera

Context

These checks refuse to boot the whole server over something that a degraded mode would cover. Some were deliberate choices, so they are lower priority. Items 1–2 were verified on main 4b8db90de. Items 3–4 were traced during implementation on 2026-11-10; their existing full-app boot refusals are necessary for the reasons below.

  1. Any unresolvable configured backend refuses boot (packages/ui-server/src/app.ts:425-432, assertBackendResolvable at packages/ui-server/src/agent/backend.ts:307, probeBackendRuntimes at :412). This was deliberate (ui-server: know which Claude Code binary ran, and refuse to boot without one #211), so that health never reads healthy while every turn fails. That is sound for the only or default backend. For a secondary backend it removes the backends that work.
  2. An invalid token mint date refuses boot (packages/ui-server/src/agent/subscription.ts:46-60, caught by createSubscriptionMonitor at packages/ui-server/src/agent/subscription.ts:149-162). This was deliberate (backends: warn before the Claude subscription token expires, and show a rejected one as a re-login instruction #254): a silently ignored date would switch the expiry warning off. But it is a warning setting.
  3. A failed protected-file quarantine move blocks boot (packages/ui-server/src/brain/governed-manifest.ts:195, :225; packages/ui-server/src/brain/host-execution.ts:100).
  4. An interrupted operational restore leaves a boot gate (packages/ui-server/src/inbox/recovery-gate.ts:4, packages/ui-server/src/inbox/snapshot.ts:428, :463; checked at packages/ui-server/src/app.ts:532). Restore is an operator action, so this matters least.

Out of scope

  • Executing with a version-incompatible backend.
  • Evaluating agent-created configuration while quarantine has failed.
  • Dispatching inbox work from a partially restored state.

Scope

  • Backends: refuse boot only when no usable backend remains, or the default backend is unusable. Otherwise mark the failed backend unavailable, report degraded health, and keep the others.
  • Mint date: report "expiry unknown: invalid mint date" prominently in owner status and logs, and keep serving.
  • Quarantine failure and interrupted restore: boot into a restricted mode with authenticated diagnostics and the recovery operation, keeping every execution or dispatch that the failure makes unsafe refused.

Acceptance criteria

Verification

Unit and integration tests in packages/ui-server/tests; bun run check:pr --base origin/main.

Contract impact

Possibly additive: a degraded-health state and a status field. Check docs/integration-contract/http.md for the /api/health shape and mark the commit CONTRACT: if it changes.

Historical gate trace (2026-11-10)

The acceptance criterion explicitly permits a documented boot refusal after tracing. Both historical cases require that branch for the current full app:

  • Quarantine failure means an executable protected input remains in the brain. reconcileExisting refuses before installing its writer gate (packages/ui-server/src/brain/host-execution.ts:100-113); normal startup next prepares the boundary and evaluates the brain CLI. A strict turn profile or read-only UI does not prevent that earlier evaluation. The failed paths and errors remain in the manifest, and repairing the quarantine destination lets the next reconciliation retry the move. Serving diagnostics safely would require a separate path that never evaluates the brain, rather than removing this check.
  • Pending restore covers the complete operational database, not just inbox dispatch. Resume requires the same snapshot checksum/root and an unchanged logical database (restoreInboxSnapshot, packages/ui-server/src/inbox/snapshot.ts:428-445). Normal authenticated serving writes to that database and would invalidate resume; historical dialogue authority is invalidated only in the final restore transaction (const recovered, packages/ui-server/src/inbox/snapshot.ts:463-480). The supported local brain-ui-inbox restore command resumes the same snapshot without starting the app. The pending record does not retain the snapshot bytes, so startup cannot reconstruct them automatically.

The durable design record is docs/decisions/proportionate-containment.md, section “The two historical boot gates traced in #3817”. No unsafe execution, dispatch, or version-incompatible backend is permitted by the implementation. Citation locations above refer to the implementation candidate; original behavior remains described in Context.

Activity

  1. added this to the 0.45.0 milestone on Nov 9, 2026
  2. added
    type: fix
    area: ui-server
    priority: p2
    agent-ready
    on Nov 9, 2026
  3. self-assigned this
    on Nov 10, 2026
  4. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Claiming #3817 under claim token 3817-degraded-20261110 in the dedicated branch fix/ui-server-degraded-boot. Readiness and the cited boot checks verified. The collision scan reports shared downstream proof closures; the epic also has concurrent app.ts work in #3816, which will be preserved during rebase. Scope: secondary-backend containment, explicit unknown subscription expiry, and tracing the two historical recovery gates before narrowing them.

  5. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Readiness trace completed: items 3 and 4 use the acceptance criterion’s documented-refusal option. Quarantine must finish before the normal boot path evaluates the brain CLI; pending restore requires an unchanged complete database and has not yet invalidated historical dialogue authority. The issue body now contains the source evidence and recovery path. Secondary-backend exclusion and explicit unknown expiry are implemented with failing-first and restored-mutation receipts.

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-serverpriority: p2type: fix

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions