Skip to main content

Conversation browsing

Mobile Chat retains the shared app shell and navigation while compact screens switch between the conversation list and a selected thread. Wide screens keep both panes visible. The list remains scrollable with tall filter content. Conversation pages load automatically when the remaining scroll distance falls below three quarters of the viewport, including when the first page cannot fill the screen. Only one automatic request is made for an unchanged scoped list; failed or empty pages retain a manual Load more action rather than retrying in a loop. The manual action also remains available when filters show no rows. Pagination results and failures from an older workspace or refresh generation cannot publish into the current list. Pending local rows continue to use the existing scoped Chat collection overlay.

Composer

Attachments use the adaptive sheet shared by compact and expanded mobile surfaces. Send remains disabled while a message or attachment upload is in flight, and the icon exposes a localized tooltip. This changes neither message transport nor attachment permissions; live device and production verification are still required for delivery. Regression coverage: chat_conversation_layout_test.dart, chat_pagination_scope_test.dart, and chat_thread_layout_test.dart in apps/mobile/test/features/chat.

Assistant settings route chrome

Mira quick settings and the Assistant entry in general Settings open the same account- and workspace-scoped editor. Because this imperative route covers the app shell, it owns a branded Assistant Settings header, top safe area, and the shared floating Back action. Content reserves space above that action. Model selection and download state remain in the existing scoped model controller. The actual header and saved preference are covered by assistant_settings_hub_test.dart. Calendar and Finance product entries open their existing preference editors directly, matching general Settings: Calendar edits the first day of the week, and Finance controls amount visibility. Legacy Preferences deep links still redirect to general Settings. settings_product_editor_checks.dart covers opening each product editor and persisting a choice on the actual Settings host. General Settings offers a device-persisted built-in browser (default) or external default browser choice for ordinary web links, including assistant Markdown and model publisher/license links, Mail, Meet chat, Notes and storefront previews. Authentication, app-update and signed-download flows keep their dedicated launchers. Mail, phone and SMS links use the system handler. Visible link actions report a localized generic failure without exposing URLs or platform details, or silently switching browser modes. Initial app-link opt-outs return a safe failed result when no UI feedback surface is available. Late settings reads cannot replace a newer read or a saved selection. Helper and settings widget regressions cover persistence, URL admission, mode selection and retry errors.

Account notification preferences

Account notification preference reads and writes accept browser cookies and mobile Bearer sessions. Reads remain scoped to the authenticated user and account rows (ws_id IS NULL); writes derive the actor from the session. This authentication repair does not establish cross-platform notification delivery or enforcement. Route regressions cover credential forwarding, anonymous rejection, account isolation, invalid writes and bodyless HEAD responses. Rust GET already uses caller-token reads; unported methods continue through the live Next API.

Stream completion

Native Chat and Mira replies stop reading their NDJSON response after a verified done event. Chat requires a saved message receipt; Mira requires a saved assistant message receipt. Text or tool deltas alone do not prove persistence. An explicit server error remains a failed reply even when followed by done. Malformed data before completion and EOF without completion remain errors. Completed replies ignore post-terminal rows and bytes, and UTF-8 decoding retains partial characters across transport chunks. Response cancellation starts at completion; cleanup failures or stalls do not replace the saved receipt or an earlier transport failure. This applies to native Chat streaming; legacy Assistant SSE and explicit Live sessions keep their separate protocols. Regression coverage: chat_stream_terminal_test.dart and assistant_chat_transport_terminal_test.dart exercise the real repository and Assistant cubit with synthetic response bytes, alongside parser and scope tests. These checks establish source behavior; production provider/storage failures and actual device transport still require separate runtime evidence.

Durable assistant receipt and cleanup

After the native Chat/Mira batch RPC returns saved assistant messages, shadow resource cleanup is supplementary. A thrown cleanup failure cannot remove the saved JSON/NDJSON receipt or turn an accepted reply into a retry prompt. Failures before authoritative persistence, including permission or database errors, remain failures; no text-only success or remote fallback is introduced. native-ai-cleanup-receipt.test.ts covers the actual message route with durable save followed by failed cleanup. This establishes a source boundary, not the cause of every missing reply or device/provider delivery evidence.

