Skip to content

feat(threads): persist and hand off drafts on mobile - #666

Merged
nixuuu merged 1 commit into
feat/thread-drafts-webfrom
feat/thread-drafts-mobile
Nov 14, 2026
Merged

nixuuu merged 1 commit into
feat/thread-drafts-webfrom
feat/thread-drafts-mobile

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Change

Mobile persists drafts in per-target Documents files scoped to pairing/certificate. Text, mentions, citations/notes, upload IDs/states and choices survive restart. Markers use memoized per-target subscriptions. The Drafts sheet supports append/replace with existing attachment IDs; one session cache/watch resumes from the gateway revision.

Send/create uses one RPC (2 → 1) without saving first. Navigation changes only the screen lifetime; it does not abort HTTP delivery. The captured persistent draft clears before stale-screen guards run. On reopen, read-only recovery checks the receipt and native admission. The unknown-send warning stays hidden during active sends/reconciliation and appears only for unresolved outcomes. Edit/Discard then recover explicitly. Definite rejection restores editing, including Edit from here / Swap drafts. Late save responses cannot resurrect sent/forked drafts.

Workspace tabs and visuals' thread view are retained after rebasing onto bcc07e0. BackgroundTasksChip keeps its offline/away disabled condition. Migration remains 0140, after visuals' 0139. Polish mobile docs cover persistence, handoff and recovery. No native dependency/configuration changes.

Verification

  • Each layer passed install, gen:check, monorepo typecheck, lint, format:check and production web build with nice.
  • Current gateway /goal recovery follow-up passed draft integration 17/17, linked send 2/2, gateway/integration typechecks, lint and format:check with nice. Recovery now checks every native SendMessage receipt, including goals without turns/steers. Mobile sources are unchanged. Migration 1/1, schema 23/23 passed after rebase. The slow-link test verifies same-thread writes and the source receipt remain unblocked, with zero idle SQL transactions.
  • iOS and Android production exports passed with nice after rebase. Fingerprints match baseline: iOS 74705db3a68907bc28379bb9b1080a227bc0755b, Android 7d38be8f5c9bf842d62060c75820a206f99c87e3.
  • Before the final /goal follow-up, full check:tmp passed: 2959 pass, 175 skip, 0 fail, 561 files; private temp directory clean. Diagnostics boundary tests passed 7/7. The full suite was not repeated locally for the narrow follow-up.
  • CI and final re-check of the gateway follow-up are pending. The stack stays draft as requested.
  • Native device review pending: known MacStudio device-host failure. Exports/typecheck do not replace device interaction coverage.

Copy audit (docs/copy.md §8)

  • Draft uses the shared term and reserved width; empty markers are hidden from accessibility.
  • Handoff/recovery actions match web. The warning explains possible prior delivery without internal terms.
  • Before: in-flight sends showed a warning and recovery actions. After: both stay hidden until recovery finishes and delivery remains unknown.
  • Error/upload guidance remains actionable. Responsive web equivalents passed phone/dark review; native touch/layout review remains pending.

Part of stack 667, depends on #665. Do not merge separately.

@nixuuu
nixuuu force-pushed the feat/thread-drafts-mobile branch from 4693f4e to b10d1f8 Compare November 14, 2026 02:50
@nixuuu
nixuuu marked this pull request as ready for review November 14, 2026 03:01
@nixuuu
nixuuu merged commit 76b5561 into dev Nov 14, 2026
11 checks passed
@nixuuu
nixuuu deleted the feat/thread-drafts-mobile branch November 14, 2026 03:02
nixuuu added a commit that referenced this pull request Nov 14, 2026
## Change

Thread/new-thread/side-thread composers retain bounded local drafts,
including mentions, citations/notes, uploaded IDs and explicit choices.
Per-target storage/subscriptions preserve other tabs' drafts and avoid
rerendering every sidebar row. Markers reserve their width. Generic
snapshot/restore preserves Edit from here / Swap drafts and workspace
tabs.

Open drafts lists other-device prompts. Continue here appends without
re-uploading; replacement is explicit. One shared page cache and
resumable stream serve mounted composers. Stream failures back off from
2 to 60 seconds without re-listing on reconnect. Newer hints compare
gateway clocks. Source conflicts fork draft/send IDs while preserving
text.

Send/create uses **one RPC instead of Save + Send (2 → 1)**. Navigation
does not abort the send. Acknowledged sends clear their captured durable
state even after navigation. Reopened pending drafts query
GetComposerDraftDelivery before showing recovery; confirmed
receipts/native admission clear them without resending. The unknown-send
banner and Edit/Discard actions stay hidden while this client sends or
the gateway reports an active attempt. Definite rejection preserves
editable text; a truly unknown outcome exposes explicit recovery.

## Verification

- Production browser review after rebasing onto visuals bcc07e0:
desktop/light and 390px/dark. Holding HTTP200, switching threads and
releasing the response left the request un-aborted and removed its
persisted draft. Reopening showed an empty editable composer.
- Reloading a persisted pending request after admission made one
read-only recovery call and zero message calls. The draft cleared
without the unknown-send banner. An injected unknown network outcome
exposed Edit/Discard only after reconciliation; Edit preserved the
prompt and restored editing. Phone layout had no horizontal overflow.
- Current gateway /goal recovery follow-up passed drafts **17/17**,
slow/lost linked send **2/2**, gateway/integration typechecks, lint and
format:check with nice. Recovery now checks every native SendMessage
receipt, including goals without turns/steers. Web sources are
unchanged. Migration/schema **1/23** passed before this follow-up. Each
layer previously passed install, gen:check, full typecheck, lint,
format:check and web build with nice.
- Before the final /goal follow-up, full check:tmp passed: **2959 pass,
175 skip, 0 fail**, 561 files; private temp directory clean. Diagnostics
boundary tests passed **7/7**. The full suite was not repeated locally
for the narrow follow-up.
- CI and final re-check of the gateway follow-up are pending. The stack
stays draft as requested. Native device coverage is tracked in #666.

## Copy audit (docs/copy.md §8)

- Draft, Open drafts, Continue here and Replace local draft use shared
terminology. Markers reserve width and do not rely on colour.
- Before: the unknown-send warning appeared on ordinary sends. After: it
appears only after recovery establishes an unknown outcome, without an
extra row during normal sends.
- Edit draft / Discard draft describe recovery. The warning states
possible prior delivery and that editing starts a new message. No
protocol or revision terms appear in product copy.
- Short/typical/long text and actions were reviewed at desktop and phone
widths, light/dark. No UI tests added.

Part of **stack 667**, depends on #664. Rebased onto **bcc07e0db**;
migration 0140. Do not merge separately.
nixuuu added a commit that referenced this pull request Nov 24, 2026
)

## Summary

- Keep one new-thread draft across project and worker changes in web,
desktop, iOS, and Android. Reopening New thread restores the prompt.
- Recover the most recent draft saved under a workspace in an earlier
version. Keep any pending send bound to its original request.
- Bind new sends to the selected workspace and keep receipt retries tied
to the submitted request.

## Verification

- Browser with two projects and two workers. Verified project and worker
changes, leaving and returning, a reload, recovery of an earlier draft,
and delivery to the selected worker.
- 24 integration tests across composer drafts, linked delivery, and
sandbox draft selections.
- Web, mobile, and gateway type checks. Formatting and lint for edited
sources.
- Native iOS and Android runtime verification remains open.
Repository-wide checks run in CI.

## Copy audit

Added “Could not save this draft. Retry before sending.” for a recovered
draft whose updated target could not be saved. The message names the
failure and gives one recovery action.

Fixes: #665
Fixes: #666
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant