Withhold retained-field messages in session chat history
The session-chat history GET previously returned every saved UIMessage intact. A retained-field companion could therefore expose its cached numbers through sibling text, tables or metadata even when current-source disclosure is unavailable.
The existing handler now calls a default-denied retained-field history gate after session/chat authorization and message selection. Structured reserved-family markers cause the entire stored message to be omitted; unrelated messages, legacy raw reports and controls preserve their values and order. The validator carries the actual authenticated account to the gate alongside validated session/chat IDs and the database message ID. Successful history responses are private/no-store.
There is no positive disclosure branch or implemented current-authority transport. Missing authority, injected unavailable/withdrawn/stale/error states, thrown failures and even unexpected cached ready results all withhold the complete message. No new public route, SQL, grants, flags, provider calls, latest lookup, re-key, retain or expansion. The branch includes main b42355d6 (merged API1291) via a normal merge; its proposal bytes and Database143 frozen source are unchanged.
Composition merge 80c7a0027b20a0f35750a89c75897ebfbe744764 (parents 6ef68441f7d4fe39dee2941b2b28b52364cc7b0d, b42355d6ffe6a0492b74f17329e13d36bb440ad5).
Validation: 174 composed tests pass (100 session/chat plus 74 retained-selection/evaluator/math). Seven privacy regressions failed before implementation; all 100 session/chat tests now pass, including 17 tests through the actual GET/handler/validator/gate with synthetic auth/storage boundaries and network prohibited. Full lint, changed-file formatting, diff checks and strict gate-module TypeScript pass. Local broad and production TypeScript checks are limited by missing MCP extension packages/generated UI in the reused dependency tree; logs are preserved. Clean-install CI passed on composition80c7, including production and response/release TypeScript checks. Test-only successor5c53 adds the missing mode discriminator case requested by Cubic; its full CI now passes as well. Production bytes are unchanged.
Call graph, behavior and remaining gates: lib/sessions/chats/retained-field/README.md. This covers only this history GET and marked message family. It cannot infer provenance of unmarked text in separate messages, revoke already delivered client data or qualify initial-send/replay/export/model/other-history paths. Current-authority/publication integration and independent review remain required; no merge or activation is requested here.
Latest head 5c53d45d846e503abccd305256373f7e6f594b1d: one-line negative test addition after Cubic review; no production changes.