Compact on-device status in the header

Native Mira Chat shows on-device readiness, preparation or attention status in its shared branded header, rather than a repeated block above the conversation. The accessible control opens full model status and failure guidance with an explicit model-settings action. It retains a 48px touch target and truncates the compact label on wide layouts. Editable assistant titles have a separate 48px on-device recovery control, so tapping the name always opens rename. History and Assistant Settings share the overflow menu; Live exposes Settings there and keeps its separate information action. An editable assistant title or registered Chat local status uses a 48px header content minimum; default and other-route geometry stays unchanged, and floating content clearance matches. The current saved assistant name appears in both Chat and Live; Live hides the local-text chip because voice uses its separate remote runtime. Returning to remote Chat removes the chip. Retained recovery actions reject actor/workspace/selection changes and disposal. No status control sends a failed local prompt remotely or proves native readiness. assistant_compact_model_header_test.dart covers the actual page and header in English/Vietnamese at 320px with enlarged text, recovery guidance, remote return, Live visibility and stale actions. assistant_mode_title_test.dart preserves fallback titles and verifies current name changes. Actual-device safe-area, accessibility and native model loading remain separate delivery checks.

Assistant name write admission

The mobile header shows the current custom name, or Mira when none is set, in both Chat and Live. Tapping its name opens an explicitly focused dialog with native text selection and paste controls. Save trims the draft and permits 1–50 characters. Pending saves prevent duplicate submission; failures retain the draft with a localized safe error for explicit retry. Cancel closes the dialog and does not undo a request already admitted by the server. Account or workspace departure invalidates retained dialog actions, including returning to the same account or workspace. On-device recovery remains a distinct control. Opening an unsent local draft is a presentation action and does not require network authentication. Its retained action still checks the captured account, workspace and departure epoch. Live, overflow and network actions keep their authenticated admission requirements. assistant_name_dialog_test.dart covers English/Vietnamese save, keyboard, native paste, safe retry, busy/cancel and held-write departure cases. assistant_name_navbar_test.dart exercises the production page and action rail at 320px with text scales 1, 2 and 3, stable callbacks and stale actions. shared_navbar_large_text_test.dart retains default factories and other-route geometry. These are source/widget checks, not device or server delivery proof. Mira’s custom name is personal to the authenticated account, including when the mobile assistant is opened from a workspace. A rename captures its account and cache identity before awaiting storage or network admission. Logout/cache-clear and superseded local rename intents cannot publish into a successor session or enter the outbox after departure. Rename and Soul refresh share a publication generation so an older response cannot replace the latest accepted local view. An online update requires a valid server Soul receipt; missing or malformed receipts do not become a fabricated Mira success. Offline names remain pending account-owned intents, rather than confirmed server writes. This client admission boundary does not provide cross-client compare-and-swap or claim that ambiguous network writes are safe to replay automatically. Genuine permission and transport failures retain their existing behavior. Successful live update_my_settings tool results also force an account-owned Soul refresh, resolving the SDK’s nameless result from its matching input in the current assistant message. Preliminary, failed, conflicting and unmatched results do not refresh; duplicate results refresh once per submission. Restored history never replays this effect. Departed actor/workspace operations cannot admit effects or report late refresh errors. A metadata refresh failure keeps the confirmed reply and last accepted name, and offers a localized notice to reopen assistant settings. Genuine reply persistence and transport failures remain separate failures. This rule does not settle conflicts with pending offline name edits or provide cross-client ordering guarantees. Workspace-context and immersive-mode effects use the same current-input identity, definitive-success and duplicate admission rules. Workspace context requires a nonempty destination; immersive mode requires an explicit boolean, including false. A missing or malformed value does not become a fabricated UI action. assistant_tool_receipt_test.dart exercises the actual native NDJSON mapping, tool admission, duplicate/history isolation and delayed scope changes; assistant_tool_name_title_test.dart verifies the production shell title in both languages using native-mapped submission events. These tests do not establish device or production runtime delivery. Regression coverage: assistant_soul_name_writer_test.dart, assistant_name_publication_test.dart, and offline_queue_disposal_regression_test.dart cover held cache/queue/network admission, actor and workspace departure, same-actor logout restoration, superseding writes/refreshes, malformed receipts, and admitted ACK cleanup.

