Skip to content

ui-server: recover active trust reads after out-of-band policy edits #4352

Open

Description

@schlessera

Context

Final review of #4270 at 11f56e98dc42129cadb8622cb7680d5e64e6830a deferred active-turn recovery after an out-of-band trust edit. When governance.md trusted_sources differs from SQLite, live reads throw stale_revision. At main a3395c4b2 the live projection is freshProjection, which throws when the verified disk rules differ from the durable projection (freshProjection, packages/ui-server/src/brain/trust-settings.ts:148-159); observePolicy also throws on a changed generation or anchored-verification refusal (observePolicy, packages/ui-server/src/brain/trust-settings.ts:124-146). The only automatic refresh is live.refresh at turn preparation (packages/ui-server/src/ws/session-run/backend-entry.ts:180); active turns only subscribe for invalidation (packages/ui-server/src/brain/turn-egress.ts:395). Turn startup, Settings and policy-proposal publication refresh the projection, but a hand edit or sync during an active turn can leave every admission read refusing, including model relays and unrelated destinations, until another refresh or turn start. This fails closed and recovers on the next turn.

Previously blocked by #3609 (closed as completed 2026-11-21); no open dependency remains.

Scope

Automatically reconcile a stable valid out-of-band policy generation during an active turn, keeping exact removal fences while restricting only affected uncertain operations.

Out of scope

New trust forms, broadening rules, owner-authority changes, rewriting historical decisions, root continuity, clearing taint, or adding policy text to provider history.

Acceptance criteria

  • A real hand edit or sync of trusted_sources during an active turn fences admissions until a stable anchored observation and durable projection agree.
  • The active host then recovers automatically without Settings reads, a new turn, restart or manual action.
  • Removing a source rule still terminates its active source instance exactly; unrelated valid source instances and model relays recover without borrowing the removed rule.
  • Invalid/unreadable policy retains last-valid rules plus an error, while changed verification never admits old rules.
  • Lock waiting is abortable and bounded; unchanged per-chunk reads stay cheap and do not parse/read the full file.
  • Two-reader/publication and real transfer tests cover the recovery and removal races with a restored failing mutation.

Verification

Use keyless offline real policy files, independent writers and sockets; assert exact receipts, no dispatch during uncertainty, automatic healthy-peer recovery, and unchanged provider history.

Contract impact

Recover existing fail-closed enforcement more narrowly; no new permission. Update the trust/refresh text in docs/integration-contract/package-api.md and a changeset for any observable refusal/recovery behavior. Maintainer final triage deferred this finding at p2 to 0.45.0.

2026-11-23 triage at main a3395c4: re-verified that active turns still never refresh (only turn preparation does) and refreshed the drifted trust-settings citation by anchor; #3609 is closed, so the blocker line is now historical. Scope, criteria and p2/0.45.0 unchanged.

Activity

  1. added
    area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    securityAuth, isolation, egress, secrets, or anything in the threat model.
    on Nov 21, 2026
  2. added this to the 0.45.0 milestone on Nov 21, 2026
  3. added
    type: fixSomething is broken and must behave the way it is documented.
    and removed on Nov 21, 2026
  4. schlessera commented on Nov 21, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #3609 is closed, so scripts/sync-project.ts is removing the blocked label.

  5. added
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    and removed
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Nov 21, 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-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.securityAuth, isolation, egress, secrets, or anything in the threat model.type: fixSomething is broken and must behave the way it is documented.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions