Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Restore compact New Harness options and immediate search input

deehw695d08433c11
diff --git a/docs/research/2026-09-28-mobile-ui-change-audit.md b/docs/research/2026-09-28-mobile-ui-change-audit.md
new file mode 100644
index 000000000..3b32a3a64
--- /dev/null
+++ b/docs/research/2026-09-28-mobile-ui-change-audit.md
@@ -0,0 +1,72 @@
+# Mobile changes for user review
+
+Audit window: September 27, 2026, 09:43–21:43 EDT. The installed build at the start of this review was **46**, from [PR #398](https://github.com/autonomous-ai/openharness/pull/398).
+
+This separates changes made during the overnight continuation from older work merged during the same twelve hours. [PR #387](https://github.com/autonomous-ai/openharness/pull/387) merged at 11:10 EDT but contains development from earlier days; its long squash message includes experiments subsequently reverted. Those intermediate experiments are not all present in build 46.
+
+## The four corrections requested after reviewing build 46
+
+| Area | Build 46 | Requested behavior |
+|---|---|---|
+| New Harness | Branch/worktree, approvals and profile shown directly | Agent and Project first; advanced rows under collapsed `Options [+]`, matching desktop |
+| Agent chooser | Claude Code/Codex first; other engines behind `more` | One complete scrollable list, most recently used engine choices first |
+| Project chooser | Search shown only for long lists; no automatic focus | Always show search and focus it when opened |
+| Find | Search waits for a field tap | Focus search on entry so typing works immediately |
+
+The four requested behaviors are implemented for local iPhone build **47**. Its validation passes 1,621 tests and 25 renders. This audit describes build 46 so the user can review the other decisions separately.
+
+Exposing advanced options came from the review panel. The `more` gate and unfocused Find predate this continuation; they were retained in the shipped build. The earlier explanation implying they were newly introduced here was inaccurate. Panel preferences do not supersede the user's specified interaction design.
+
+## Overnight UI/UX changes now in build 46
+
+The [comparison after PR #387](https://github.com/autonomous-ai/openharness/compare/244cfe71...e0daa25c) contains these changes and the reliability work.
+
+| Area | Change | Basis/status |
+|---|---|---|
+| New Harness options | Removed the `[+]` fold and exposed branch/worktree, approvals and Codex profile | Panel-driven; user has now requested reversal |
+| New Harness copy | Explained “a harness is one session of an agent”; command description became “Choose an agent and a project” | Teaching the retained term; wording introduced during review |
+| First-task suggestions | Limited suggested tasks to the first harness, instead of showing them on every New form | Review-driven reduction of repeated content |
+| New while typing | Compact summary puts project before engine; previously also included branch/worktree and approvals | Review-driven; advanced details removed from summary in the requested correction |
+| Settings | Renamed rows to “Phone name” and “App colors”; moved Usage, Computers and Phone name into account grouping; removed standalone Usage grouping | Review-driven; duplicate color/text-size controls remain pending a user decision |
+| Settings avatar | Replaced the conspicuous avatar treatment with a neutral one | Review-driven |
+| Terminal scrollback | Removed the numeric scroll-position tag | Explicit user decision |
+| Attention above mic | Hide while reading history; fixed left gutter, yellow dot and solid backing | Review-driven; mic placement and full-screen terminal preserved |
+| Focus “asking” | Rebuild the existing other-harness asking label when its state changes; retain tap to Find | Bug fix; retaining the label is an explicit user decision |
+| Key strip | Open at its own keys so `esc` does not scroll off-screen | Interaction bug fix |
+| Chooser sheets | Size to contents, align title with row gutter, use a drag handle and native drag dismissal | Review-driven |
+| Form rows and fields | Align labels with the first value line; strengthen placeholder contrast | Review-driven |
+| Harness menu | Color “Stop this harness…” red | Review-driven destructive-action styling |
+| Sign-in | Disable Sign in for incomplete codes | Review-driven form feedback |
+| Computer setup | Consolidated setup/download flows; signed-in setup watches for and pairs a computer | Review-driven flow change |
+| Unlock | Allow scanning another computer's Add Phone code; retain password fallback; clarify phone-password copy and the desktop menu path | Review-driven flow/copy change; menu wording checked against desktop |
+| Pairing copy | Explain end-to-end encryption on the scan page | Review-driven |
+| Sample discoverability | Visible entry on Welcome/setup; sample labels on pickup, Focus, Find and New; shorter input hint | Review-driven |
+| Sample behavior | Stop repeating the user's prompt; use realistic permission wording and friendlier computer naming | Review-driven demo changes |
+| Accessibility | Terminal output readable by VoiceOver; actions for Find/New; voice-cancel action, question announcement and live attention text | Accessibility fixes |
+| Small screens / large text | Fix title, sample end-card, welcome/pairing and New-form overflow; keep Start reachable over the keyboard | Layout fixes |
+| Reduced motion | Show the terminal attaching state with Reduce Motion enabled | Accessibility bug fix |
+| Branch/PR history | Retain main's current branch display and “Branches and pull requests” page | Integrated from [PR #397](https://github.com/autonomous-ai/openharness/pull/397), not a panel decision |
+
+## Older UI work merged within this window in PR #387
+
+These features were already in the app when the overnight continuation started:
+
+- Full-screen Focus; swipe right to Find and left to New; a title/actions menu instead of a bottom tab bar.
+- Terminal-styled typography, rows, menus and key strip; the mic floating over the terminal, voice auto-send and answer buttons beside it.
+- New's Agent/Project form, optional first-task field and Start button; project names identify their computer; defaults and drafts are remembered.
+- Find searches harnesses and conversation contents, supports desktop-style command/project/computer modes, and resumes external conversations; rows use conversation activity for ordering and stay stable while reading.
+- Onboarding, the pickup screen, setup/download choices, QR sign-in/pairing, written help and the “See how it works” video.
+- Offline sample with guided steps; notification permission deferred until a harness is on screen.
+- Terminal selection/copy, paste, links, interrupt controls, question handling, and recently viewed terminal snapshots.
+
+## Non-UI work
+
+- Fixed 41 documented bugs, including auth refresh/sign-out races, pairing hangs, replay/rekey handling, reconnects, terminal stream state, logging and analytics lifecycle errors, and branch-history request encryption.
+- Removed unreachable desktop screens, window/grid controls, local CLI provisioning/supervision/sign-in, plaintext local transport and other dead code. The app remains a viewer onto computers.
+- Expanded offline regression coverage to 1,614 passing tests and 88.7% line coverage excluding third-party code; checked 25 renders and a sample simulator tour. Tests use isolated storage and block real HTTP access.
+
+The AI panel's 8+/10 scores describe its assessment of rendered/sample artifacts. They are not user approval of the design choices above.
+
+## Preserved decisions / still pending
+
+Voice auto-send, mic location, full-screen terminal, the word “harness”, removal of the scroll tag and retention of the asking label remain the user's decisions. Push notifications, Dynamic Type, a one-line Focus header, duplicate settings and the other proposals in the [handoff](2026-09-28-phone-overnight.md) remain unapproved and were not implemented.
diff --git a/docs/research/2026-09-28-phone-overnight.md b/docs/research/2026-09-28-phone-overnight.md
index b8413c6f6..8e750fd39 100644
--- a/docs/research/2026-09-28-phone-overnight.md
+++ b/docs/research/2026-09-28-phone-overnight.md
@@ -77,7 +77,7 @@ Five personas each reviewed renders of every phone screen. In round 2 they also
- **VoiceOver:** it can cancel a voice take, hears "Asking: …" when a question opens, and reads the line above the mic as a live region.
- **Copy:** "5 harnesses", "Leave the sample" (both places), "Choose an agent and a project".
- **The scan page** says the link is end-to-end encrypted, which was the first-time user's trust gap.
-- **New** shows branch, approvals and profile all the time. The `[+]` toggle is gone; it hid the two things worth checking before a harness starts, over an empty half-screen.
+- **New:** the panel-driven pass exposed branch, approvals and profile. **The user rejected this in the build-46 review:** restore collapsed `Options [+]`, matching desktop. This is a user decision, not an open design proposal.
- **Settings:** Usage, Computers and Phone name join the account group. There is no lone Usage card, and Phone name is no longer filed under *terminal*.
- **"Stop this harness…"** stays small at the foot of the menu but is now red; faint grey read as disabled.
- **Form rows** put the label on the value's first line; "approvals" used to sit beside its note.
@@ -156,12 +156,16 @@ These are AI persona reviews of offline artifacts. They establish the visual sco
- The mic stays where it is; the terminal is full screen under it.
- Keep the word "harness" (harness = session; one agent, many harnesses). Teaching it is fine; renaming it is not.
- No scroll-position indicator. The "api-fix asking" label stays.
+- New Harness keeps branch/worktree, approvals and profile under collapsed `Options [+]`. Default creation must not ask users to revisit these settings.
+- The Agent chooser shows the full scrollable list, with recently used engine choices first; no `more` gate.
+- Opening the Project chooser focuses its always-visible search field; opening Find focuses its search field too.
- PRs only. The user merges and releases; nothing is merged or released without their explicit word.
## Handoff for the mobile team
### State
+- The user's build-46 review and a [twelve-hour change audit](2026-09-28-mobile-ui-change-audit.md) record the four corrections above, implemented for local iPhone build **47**. They supersede conflicting panel recommendations. Follow-up validation: **1,621 tests** and **25 renders** pass; analyzer clean outside the same 12 third-party informational findings. The coverage figures above were measured on build 46. The user requested an iPhone install only, not TestFlight.
- Branch `phone-overnight-polish`; [PR #398](https://github.com/autonomous-ai/openharness/pull/398) contains the continuation and main integration. The user explicitly authorized merging and a local iPhone install for manual review. Check the PR for the resulting merge commit; no store release was requested.
- Merged into it and finished: `coverage-rest` (coverage engineer), `desktop-cut` (the desktop's half of the notifier), and the phone-screens and state-core engineers' passes. No engineer is still running.
- Never commit `mobile/ios/Runner.xcodeproj/project.pbxproj`. It carries the local signing team and stays modified in the worktree.
diff --git a/mobile/lib/core/agent_preference.dart b/mobile/lib/core/agent_preference.dart
index 7f0cf9585..3167e7db5 100644
--- a/mobile/lib/core/agent_preference.dart
+++ b/mobile/lib/core/agent_preference.dart
@@ -1,3 +1,5 @@
+import 'dart:convert';
+
import 'local_key_value_store.dart';
/// Remembers an agent choice, independently of a machine, profile or permission.
@@ -5,28 +7,46 @@ class AgentPreference {
AgentPreference(this.storage);
final LocalKeyValueStore? storage;
static const _key = 'new_agent_engine';
+ static const _recentKey = 'new_agent_engine_history_v1';
String? value;
+ List<String> _recent = [];
+ List<String> get recent => List.unmodifiable(_recent);
Future<void>? _loading;
Future<void> _writes = Future.value();
- int _revision = 0;
Future<void> load() => _loading ??= _read();
Future<void> _read() async {
- final revision = _revision;
try {
final stored = await storage?.read(_key);
- if (revision == _revision && revision == 0) value = stored;
+ value = stored;
+ if (stored != null) _recent = [stored];
+ final raw = await storage?.read(_recentKey);
+ if (raw == null) return;
+ final decoded = jsonDecode(raw);
+ if (decoded is List) {
+ _recent = {
+ ?stored,
+ ...decoded.whereType<String>().where((id) => id.isNotEmpty),
+ }.take(40).toList();
+ value ??= _recent.firstOrNull;
+ }
} catch (_) {
/* A missing preference never blocks a new agent. */
}
}
- Future<void> select(String engine) {
- _revision++;
+ Future<void> select(String engine) async {
+ await load();
value = engine;
+ _recent = [
+ engine,
+ ..._recent.where((id) => id != engine),
+ ].take(40).toList();
+ final snapshot = jsonEncode(_recent);
return _writes = _writes.then((_) async {
try {
await storage?.write(_key, engine);
+ await storage?.write(_recentKey, snapshot);
} catch (_) {
/* Keep the current choice usable if persistence fails. */
}
diff --git a/mobile/lib/phone/new_agent_chooser.dart b/mobile/lib/phone/new_agent_chooser.dart
index 92703afb9..7c24ead57 100644
--- a/mobile/lib/phone/new_agent_chooser.dart
+++ b/mobile/lib/phone/new_agent_chooser.dart
@@ -46,15 +46,14 @@ class ChooserItem<T> {
/// and New: a title, a search field for long lists, the list growing down with `✓` on the
/// current value, and the `+` actions ending it. A tap picks and closes.
///
-/// [fold] keeps a long list short: past that many items a `more` row stands in for the rest, until
-/// it is tapped or something is typed.
+/// Long lists scroll in full. [autofocusSearch] always shows the search field and opens its keyboard.
Future<T?> showNewAgentChooser<T>(
BuildContext context, {
required String hint,
required List<ChooserItem<T>> items,
List<ChooserItem<T>> actions = const [],
String? title,
- int? fold,
+ bool autofocusSearch = false,
}) => showModalBottomSheet<T>(
context: context,
useRootNavigator: true,
@@ -72,7 +71,7 @@ Future<T?> showNewAgentChooser<T>(
hint: hint,
items: items,
actions: actions,
- fold: fold,
+ autofocusSearch: autofocusSearch,
),
),
);
@@ -83,14 +82,14 @@ class _Chooser<T> extends StatefulWidget {
required this.hint,
required this.items,
required this.actions,
- this.fold,
+ required this.autofocusSearch,
});
final String title;
final String hint;
final List<ChooserItem<T>> items;
final List<ChooserItem<T>> actions;
- final int? fold;
+ final bool autofocusSearch;
@override
State<_Chooser<T>> createState() => _ChooserState<T>();
@@ -100,7 +99,6 @@ class _ChooserState<T> extends State<_Chooser<T>> {
final _controller = TextEditingController();
final _focus = FocusNode();
String _query = '';
- bool _unfolded = false;
@override
void dispose() {
@@ -124,10 +122,6 @@ class _ChooserState<T> extends State<_Chooser<T>> {
for (final item in widget.items)
if (item.matches(query)) item,
];
- final fold = widget.fold;
- final folded =
- fold != null && !_unfolded && query.isEmpty && matches.length > fold;
- final shown = folded ? matches.take(fold).toList() : matches;
final terms = query.isEmpty
? const <String>[]
: query.split(RegExp(r'\s+'));
@@ -151,13 +145,13 @@ class _ChooserState<T> extends State<_Chooser<T>> {
],
),
),
- // Search where there is something to search: a long list that is not folded.
- if (widget.items.length > 8 && widget.fold == null)
+ if (widget.items.length > 8 || widget.autofocusSearch)
Padding(
padding: const EdgeInsets.fromLTRB(Tty.origin, 4, Tty.origin, 4),
child: TtyField(
controller: _controller,
focus: _focus,
+ autofocus: widget.autofocusSearch,
hint: widget.hint,
action: TextInputAction.search,
onChanged: (value) => setState(() => _query = value),
@@ -173,7 +167,7 @@ class _ChooserState<T> extends State<_Chooser<T>> {
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
padding: EdgeInsets.only(bottom: media.padding.bottom + 16),
children: [
- for (final item in shown)
+ for (final item in matches)
FindRow(
title: item.title,
detail: item.subtitle,
@@ -187,12 +181,6 @@ class _ChooserState<T> extends State<_Chooser<T>> {
enabled: item.enabled,
onTap: () => _choose(item),
),
- if (folded)
- FindRow(
- title: 'more',
- detail: '${matches.length - shown.length} others, A to Z',
- onTap: () => setState(() => _unfolded = true),
- ),
if (matches.isEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(
diff --git a/mobile/lib/phone/new_agent_page.dart b/mobile/lib/phone/new_agent_page.dart
index f44c4e3b4..6153f64da 100644
--- a/mobile/lib/phone/new_agent_page.dart
+++ b/mobile/lib/phone/new_agent_page.dart
@@ -82,6 +82,7 @@ class _NewAgentPageState extends State<NewAgentPage> {
String? _engine = 'claude';
String? _error;
bool _creating = false;
+ bool _optionsOpen = false;
/// Codex state folders this machine reported, and the one chosen. Null is the
/// machine's own default `CODEX_HOME`, which is what the desktop dialog calls
@@ -700,9 +701,6 @@ class _NewAgentPageState extends State<NewAgentPage> {
final summary = [
if (_folder != null || _project != null) _projectValue,
if (_engine != null) _engineName(_engine!),
- if (_repository != null) _worktree ? 'worktree' : _branchTitle,
- if (_permissionModes.isNotEmpty)
- (_permissionModeChoice?.label ?? 'Auto-approve'),
].join(' · ');
return Scaffold(
backgroundColor: tty.ground,
@@ -823,11 +821,20 @@ class _NewAgentPageState extends State<NewAgentPage> {
? null
: () => unawaited(_chooseProject()),
),
- // ⚠️ **Open, not folded behind `[+]` as the desktop folds them.** On a
- // phone the rows below sit over an empty half-screen, and they are the
- // two things worth seeing before a harness starts from a couch: which
- // branch it writes to, and what it may do without asking.
- if (info != null || _gitLoading || _gitFailed)
+ // The owner's default flow matches desktop: choose agent and project.
+ // Worktree, approvals and profile stay behind Options.
+ TtyFormRow(
+ label: 'options',
+ value: _optionsOpen ? '[-]' : '[+]',
+ chevron: false,
+ onTap: _creating
+ ? null
+ : () => setState(
+ () => _optionsOpen = !_optionsOpen,
+ ),
+ ),
+ if (_optionsOpen &&
+ (info != null || _gitLoading || _gitFailed))
TtyFormRow(
label: 'branch',
valueColor: info == null && !_gitLoading
@@ -849,7 +856,7 @@ class _NewAgentPageState extends State<NewAgentPage> {
? null
: () => unawaited(_chooseBranch(info)),
),
- if (_permissionModes.isNotEmpty)
+ if (_optionsOpen && _permissionModes.isNotEmpty)
TtyFormRow(
label: 'approvals',
value: mode?.label ?? 'Auto-approve',
@@ -861,7 +868,7 @@ class _NewAgentPageState extends State<NewAgentPage> {
? null
: () => unawaited(_chooseApprovals()),
),
- if (_showsCodexProfile)
+ if (_optionsOpen && _showsCodexProfile)
TtyFormRow(
label: 'profile',
value: _codexProfile?.label ?? 'Default',
@@ -1148,21 +1155,21 @@ class _NewAgentPageState extends State<NewAgentPage> {
}
Future<void> _chooseAgent() async {
+ await widget.notifier.agentPreference.load();
+ if (!mounted) return;
final machine = _machine;
- // Claude Code and Codex first — what nearly everyone runs — then the rest A to Z behind `more`.
- const first = ['claude', 'codex'];
+ final recent = widget.notifier.agentPreference.recent;
final ids = {for (final identity in _engines) identity.id, ?_engine};
final ordered = [
- for (final id in first)
+ for (final id in recent)
if (ids.contains(id)) id,
- ...(ids.where((id) => !first.contains(id)).toList()
+ ...(ids.where((id) => !recent.contains(id)).toList()
..sort((a, b) => _engineName(a).compareTo(_engineName(b)))),
];
final picked = await showNewAgentChooser<String>(
context,
title: 'Agent',
hint: 'Search agents',
- fold: ordered.where(first.contains).length,
items: [
for (final id in ordered)
ChooserItem(
@@ -1229,6 +1236,7 @@ class _NewAgentPageState extends State<NewAgentPage> {
context,
title: 'Project',
hint: 'Search projects',
+ autofocusSearch: true,
actions: [
ChooserItem(
value: const _ProjectChoice.open(),
diff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dart
index faa6037a3..4452cb43d 100644
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@ -1139,23 +1139,15 @@ class _TerminalPageState extends State<TerminalPage>
if (mounted) setState(() {});
}
- /// Brings the search sheet up over the terminal, reading the account's tabs
- /// with its field not yet focused — see [TerminalSearchOverlay].
+ /// Brings Find up over the terminal with its search field focused.
///
- /// ⚠️ **The terminal is held from THIS frame, though no keyboard is coming
- /// yet.** The sheet's field raises one the moment it is tapped, and by then
- /// the terminal must already be ignoring it — see [_heldForSearch] for what
- /// it does with that keyboard otherwise.
+ /// Hold the terminal before Find takes the keyboard — see [_heldForSearch].
void _openSearch({bool animate = true}) {
if (_searching) return;
_keyboardBeforeSearch = _keyboardIsUp;
_keyboardUpAtSearch = _keyboardUp;
_searchHoldTimer?.cancel();
- // ⚠️ **Whatever holds the keys lets go of them.** The sheet opens with its
- // field NOT focused, so nothing takes focus from the terminal the way the
- // search once did by focusing itself — and a terminal on a hardware
- // keyboard keeps its focus with no inset to show for it, so it would go on
- // typing into the shell from under the dimming.
+ // Release even a hardware keyboard before the search field mounts.
FocusManager.instance.primaryFocus?.unfocus();
setState(() {
_searching = true;
diff --git a/mobile/lib/phone/terminal_search.dart b/mobile/lib/phone/terminal_search.dart
index 8acb5ee68..2bec1d66e 100644
--- a/mobile/lib/phone/terminal_search.dart
+++ b/mobile/lib/phone/terminal_search.dart
@@ -47,8 +47,7 @@ import 'phone_search_results.dart';
/// ⚠️ **Full height, and a keyboard lifts only its foot.** It runs up under the status bar; a
/// keyboard, when it comes, takes the drawer's foot onto its own top rather than covering the rows.
///
-/// ⚠️ **The field is not focused on the way in.** The recent agents are what the sheet is opened to
-/// read, and a keyboard would cover half of them.
+/// The field takes focus on opening so a query can be typed immediately.
///
/// ⚠️ **Not a route.** Pushed, the sheet would sit in a navigator above the shell, and an agent
/// opened from it would be pushed over the shell rather than take the home screen (see
@@ -452,8 +451,7 @@ class _TerminalSearchOverlayState extends State<TerminalSearchOverlay>
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SizedBox(height: media.padding.top + 8),
- // The field at the top, like ⌘P: the list grows down from it. The keyboard stays
- // down until the field is tapped — the list is usually the answer.
+ // The field takes the keyboard on entry, like ⌘P.
// No Cancel: a swipe left is the way out, as it was the way in.
Padding(
padding: const EdgeInsets.symmetric(horizontal: Tty.origin),
@@ -463,6 +461,7 @@ class _TerminalSearchOverlayState extends State<TerminalSearchOverlay>
child: TtyField(
controller: _controller,
focus: _focus,
+ autofocus: true,
hint: _search.canGoBack
? 'Search in ${_search.scopeName}'
: _search.hint.replaceAll('…', ''),
diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml
index c402ccf0b..6c49fd308 100644
--- a/mobile/pubspec.yaml
+++ b/mobile/pubspec.yaml
@@ -2,7 +2,7 @@ name: harness_mobile
description: "Harness viewer for iOS and Android."
publish_to: 'none'
-version: 1.0.0+45
+version: 1.0.0+47
environment:
sdk: ^3.13.0
diff --git a/mobile/test/core_units_test.dart b/mobile/test/core_units_test.dart
index a811a1c2f..0a2d7524d 100644
--- a/mobile/test/core_units_test.dart
+++ b/mobile/test/core_units_test.dart
@@ -6,6 +6,7 @@ import 'package:fake_async/fake_async.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness_mobile/core/agent_output_stats.dart';
+import 'package:harness_mobile/core/agent_preference.dart';
import 'package:harness_mobile/core/device_name.dart';
import 'package:harness_mobile/core/fuzzy_match.dart';
import 'package:harness_mobile/core/git_project.dart';
@@ -687,6 +688,46 @@ void main() {
});
group('kept between launches', () {
+ test(
+ 'agent recency migrates the old preference and survives reopening',
+ () async {
+ final storage = MemoryKeyValueStore()
+ ..values['new_agent_engine'] = 'claude';
+ final preference = AgentPreference(storage);
+ await preference.load();
+ expect(preference.recent, ['claude']);
+ await preference.select('codex');
+ await preference.select('opencode');
+ await preference.select('codex');
+ final reopened = AgentPreference(storage);
+ await reopened.load();
+ expect(reopened.value, 'codex');
+ expect(reopened.recent, ['codex', 'opencode', 'claude']);
+ },
+ );
+
+ test('bad agent history keeps the saved default usable', () async {
+ final storage = MemoryKeyValueStore()
+ ..values['new_agent_engine'] = 'codex'
+ ..values['new_agent_engine_history_v1'] = '{broken';
+ final preference = AgentPreference(storage);
+ await preference.load();
+ expect(preference.recent, ['codex']);
+ await preference.select('claude');
+ expect(preference.recent, ['claude', 'codex']);
+ });
+
+ test(
+ 'failed persistence keeps agent recency for the current run',
+ () async {
+ final preference = AgentPreference(_Broken());
+ await preference.select('claude');
+ await preference.select('codex');
+ expect(preference.value, 'codex');
+ expect(preference.recent, ['codex', 'claude']);
+ },
+ );
+
test('recent folders, per machine, newest first and valid only', () async {
final storage = MemoryKeyValueStore()
..values['new_agent_projects_v1'] = jsonEncode({
diff --git a/mobile/test/phone_chooser_test.dart b/mobile/test/phone_chooser_test.dart
index a2b9950ab..d5ed61007 100644
--- a/mobile/test/phone_chooser_test.dart
+++ b/mobile/test/phone_chooser_test.dart
@@ -5,7 +5,11 @@ import 'package:harness_mobile/phone/tty.dart';
import 'package:harness_mobile/phone/tty_controls.dart';
void main() {
- Future<void> open(WidgetTester tester, {int count = 3, int? fold}) async {
+ Future<void> open(
+ WidgetTester tester, {
+ int count = 3,
+ bool autofocusSearch = false,
+ }) async {
tester.view.devicePixelRatio = 1;
tester.view.physicalSize = const Size(390, 844);
addTearDown(tester.view.reset);
@@ -18,7 +22,7 @@ void main() {
context,
title: 'Agent',
hint: 'Search agents',
- fold: fold,
+ autofocusSearch: autofocusSearch,
items: [
for (var i = 0; i < count; i++)
ChooserItem(value: i, title: 'Agent $i'),
@@ -48,16 +52,15 @@ void main() {
expect(find.byType(BottomSheet), findsNothing);
});
- testWidgets('expanded long chooser scrolls to its last choice', (
+ testWidgets('the full chooser scrolls to its last choice without more', (
tester,
) async {
- await open(tester, count: 20, fold: 2);
- await tester.tap(find.text('more', findRichText: true));
- await tester.pumpAndSettle();
+ await open(tester, count: 20);
+ expect(find.text('more', findRichText: true), findsNothing);
await tester.scrollUntilVisible(
find.text('Agent 19', findRichText: true),
250,
- scrollable: find.byType(Scrollable),
+ scrollable: find.byType(Scrollable).last,
);
await tester.tap(find.text('Agent 19', findRichText: true));
await tester.pumpAndSettle();
@@ -65,6 +68,17 @@ void main() {
expect(tester.takeException(), isNull);
});
+ testWidgets('a short searchable chooser accepts typing on entry', (
+ tester,
+ ) async {
+ await open(tester, autofocusSearch: true);
+ expect(tester.testTextInput.isVisible, isTrue);
+ tester.testTextInput.updateEditingValue(const TextEditingValue(text: '2'));
+ await tester.pumpAndSettle();
+ expect(find.text('Agent 2', findRichText: true), findsOneWidget);
+ expect(find.text('Agent 0', findRichText: true), findsNothing);
+ });
+
testWidgets('search choices remain above the keyboard', (tester) async {
await open(tester, count: 20);
tester.view.viewInsets = const FakeViewPadding(bottom: 300);
diff --git a/mobile/test/phone_edge/find_behavior_test.dart b/mobile/test/phone_edge/find_behavior_test.dart
index 12b184923..77c9a3453 100644
--- a/mobile/test/phone_edge/find_behavior_test.dart
+++ b/mobile/test/phone_edge/find_behavior_test.dart
@@ -150,6 +150,20 @@ void main() {
await close(tester, app);
});
+ testWidgets('Find accepts a query immediately on opening', (tester) async {
+ final (:app, closes: _, opened: _, voice: _, stt: _) = await openFind(
+ tester,
+ );
+ expect(tester.testTextInput.isVisible, isTrue);
+ tester.testTextInput.updateEditingValue(
+ const TextEditingValue(text: 'working'),
+ );
+ await frames(tester);
+ expect(find.text('working', findRichText: true), findsWidgets);
+ expect(find.text('paused-work', findRichText: true), findsNothing);
+ await close(tester, app);
+ });
+
testWidgets('a paused harness the machine cannot bring back says why', (
tester,
) async {
diff --git a/mobile/test/phone_edge/new_behavior_test.dart b/mobile/test/phone_edge/new_behavior_test.dart
index 8bc46f23f..e0398b89c 100644
--- a/mobile/test/phone_edge/new_behavior_test.dart
+++ b/mobile/test/phone_edge/new_behavior_test.dart
@@ -5,6 +5,7 @@ import 'package:harness_mobile/core/models.dart';
import 'package:harness_mobile/phone/agent_swipe.dart';
import 'package:harness_mobile/phone/new_agent_draft.dart';
import 'package:harness_mobile/phone/new_agent_page.dart';
+import 'package:harness_mobile/phone/find_row.dart';
import 'package:harness_mobile/phone/tty_controls.dart' show TtyFieldMic;
import 'package:harness_mobile/state/app_state.dart';
@@ -155,8 +156,11 @@ void main() {
await choose(tester, 'agent', 'Codex');
expect(find.text('Codex', findRichText: true), findsWidgets);
- // The approvals and the Codex profile are on the page, not folded away.
- expect(find.text('options'), findsNothing);
+ expect(find.text('profile'), findsNothing);
+ expect(find.text('approvals'), findsNothing);
+ expect(find.text('branch'), findsNothing);
+ await tapInView(tester, find.text('options'));
+ await frames(tester);
await choose(tester, 'profile', 'work');
await tapInView(tester, find.text('approvals'));
await frames(tester);
@@ -165,6 +169,11 @@ void main() {
await tester.tapAt(tester.getCenter(find.byType(ModalBarrier).last));
await frames(tester);
+ // Collapsing Options hides the rows without discarding the chosen profile.
+ await tapInView(tester, find.text('options'));
+ await frames(tester);
+ expect(find.text('profile'), findsNothing);
+
await tapInView(tester, find.text('Start'));
await frames(tester, count: 20);
final created = conn.payloads['agent_create']!.single;
@@ -179,12 +188,7 @@ void main() {
final (:app, conn: _) = await openNew(tester);
await tapInView(tester, find.text('agent'));
await frames(tester);
- // Behind `more`: the rest, A to Z.
- final more = find.text('more');
- if (more.evaluate().isNotEmpty) {
- await tester.tap(more.first);
- await frames(tester);
- }
+ expect(find.text('more'), findsNothing);
await tester.scrollUntilVisible(
find.text('not installed'),
200,
@@ -197,6 +201,9 @@ void main() {
testWidgets('the branch: this folder, a new worktree, another branch, a '
'new name', (tester) async {
final (:app, :conn) = await openNew(tester);
+ expect(find.text('branch'), findsNothing);
+ await tapInView(tester, find.text('options'));
+ await frames(tester);
expect(find.text('branch'), findsOneWidget);
await choose(tester, 'branch', 'New Worktree');
@@ -237,6 +244,44 @@ void main() {
await close(tester, app);
});
+ testWidgets('agents are offered in most recently used order', (tester) async {
+ final (:app, conn: _) = await openNew(tester);
+ await app.agentPreference.select('claude');
+ await app.agentPreference.select('opencode');
+ await app.agentPreference.select('codex');
+ await tapInView(tester, find.text('agent'));
+ await frames(tester);
+ final titles = tester
+ .widgetList<FindRow>(find.byType(FindRow))
+ .map((row) => row.title)
+ .toList();
+ expect(titles.take(3), ['Codex', 'OpenCode', 'Claude Code']);
+ expect(find.text('more'), findsNothing);
+ await close(tester, app);
+ });
+
+ testWidgets('the project picker is ready to type without tapping its field', (
+ tester,
+ ) async {
+ final (:app, conn: _) = await openNew(tester, twoMachines: true);
+ await tapInView(tester, find.text('project'));
+ await frames(tester);
+ expect(tester.testTextInput.isVisible, isTrue);
+ tester.testTextInput.updateEditingValue(
+ const TextEditingValue(text: 'api'),
+ );
+ await frames(tester);
+ expect(
+ find.descendant(
+ of: find.byType(FindRow),
+ matching: find.text('api', findRichText: true),
+ ),
+ findsOneWidget,
+ );
+ expect(find.text('web', findRichText: true), findsNothing);
+ await close(tester, app);
+ });
+
testWidgets('the project: a new folder, and a repository by URL', (
tester,
) async {
@@ -386,6 +431,8 @@ void main() {
phoneApp(NewAgentPage(notifier: app, machineId: 'm')),
);
await frames(tester);
+ await tapInView(tester, find.text('options'));
+ await frames(tester);
expect(
find.text('No answer from the computer', findRichText: true),
findsOneWidget,
diff --git a/mobile/test/phone_edge/new_layout_test.dart b/mobile/test/phone_edge/new_layout_test.dart
index 269fb690d..179bb0340 100644
--- a/mobile/test/phone_edge/new_layout_test.dart
+++ b/mobile/test/phone_edge/new_layout_test.dart
@@ -67,6 +67,8 @@ void main() {
);
addTearDown(app.dispose);
await pumpNew(tester, app, scale, brightness);
+ await tapInView(tester, find.text('options'));
+ await frames(tester);
});
});