Assistant reply error and save receipts

Native Chat and mobile Mira use the canonical messages POST adapter. By default, an upstream SSE error produces the fixed public message AI response unavailable when request-scoped server history contains no saved assistant reply. Upstream error text, provider bodies, credentials, URLs, and model diagnostics are never used as public error messages. Unknown error payloads use the same fixed fallback. This applies to streaming and ordinary JSON requests. A saved partial assistant reply remains authoritative even when the upstream stream fails. Failed history readback retains the separate send failure response. Without an upstream error, missing saved history retains AI response was not saved. Replaying a saved client request returns its existing messages without generating or charging again. This error mapping does not establish the cause of any customer save incident or repair database persistence. Regression coverage: ai-stream-error-regression.test.ts beside the canonical apps/web/src/app/api/v1/workspaces/[wsId]/chat/conversations/[conversationId]/messages/route.ts. The migration backend owns GET only; POST remains tracked Next.js backlog until mutation parity is implemented. Live native build and save/reopen verification remain separate delivery requirements.

Explicit mobile Assistant model and credit settings

Native Chat-backed Assistant model and credit-source choices use the authenticated conversation settings PATCH, with its manage_chat permission check. The client admits one request after credential preparation, bound to the current actor, workspace, conversation, selection revision and page lifetime. It validates the returned conversation ID and complete model, credit source, credit workspace and thinking-mode tuple before publishing the choice or its local preferences. Concurrent choices are denied while one is pending. Native history restoration hydrates the complete validated model, credit source, nullable credit workspace and thinking mode before admitting Send. It is a read-side operation under the current actor/workspace/chat generation; opening history never PATCHes settings and needs no manage permission. Old native snapshots without a complete tuple must revalidate it. Server-default nullable credit scope and fast mode remain exact values, rather than being replaced by workspace preferences. Permission denial, malformed receipts, uncertain transport and stale completion retain the prior local settings and draft. A stale or missing response can still follow a physical server write; the client does not compensate or retry it. Localized notices direct the user to inspect settings before another explicit choice. This is a client lifecycle fence, not cross-client compare-and-swap. With no selected conversation, a choice is a local intent. First native creation captures a one-use model/credit/thinking tuple and includes it in the existing creation request. The route retains view_chat; the canonical creation transaction retains create_chat for AI conversations and writes the complete initial settings with the conversation and owner membership. It returns the stored tuple bound to the actor, workspace and new chat. There is no automatic post-creation settings PATCH and no new manage_chat requirement for otherwise authorized first use. Explicit later settings edits still require manage_chat. Workspace credits may target only the active workspace; personal credits resolve to the actor’s personal workspace. An explicit null scope is retained while billing resolves the corresponding authorized workspace. An unavailable selected model is rejected rather than silently replaced by a plan default. No-tuple creation clients retain existing defaults; DM/group/channel creation cannot provide the new AI tuple. Malformed, mismatched, unknown or retired creation receipts retain the draft and creation hold, without a replacement creation or blind retry. Creation POST checks the captured actor/generation after awaited credential preparation and before its single HTTP dispatch;401 or challenge responses are not replayed. Ordinary follow-up sends only read and validate stored settings; they never PATCH them. The optional creation tuple requires the atomic database migration before activation; a route-only rollout cannot acknowledge an old RPC response missing that tuple. Regression coverage includes assistant_first_create_v100_test.dart, the actual creation route’s initial-settings.test.ts, and chat-initial-ai-settings.sql. Route/page fixtures do not certify migration execution; isolated SQL qualification and exact-commit CI remain delivery gates. Empty-state Send starts native creation immediately, without the follow-up message queue’s 220 ms debounce. The repository returns AssistantCreatedChat only after saving the acknowledged conversation selection and clearing its creation hold. The Cubit can then start the reply without writing the same selection again. Cached/history records do not carry this process-local result; other creation adapters retain their selection-write check. A retired actor, workspace or send generation still cannot dispatch after a late creation receipt. Attachment-driven creation keeps its existing explicit creation path. Regression coverage: assistant_first_send_pipeline_test.dart and assistant_created_chat_test.dart, alongside the existing creation/reset and native dispatch tests. The native server loads settings and authorized history concurrently. It always loads history, including for the first message, so replay detection and prior attachment context remain authoritative. Mira’s SDK tool catalog makes get_my_tasks and get_day_overview available immediately when present and authorized. Other capabilities remain deferred behind search_tools; its results activate tools without a separate select_tools model step. Short conversational replies may stream text directly. Forced-tool policies, loop limits, workspace checks, execution guards and write approvals still apply. This policy applies to the shared Mira SDK route; it changes neither chat creation transactions nor credit/model admission. native-ai-first-token.test.ts checks overlapping reads through the native POST. native-ai-ttft.test.ts measures POST entry to the first NDJSON text delta with the real SDK tool loop and deterministic fixture delays (settings 80 ms, history 120 ms, shadow upsert 20 ms, each model step 200 ms). Five runs per source version must finish with a saved assistant receipt and the expected task read count. This isolates scheduling and discovery overhead; authentication, database/provider networks, model decisions and device rendering are fixtures, so the numbers are not production or device latency guarantees. The strict saved-message and request-identity checks remain in force. Legacy prefixed AI conversations cannot provide this complete stored-settings receipt, so this control denies their stored model/credit edits before PATCH; their AI SDK SSE protocol remains supported. A legacy turn binds a top-level persistenceRequestId to its original user request. Authenticated owner-filtered history readback must confirm one durable USER row with that request identity, source and original submitted text before the composer clears. The AI route saves that request-scoped USER row before claiming the persistence lease, including on a first turn whose history holds only that message; only unscoped first turns rely on chat creation having saved them (packages/ai/src/chat/google/request-scoped-first-turn.test.ts). The server derives requestText metadata from the normalized UI input, separately from prepared attachment content; rendered file/image markers in stored content are not stripped or guessed by the client. Historical text-only receipts without that metadata retain exact-content checks. Text, stream completion and [DONE] are not receipts. An unknown result keeps the draft and attachments; an explicit repeat retains the original identity and checks durable history before another dispatch. A confirmed USER receipt precedes any reply failure: the composer consumes the saved draft while the model/transport failure remains visible. One deferred stream error is retained while checking the receipt. Existing server request leases and request-scoped user persistence provide idempotency. No automatic retry or new identity is used for an unknown turn. Local on-device conversations and explicit Live sessions retain their separate flows. Regression coverage: assistant_repair_regression_test.dart, assistant_settings_selection_test.dart, assistant_settings_receipt_test.dart, api_client_acknowledged_patch_test.dart, assistant_restore_send_v87_test.dart, and assistant_creation_admission_v87_test.dart cover actual page hooks and first Send, raw receipt mismatches, permission/uncertainty, overlapping choices, actor/workspace/chat ABA, disposal, and one-dispatch HTTP admission. These use synthetic auth and HTTP dependencies; hosted permission behavior, provider/device sessions and the original Hive incident remain separate delivery evidence.

