mattermost-mobile-upstream/app/products/agents
Nick Misasi 344062a19d
[MM-68856] Respect default agent and persist last-selected agent in agent selectors (#9829)
* [MM-68856] Respect default agent and persist last-selected agent in agent selectors

Mobile agent selectors always defaulted to the first agent and did not
remember the user's previous choice, ignoring the system-wide default
agent configured on the server.

Selectors now resolve the active agent with the precedence
saved-preference -> system default (is_default) -> first, and persist
explicit selections via the shared `agents/selected_agent` core
preference so the choice restores across surfaces and clients.

Applied to the rewrite options, channel summary, and agent chat
selectors. Part of a coordinated 3-repo change (webapp,
mattermost-plugin-agents, mobile) sharing the same preference contract.

Co-authored-by: Cursor <cursoragent@cursor.com>

* [MM-68856] Address review feedback on agent selector

- await savePreference in saveSelectedAgent so its errors stay inside the
  try/catch and callers get a consistent {error} result.
- Surface persistence failures from the resolved {error} on all three
  selector surfaces (agent chat, channel summary, rewrite options) via
  logError instead of dropping them silently.
- Rename agent selection tests to the `should...` convention.

Co-authored-by: Cursor <cursoragent@cursor.com>

* [MM-68856] Address review feedback on agent selector structure

Split channel summary and rewrite options HOCs into index files, switch
persist calls to async/await, and cover non-empty selectedAgentId on mount.

Co-authored-by: Cursor <cursoragent@cursor.com>

* [MM-68856] Log agent selection failures with getFullErrorMessage

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 20:13:11 -04:00
..
actions [MM-68856] Respect default agent and persist last-selected agent in agent selectors (#9829) 2026-07-16 20:13:11 -04:00
client Add conversation-entity support for plugin-agents v2.0 (#9704) 2026-05-25 07:20:07 -07:00
components [MM-68856] Respect default agent and persist last-selected agent in agent selectors (#9829) 2026-07-16 20:13:11 -04:00
constants Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
database Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
hooks Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
queries [MM-68856] Respect default agent and persist last-selected agent in agent selectors (#9829) 2026-07-16 20:13:11 -04:00
screens [MM-68856] Respect default agent and persist last-selected agent in agent selectors (#9829) 2026-07-16 20:13:11 -04:00
store Add conversation-entity support for plugin-agents v2.0 (#9704) 2026-05-25 07:20:07 -07:00
types [MM-68856] Respect default agent and persist last-selected agent in agent selectors (#9829) 2026-07-16 20:13:11 -04:00
constants.ts Add two-phase tool call approval for agents in channels (#9506) 2026-02-19 11:20:25 -05:00
requester.test.ts Add conversation-entity support for plugin-agents v2.0 (#9704) 2026-05-25 07:20:07 -07:00
requester.ts Add conversation-entity support for plugin-agents v2.0 (#9704) 2026-05-25 07:20:07 -07:00
turn_content.test.ts Add conversation-entity support for plugin-agents v2.0 (#9704) 2026-05-25 07:20:07 -07:00
turn_content.ts Add conversation-entity support for plugin-agents v2.0 (#9704) 2026-05-25 07:20:07 -07:00
utils.test.ts [MM-68856] Respect default agent and persist last-selected agent in agent selectors (#9829) 2026-07-16 20:13:11 -04:00
utils.ts [MM-68856] Respect default agent and persist last-selected agent in agent selectors (#9829) 2026-07-16 20:13:11 -04:00