Repository navigation
feat(app): chat history, new chats and greeting for Ask Omi on mobile - #19838
Conversation
|
@Git-on-my-level could you take a look when you have a moment? This adds past chats, new chats and pull-to-close on top of your Ask Omi sheet from #19730, using the existing chat-session endpoints (no backend changes). Could you also add |
|
Thanks @Itaxh1 — this is a substantial, well-structured contribution. I reviewed the full non-generated diff (33 files; the other ~99 are generated localization for the 17 new product strings across 49 locales) and verified the client against the backend contract on What I verified
Two product decisions I'd like a maintainer to sign off on (code quality is not in question):
Minor, non-blocking: page sizes (50 sessions / 100 messages) are hardcoded in both Also noting for the record: most CI suites are skipped on this fork PR, so the verification numbers in the description (3,605 tests, 23 journeys) are self-reported — the diff's own test infrastructure is consistent with them, but they haven't run on repo CI. Leaving for human maintainer review on the two product questions above; no code changes requested. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Product sign-off from David (via maintainer channel) on the two questions raised in the review above:
Verification status on head
Merging on green per maintainer instruction (admin merge — the review requirement is satisfied by the review thread above plus this sign-off). The hardcoded page-size nit (50/100) stays open as accepted follow-up, not a merge blocker. |
|
Merged as squash commit
Accepted follow-ups: shared page-size constants (50/100); rename/search/pin (#7152 remainder) and chat sharing (#4483) remain open feature work. |
The chat-history feature (BasedHardware#19838) added a hand-written Dart REST DTO for `/v2/chat-sessions`, but that route was never on the app-client surface, so the schema single-source gate reports one remaining manual Dart JSON schema file and `test_app_client_schema_inventory.py` fails for every PR that selects the full backend unit suite. Add the chat-session routes to the app-client contract, generate `gen/chat_sessions_wire.g.dart` from the committed spec, and rebuild `ChatSessionSummary` as an adapter over the generated wire DTO so a field the source gains can no longer be dropped in silence. Decode behavior is unchanged: the wire decoder owns typing/required fields and the adapter still fills the fields a partial producer omits. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <[email protected]>
The chat-history feature (BasedHardware#19838) added a hand-written Dart REST DTO for `/v2/chat-sessions`, but that route was never on the app-client surface, so the schema single-source gate reports one remaining manual Dart JSON schema file and `test_app_client_schema_inventory.py` fails for every PR that selects the full backend unit suite. Add the chat-session routes to the app-client contract, generate `gen/chat_sessions_wire.g.dart` from the committed spec, and rebuild `ChatSessionSummary` as an adapter over the generated wire DTO so a field the source gains can no longer be dropped in silence. Decode behavior is unchanged: the wire decoder owns typing/required fields and the adapter still fills the fields a partial producer omits. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <[email protected]>
#19838 added ChatSessionSummary with a hand-written fromJson, which the app-client schema inventory counts as a remaining manual DTO; main has failed test_app_client_schema_inventory since (latent: that PR touched no backend path, so the backend shard never ran). - /v2/chat-sessions joins the app-client OpenAPI export; the spec and the Swift/TS generated clients are regenerated. - New chat_sessions generator group -> chat_sessions_wire.g.dart (GeneratedChatSessionResponse). - ChatSessionSummary.fromJson now decodes through the generated type, keeping the old tolerance: updated_at falls back to created_at, a mistyped/missing title or preview reads empty, a missing count 0, a missing star unstarred; an id and one parseable timestamp stay required; times are shown in local time. The new tests pass against both the old decoder and the new one. Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed and why
Ask Omi on mobile keeps one running thread, so every question lands in the same conversation. This adds chat
history to the Ask Omi sheet from #19730, and nothing else. It is based on
main(ab28037f64) and uses thechat-session endpoints the backend already serves, so there are no backend changes and no data migration.
Closes #19840. Refs #7152 (new chats, past chats, reopening one with its own context, automatic titles and
delete). Not addressed: rename, search and pinning from #7152, and sharing chats (#4483).
chatdeep links, the conversation page's Ask Omi buttonApp side.
ChatSessionsApi(backend/http/api/chat_sessions.dart) wraps/v2/chat-sessions,/v2/messages?chat_session_id=and/v2/chat/generate-titlewith typedApiResults.ChatHistoryState, a mixinon
MessageProvider, owns the selected thread. A fresh chat creates its session once, on the first question, thensends with that explicit ID. If creation fails, the reply shows Retry and never falls back to the server's current
thread. A history read replaces the thread only after it succeeds and carries a revision, so a slow read cannot
overwrite a newer choice. Switching is blocked while a message sends, during voice work, uploads or a delete, and
text typed during a load is kept. Titles come from the title endpoint after the first completed reply. Clear Chat on
a saved chat clears only that chat. A pendant voice reply never lands in a past chat being viewed.
Presentation side.
ChatEntranceruns one 1.1 s timeline (greeting 0 ms, count 120 ms, composer 150 ms,suggestions 350 ms, question 500 ms) that streaming, focus changes and rebuilds never replay. The count uses the
conversations already loaded in
ConversationProvider(not discarded, local day), so it adds no request. The draglives in upstream's
ChatSheetRoute: past 22 % of the screen, or a downward flick of at least 32 pt at 900 pt/s,closes it; transcript scrolling never does. Reduce Motion shows everything in its final state and stops the typing
dots.
pages/chat/README.mddocuments the thread, draft and motion rules and the test map.The microphone (Stop, transcribe, edit, Send, Discard), attachments, citations, streaming and retry keep their
behavior. The 17 new strings are translated for all 49 languages through
app/scripts/l10n.py; generatedlocalization makes up 99 of the 132 changed files.
Screenshots
The empty Ask Omi chat on an iPhone 15 Pro Max, from a build of this branch: the greeting, today's conversation count, the question, the suggestion chips and the history button.
Product invariants affected
none
scripts/pr-preflight --suggestagainstmainreports no locked-invariant paths.INV-CHAT-1covers the desktopkernel transcript; this PR only uses the existing backend chat sessions from mobile.
How it was verified
bash app/test.sh: 3,605 passed, 5 skipped, 0 failed.make mobile-verify ARGS="fast --all": 23 of 23 hermetic journeys passed.bash app/scripts/analyze_ratchet.sh: passed.python3 app/scripts/l10n.py check: 49 locales, 3,491 keys.git diff --check: clean.scripts/pr-preflight --base upstream/main --pr-body-file: all 23 selected manifest checks passed.flutter build ios --config-only --profile --flavor prod, thenxcodebuild), installed clean and used against the production API. It was signed under apersonal preview bundle id and App Group, a build-only change that is not in this PR.
chat-askscenario leaving the title request's HTTP timeout pendingwhen the widget tree was disposed. The scenario now settles until that request finishes and asserts it ran once.
All six chat scenarios pass three runs in a row.
Tests
test/providers/chat_history_state_test.dart(11) covers:test/widgets/chat_history_navigation_test.dart(13): the real ChatPage to Past chats and back, selection,failed reads, the draft kept during a pending read, starter editing, follow-up sends and header-only dismissal.
test/widgets/chat_presentation_test.dart(6): draft and focus across rebuilds, no replay, Reduce Motion includingthe typing dots, and a small screen at large text.
test/backend/chat_sessions_api_test.dart(5): failed vs. empty history, malformed rows, encoded session targeting,pagination and delete failures.
test/widgets/chat_greeting_count_test.dart(4): text and stagger timing, the count-up, discarded and local-dayfiltering, Reduce Motion.
test/widgets/past_chats_page_test.dart(4): retry, selection, delete confirmation (Cancel keeps history) andpagination.
message_provider_voice_test.dartgains a case: a pendant voice reply stays out of a past chat being viewed.message_provider_failed_reply_test.dart,chat_content_block_test.dart,mobile_polish_test.dart, the chatvisual-audit scenarios and the journey fixture backend (session, history and title routes) are updated.
Failure class (fixes)
Failure-Class: none