Handled Assistant operational failures

Mobile Mira reports active handled failures through an injectable typed boundary. The phases distinguish server conversation creation (assistantCreate), local conversation-pointer persistence (assistantPreferencePersist), and reply transport or protocol failure (assistantReply). A protocol error contains no trusted persistence classification, so its text never determines a save-failure code or a customer root-cause claim. Successful durable completion is not an incident. Superseded operations, stopped streams, workspace ABA and session invalidation are excluded. By default, the production flavor sends a nonfatal Crashlytics event containing fixed phase/failure codes, valid HTTP status when available, a Retry-After bucket, and bounded numeric app version/build. It sends no original exception, captured stack, chat content, personality, memory, email, token, URL or request body. The SDK receives a fixed synthetic frame and event-local information, rather than persistent custom keys. No correlation ID is included because these call sites have no independently trusted opaque request ID. Global fatal hooks remain a separate path and retain their existing stack behavior. Repeated signatures are suppressed for five minutes with a 128-entry cache that prunes expired entries and evicts the oldest at capacity. This is best-effort bounded reporting, not a per-occurrence alert, event queue or autonomous repair bridge. Sink failures never delay chat state or retries. Development collection stays disabled. Provider retention/consent and authenticated device ingestion must be verified separately before release; this client path adds no private feedback storage or staff access. Regression coverage includes assistant_chat_operational_reporting_test.dart, assistant_chat_transport_terminal_test.dart and operational_error_reporter_test.dart. These exercise actual native NDJSON and legacy SSE adapters, separate creation/local persistence/transport failures, privacy, cancellation and sink isolation. They do not prove a customer incident’s cause or native Crashlytics delivery.

