[Bug]: Mobile new-task draft is saved under Unsent but not resumed when navigating away#15974
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/mobile
Steps to reproduce
- On Android, tap + to start a new task (NewTaskSheet -> NewTask composer).
- Type prompt text but do not send.
- Press Android back / navigate away (dismisses the sheet via
closeNewTask -> parentNavigation.goBack()). - Tap + again to start a new task.
- Check the thread list Unsent section.
Expected behavior
Returning resumes the same draft in the composer (like web, which reuses/resumes the per-project draft via stable DraftId). At minimum, navigating away should flush the pending draft write so nothing is lost.
Actual behavior
Update 2026-10-05: field screenshot confirms the typed text IS saved — it appears under the thread list Unsent section as a Draft row (e.g. "sync with upstream. on mobile"). So the original "not saved as draft" report was imprecise.
The remaining gap is resume, not persistence: the composer binding (activeDraftKey provider-local useState) is lost on sheet unmount, and re-entry always mints a fresh draft ("A fresh New Task never reuses one"), so the composer opens empty and the user must find and reopen the Unsent draft row manually. Secondary edge: dirty text does not guard back navigation, and there is no flushComposerDrafts() on sheet dismiss, so typing + backing out within the 200ms persist debounce can still lose the disk write.
Code pointers (main @ cf3e714b0f):
apps/mobile/src/features/threads/new-task-flow-provider.tsx:291(activeDraftKeyprovider-local state, lost on unmount),:466-476(fresh draft mint),:589(never reuses),:651-658(setPrompt -> setComposerDraftText),:753-763(in-flow retarget is fine)apps/mobile/src/features/threads/NewTaskDraftScreen.tsx:1412-1459(composer),:514-518(usePreventRemoveonly while submitting/transferring, not dirty text),:1463-1471(close/goBack)apps/mobile/src/state/use-composer-drafts.ts:66,1000-1025(200ms debounced persist),:777-807(flushComposerDraftsnever called on dismiss/unmount)- Web contrast:
apps/web/src/composerDraftStore.ts:89,97-115,132-137(localStorage + debounce + beforeunload flush),threadRoutes.ts:83+hooks/useHandleNewThread.ts:164-195(stable DraftId resume)
Impact
Minor bug or occasional failure
Version or commit
main @ cf3e714b0f
Environment
Android (mobile app), reported from field testing
Logs or stack traces
None - text is preserved under Unsent but not resumed; no error.
Workaround
Reopen the saved draft via its Unsent Draft row (usePendingTaskListActions.ts:16-30 -> NewTaskDraft -> { draftId }).