Assistant conversation persistence

Mobile Assistant uses an explicitly acknowledged native Chat creation response. Offline placeholders remain available to ordinary Chat consumers, but cannot become an Assistant conversation identity. Attachment preparation and a queued send share one creation acknowledgment for the same actor, workspace and fallback generation. The repository retains one instance-local result for that current generation. An uncertain failed result retains the existing creation hold. Upload and send use the same validated durable conversation ID. Cancellation settles the send without dropping a still-current attachment creation. Workspace loading, actor lifecycle through workspace loading or closure, and a confirmed explicit reset invalidate this generation monotonically. A raw actor getter changing away and back without any lifecycle signal is not observable; callers must use these lifecycle boundaries. A stale acknowledged result cannot qualify a later generation. Opening a different conversation also invalidates pending creation before changing selection. Creation publication and ordinary selection writes share one actor/workspace preference lock. An already-admitted old write drains before the current selection is durably written; stale callbacks cannot change the newly selected history or start an old attachment upload. The native creation API validates its committed receipt before returning it. A later realtime publication failure does not change that known receipt into a failed creation response. Bare conversation UUIDs select native Chat storage. ai-chat- and legacy-ai- prefixes select existing AI storage. Native permission or availability failures never switch stores. Restore failures preserve the selected conversation and its history. Only an authoritative missing response for an explicitly selected legacy conversation may remove that selection. Ambiguous historical bare UUIDs remain selected with an error rather than being silently rewritten. Native sends read authorized stored AI settings. They do not PATCH persistent settings merely to send a message. The native message endpoint has no per-turn model, credit, or thinking override; an unsupported selection produces an error. manage_chat permissions remain required for editing stored settings. Saved user receipts retain the original client request ID alongside the server message ID. Restore and retry preserve that original identity. Changed payloads remain subject to the server’s idempotency conflict checks. Attachment ownership and saved assistant receipts retain the existing stream completion behavior. The native composer helper waits for submitAcknowledged, which distinguishes acknowledged, denied, unknown, and stale outcomes. Only a matching validated saved user receipt for the original request can consume the current draft. Starting a stream or receiving an assistant reply is insufficient. Composer attachments remain until that acknowledgment and are cleared only if their snapshot is still current. A later model failure preserves the known saved user and its retry ID. Identical follow-up text uses a new request identity; explicit retries retain the original one. Queue discard and stale transport completion settle waiting callers without a new request or retry timer. A validated saved user acknowledgment returns independently of observer cleanup. Cleanup remains owned and drained; a delayed or failing cancellation cannot replace that receipt or settle a newer request. Selecting another chat retires only the stale request’s still-owned queued entry before its debounce can send; drafts and attachments remain available, and a later send requires its own matching USER receipt. Default stop and explicit supersession settle only the queued or active request they cancel. A canceled attempt retains its draft and attachments; idle status is never an acknowledgment. Pre-stream failures, including decoder errors, settle the owning request without bypassing uncertainty holds. For an unresolved native request, ordinary repeated Send reads the original saved USER receipt through the authorized messages endpoint; it does not issue another POST or allocate a new request identity. The pending turn retains immutable text, attachments and actor/workspace/chat identity for the current Assistant session, including selection retirement during settings preparation. Known pre-dispatch preparation failures release that tentative hold. Changed draft or attachments remain held until that original turn is resolved. Missing, denied or malformed readback remains unknown; no timer retries generation. A stale actor/selection generation cannot consume the current draft. A validated original USER receipt resolves persistence even if the model failed afterward; it does not claim an assistant response succeeded. Once acknowledged, an equal-text follow-up is a new turn. Explicit model Retry keeps its existing request identity. The active creation and native message API boundaries validate PostgreSQL receipt timestamps and return UTC ISO text before strict mobile decoding. SQL space separators, microseconds and numeric offsets normalize without dropping fractional precision; invalid calendars, offsets or fractions fail closed after persistence. This response adaptation does not change global SQL serializers or prove migration execution. Regression fixtures cover SQL-shaped creation with and without an initial tuple, native JSON/NDJSON/history receipts, invalid dates and retained-draft identity in assistant_native_identity_v108_test.dart and the active route tests. Native stream and JSON receipts validate raw UUIDs, canonical message kinds, string content, explicit ISO timestamps and metadata before generic model coercion. User receipts also require the original request UUID. Malformed batch rows reject the batch instead of disappearing during filtering. Ordinary Chat parsing retains its existing compatibility behavior. Assistant snapshots capture the injected actor, workspace, conversation, locale, lifecycle epoch and cache revision before awaiting storage. Reads check that origin before and after storage/network work; writes pass its revision and scope fence to the existing cache store. A changed scope or revision cancels an obsolete snapshot without moving it to another actor or retrying it. Completion snapshots are immutable, tracked and serialized per key; identical protocol/transport completion requests share one publication. A completed failed or cancelled result is evicted so a later explicit request can publish the same snapshot after recovery; this schedules no automatic retry. Pending requests and published results still coalesce. Same-scope supersession skips work before admission; an admitted authorized write and its rollback finish before the successor. Local queue order cannot revoke rollback authority. If the successor fails, the last authorized snapshot survives. Close invalidates their leases and drains owned work. Cache cancellation does not undo a validated USER receipt. Genuine storage failures retain the prior authorized snapshot and produce safe diagnostics; valid network history remains usable. Explicit restore observes all thrown failures and retains selected history on failure. Real disposable encrypted-store controls cover held publication, latest reopen, storage faults, scope departure, clear, held reads and close drain. Synthetic transport in those tests does not prove live authentication, provider behavior or a device session. Provider-free contract fixtures exercise creation, two sends, reopening after each send, and retry after reopening. They also cover malformed IDs, workspace mismatches, pending creation rows, denied or unavailable restore, and interrupted creation. These checks prove source contracts with synthetic dependencies; they do not prove provider calls or an authenticated device session. Mobile Assistant stores the selected chat, workspace context, and creation hold in one private versioned actor/workspace envelope. Every owning reader and writer uses the same scope lock and reloads the host value. Legacy selected/context keys are read-only fallback only when the envelope is absent. Loading a workspace with no envelope and no unresolved legacy creation marker writes one clear envelope that keeps the legacy selection and context; an unresolved marker keeps the scope held. Malformed or unsupported records require inspection and cannot be overwritten or replaced by legacy fallback. The envelope contains IDs, status, revisions, and reset evidence, with no prompts, attachments, or credentials. Native reset prepares a pure, current shell capability before making any effect. An acknowledged pending intent first retains the selected/context beforeimage and holds creation. Only its known current receipt permits a second whole-tuple write that selects no chat, selects personal context, advances the generation, records the creation hold as clear, and binds informed consent to that operation and prior hold. Pending intent on restart stays held and retains the beforeimage; it is never finalized automatically. A known current final receipt publishes the prepared shell/chat reset synchronously. Loading a workspace reads its stored context without writing it back, preserving pending reset beforeimages and known process consent. Other model and credit normalization remains separate from this context read. Postcommit notifications are observed and cannot veto a known commit. resetConversationAcknowledged reports deniedBeforeEffect, committedCurrent, committedStale, or uncertain. The compatibility Future<bool> is true only for committedCurrent. False, thrown, or stale host writes can have physical effects; callers must retain drafts/history and show honest uncertainty rather than promise that persistence stayed unchanged. An absent prepared adapter denies before effect. The former effectful guarded callback cannot qualify this protocol. The owning page now prepares the pure shell capability and consumes the typed outcome. An uncertain or absent creation envelope offers localized Cancel, Check history, and Start a new chat choices. The non-blocking “Your last chat may not have been saved” banner is narrower: it appears only for a recorded first-send attempt that never received its creation receipt (or an unresolved legacy creation marker), and only while no other chat is open. Dismissing it hides that attempt’s banner for the app session; Start a new chat or a confirmed creation resolves it. A fresh scope, a committed reset, a confirmed first send, and read or migration holds never show it (assistant_new_chat_reset_test.dart, assistant_fresh_scope_test.dart). Consent is an opaque, one-use process capability bound to the observed actor, workspace, selection, context, and hold beforeimage; a changed hold or an observed departure cannot reuse it. Cancel, denial, stale completion, and uncertainty retain the current draft and attachments. Only a current committed reset clears its still-owned draft. History stays open until that reset completes; Live cleanup failures remain explicit after a known reset. These defaults apply to remote Assistant Chat; local conversations retain their separate reset flow. Regression coverage is in assistant_new_chat_reset_test.dart, assistant_new_chat_confirmation_test.dart, and assistant_reset_consent_target_test.dart; device/provider behavior remains a separate delivery gate. Attachments follow the same recovery as a text send. While a new chat’s creation outcome is uncertain, the microphone, Files, Photos & Videos Library and Capture & Record (photo, video, audio) first offer the same Start a new chat choice and do not record, pick or upload anything until that reset commits; Cancel keeps the draft and attachments. The remote-chat check runs before this prompt, so the local-model lane never reaches it. Recording or picking continues after a committed reset. An upload that still meets a held creation fails with the non-retryable newChatRequired reason: its preview says to start a new chat first and shows no Retry. Regression coverage is in test/features/assistant/view/assistant_send_recovery_test.dart (microphone and Files gates, recording after the reset) and test/features/assistant/cubit/assistant_chat_attachment_upload_test.dart (newChatRequired for held and selected-chat creation). A known selected chat denies new creation before any hold write or POST; its clear status remains truthful and its history remains usable. Empty selection is required independently of clear status or informed consent. A committed informed reset resolves the prior attempt, so restart, lifecycle departure, or a later selected/context write never raises the hold again. A stored hold that records no attempt, no pending intent and no unresolved legacy marker carries no evidence of a sent request; loading the workspace releases it. Close entry fences reset immediately, before waiting for stream cancellation. Creation rechecks its captured origin after host acknowledgement and immediately before transport admission. Beginning creation consumes it and writes the next unknown attempt before HTTP. A validated server acknowledgment writes the durable selected ID and clear status together; only the exact verified pre-effect coded validation denial may release a failed attempt. Timeouts, transport errors, server failures, and uncoded rate limits hold creation with no automatic retry or replacement UUID. Known-history follow-up remains available. This is one-key logical tuple atomicity with a process scope lock, not multiprocess CAS or a physical disk guarantee. If intent storage is unavailable, no durable hold can be promised and no other reset/create effect proceeds. Regression coverage: assistant_shell_recovery_test.dart, assistant_reset_commit_test.dart, assistant_chat_reset_order_test.dart, assistant_chat_reset_close_test.dart, assistant_chat_persistence_contract_test.dart, assistant_creation_marker_test.dart, assistant_chat_persistence_test.dart, assistant_chat_submission_ack_test.dart, assistant_chat_cache_publication_test.dart, assistant_chat_cache_lifecycle_test.dart, assistant_chat_creation_interleave_test.dart, assistant_chat_creation_selection_test.dart, chat_creation_receipt_test.dart, and the existing Assistant restore and transport completion tests in apps/mobile/test/features/assistant and apps/mobile/test/features/chat. Stream fixture diagnostics record mock entry, response readiness, body listening and cancellation separately. Delivery deadlines begin after bounded readiness; primary phase failures retain their error and stack when cleanup also fails. Synthetic held-mock controls exercise the never-listened body path. These controls do not identify an earlier incident’s blocked await without its readiness evidence.

First remote Assistant message

For an empty remote Assistant chat with captured initial settings and no attachments, mobile sends its fallback conversation UUID and the original user request key directly to the native message stream. The server validates the actor, workspace membership and selected model/credit source, then creates the conversation and deduplicated user message in one database transaction. Creation replays must match the original actor, workspace, AI type and initial settings. Later settings edits do not change that immutable creation snapshot. Deletion retains a minimal identity tombstone until account/workspace erasure so an old request cannot recreate a deleted conversation. The x-mira-chat-creation response header contains a bounded, encoded creation receipt. Mobile validates its identity/settings and durably selects the chat before consuming message receipts. Losing this acknowledgement retains the creation hold; it never causes a fresh key or replacement UUID to be sent. Leaving the scope before creation acknowledgement does not wait for the pending HTTP response. That bounded operation remains observed with a permanent origin fence, so a late receipt cannot select a chat or publish messages. Cancellation after creation acknowledgement keeps the existing stream cleanup semantics. Conversation/message realtime publication runs alongside generation inside the request lifecycle. A replay suppresses duplicate creation announcements and recipient notifications; supplementary delivery failure cannot invalidate a committed creation acknowledgement. Attachment-first sends and adapters without a captured settings plan retain the separate creation path. Live keeps its existing transport and turn fences. Coverage: first-ai-message.test.ts, chat-first-message-creation.sql, the independent-connection race in chat-first-message-concurrency.mjs, and assistant_first_message_test.dart / assistant_first_send_pipeline_test.dart. Run the isolated database verifier from the repository root with node apps/database/scripts/verify-chat-first-message.mjs on an admitted host with Docker. It resets an owned disposable full-chain database, applies the new migration locally, runs the security/creation tests and observed-lock race, generates only the migration’s database type delta, and stops its own project. It never targets a linked database.

First-message migration rollback

The manual rollback for 20261029100000_chat_first_message_creation_receipts restores main’s prior private.chat_create_conversation definition and its service-role-only execution grant, then removes the two new receipt functions and the receipt table. Existing conversations and messages remain. Creation receipts prevent old retries from recreating deleted conversations. The rollback refuses a nonempty receipt table because discarding those identities cannot be safely reversed. Preserve and verify recovery data before a separately authorized restore or disposal procedure. On an isolated database reset to main, run:
These tests apply the actual migration, execute its rollback, compare the restored function definition, owner, settings and ACL with main, assert client execution denial and receipt-table absence, then re-apply it. A retained-receipt control requires explicit failure without losing the identity.

Optional offline preparation

Mobile Chat preparation requires mobile_offline and offline_read_chat (default off). It retains the first 40 active conversations and the latest 60 messages for up to 10 conversations, with a 2 MiB JSON payload cap per run. It uses bounded first pages without older pages or attachment bodies. The existing account/workspace encrypted read-through cache opens these snapshots; Offline settings displays preparation status and last successful sync. Disabling the flag removes preparation registration and preserves existing Chat reads. Sending is unchanged. Mira history preparation remains deferred. Regression coverage: test/features/chat/chat_offline_preparation_test.dart. Mobile Mira offline preparation is opt-in behind both offline flags, which default off. It retains a bounded native conversation page and recent messages/settings for the current account and workspace. Preparation preserves cached chats and cursors outside that bounded download; access-denial and account fences still apply. Native restores await authorization refresh; definitive denial invalidates raw and derived snapshots, while transport loss can use prepared data. Connected legacy-only history is read without caching it; legacy remains unavailable offline. The cold-reader regression is covered by mira_offline_preparation_test.dart.