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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Clarify Cmd+N controls and prevent accidental dismissal (#720)
Dee55369e30f757
diff --git a/desktop/design/friendly-desktop-experiment.md b/desktop/design/friendly-desktop-experiment.mdindex a03394beb..7107cd77f 100644--- a/desktop/design/friendly-desktop-experiment.md+++ b/desktop/design/friendly-desktop-experiment.md@@ -68,10 +68,12 @@ Desktop 1.2.27 and must not be merged without the user's approval.traversal while preserving a carried message.- In the task editor, Enter submits; Shift-Enter inserts a newline. Cmd-Enterremains a remappable launch shortcut. Opening a chooser does not submit the task.- Escape and outside clicks dismiss the innermost chooser, then the main form,- preserving its draft. X directly dismisses the composer and remains available while- a chooser is open. Existing pending-launch checks still protect unresolved- creation receipts.+ Outside clicks close an open chooser but keep the main form open. Escape+ dismisses the innermost chooser first, then the main form on another press.+ X directly dismisses the composer and remains available while a chooser is open.+ Explicit dismissal discards the unfinished task and attachments; reopening starts+ fresh with the usual launch defaults. Existing pending-launch checks still+ protect unresolved creation receipts.A choice or cancellation returns focus to the originating control. Tab andShift-Tab dismiss a chooser without applying a value and continue form traversal.- Focus stays inside the active dialog. The prompt receives initial focus;diff --git a/desktop/design/images/new-harness-cmd-n.png b/desktop/design/images/new-harness-cmd-n.pngnew file mode 100644index 000000000..b613aaa29Binary files /dev/null and b/desktop/design/images/new-harness-cmd-n.png differdiff --git a/desktop/design/new-harness-entry-rules.md b/desktop/design/new-harness-entry-rules.mdindex 0a4eaf966..ea120bbb0 100644--- a/desktop/design/new-harness-entry-rules.md+++ b/desktop/design/new-harness-entry-rules.md@@ -10,27 +10,40 @@ Cmd-N, at the same 680-point maximum width. The page has Recent harnesses belowthe composer, without a modal frame or Close button. Opening the page or dialognever starts a harness; Enter or New Harness starts it, with or without a prompt.-Agent and Repo selectors sit above the message. Model, Approvals, applicable-Profile, Worktree, and Branch remain visible below it. Fresh forms and recovered+Agent, Computer, and Repo selectors sit above the message. The local computer is+**This Mac** on macOS and **This Computer** on Linux; remote computers retain their+names. Model, Approvals, applicable Account, Worktree, and Branch remain visible+below the message. Worktree and Branch stay on one line, without explanatory text+underneath. **From main** identifies the base of a new worktree branch; a tooltip+explains the operation. Existing branches and worktrees retain their branch name.++The model control retains the provider/subscription picker and shared models.+Per-agent model selection stays in the agent's own UI. Model, Approvals, Account,+Worktree, and Branch remain on one row; narrow windows scroll horizontally+instead of wrapping settings onto another line. Named accounts are currently+Codex-only; an unnamed account reads **Default account**. Fresh forms and recoveredlaunches focus the prompt. Terminal, which takes no task, focuses New Harness. In the message,Enter submits and Shift-Enter inserts a newline, respecting composition and theactive keymap. Tab/Shift-Tab traverse the visible controls. Arrow keys navigatean open chooser. Accepting or cancelling returns focus to its originating control.-Outside clicks and Escape close the innermost child picker first, then the main-popup. The X directly closes the popup. Closing cancels an ordinary unfinished-form; unresolved launch receipts retain their close guards and recovery values.+Outside clicks close an open picker but never dismiss the main popup. Escape+closes the innermost child picker first; with no picker open, it closes the popup.+The X directly closes the popup. Closing discards an ordinary unfinished task+and its attachments; unresolved launch receipts retain their close guards and recovery values.The popup's 95% dark backdrop covers the native footer. Reopening starts fresh. Choosers use system typography, normal controls, a search field,natural row heights, and bounded scrolling.++Agent combines direct coding agents and specialized harnesses in one searchablelist. A specialized harness then offers compatible coding agents. Repo searches-recent folders on the selected machine; its search row contains the machine-picker, using the working project's machine, or local for a first launch. Open Folder, New Folder,+recent folders on the computer selected in the header; the search row does not+repeat the computer picker. Open Folder, New Folder,and GitHub operate on that selected machine. Open invokes the native localfolder dialog or remote browser; New and Clone offer Change machine inside-their prompts. Escape retraces child steps. A remote machine appears in the-closed Repo label, with the full folder path available in its tooltip.+their prompts. Escape retraces child steps. The computer remains visible in its own header selector, with the full folder+path available in the Repo tooltip.Opening, searching, and cancelling never send input to an existing harness.diff --git a/desktop/lib/state/new_harness.dart b/desktop/lib/state/new_harness.dartindex 1f8dfb6fc..a45252cc2 100644--- a/desktop/lib/state/new_harness.dart+++ b/desktop/lib/state/new_harness.dart@@ -750,6 +750,24 @@ class NewHarnessController extends ChangeNotifier {: '$name · new from ${_refName(currentBranchRef(_gitProject)) ?? 'HEAD'}';}+ /// A new worktree names its base instead of implying it opens that branch.+ String get compactBranchLabel =>+ worktree &&+ worktreePlan?.kind == WorktreeStart.newBranch &&+ _branchName == null+ ? 'From $branchLabel'+ : branchRowLabel.split(' · ').first;++ String get branchTooltip {+ final plan = worktreePlan;+ if (worktree && plan?.kind == WorktreeStart.newBranch) {+ return 'New branch from ${_refName(plan!.base) ?? 'HEAD'} in a separate folder';+ }+ if (opensWorktree) return 'Open $branchLabel in its existing worktree';+ if (worktree) return 'Open $branchLabel in a separate folder';+ return 'Use $branchRowLabel in the project folder';+ }+/// Start goes into a worktree that already exists.bool get opensWorktree => worktree? worktreePlan?.kind == WorktreeStart.openWorktree@@ -1062,7 +1080,7 @@ class NewHarnessController extends ChangeNotifier {bool _profileChosen = false;String? get profileLabel =>_base == 'codex' && (_profileChosen || _profile != null)- ? _profile?.label ?? 'Default'+ ? _profile?.label ?? (_desktopChoices ? 'Default account' : 'Default'): null;NewHarnessDraft get draft => NewHarnessDraft(diff --git a/desktop/lib/widgets/new_harness_form.dart b/desktop/lib/widgets/new_harness_form.dartindex 5e93aadd2..4cfd8ad25 100644--- a/desktop/lib/widgets/new_harness_form.dart+++ b/desktop/lib/widgets/new_harness_form.dart@@ -79,8 +79,9 @@ class NewHarnessFormState extends State<NewHarnessForm> {final _queryText = TextEditingController();late final _taskText = TextEditingController(text: box.task);final _taskFocus = FocusNode(debugLabel: 'New harness task');- final _machineMenu = MenuController();- final _machineFocus = FocusNode(debugLabel: 'Repo machine');+ final _headerMachineMenu = MenuController();+ final _headerMachineFocus = FocusNode(debugLabel: 'New harness computer');+ final _headerMachineAnchor = GlobalKey();bool get _desktopStartEnabled =>!box.busy &&!box.linkingProfile &&@@ -108,6 +109,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {bool? _chooserTraversal;bool _focusScheduled = false;final _fieldsScroll = ScrollController();+ final _settingsScroll = ScrollController();final _choicesScroll = ScrollController();final _desktopNoticesScroll = ScrollController();_Row _row = _Row.start;@@ -168,12 +170,13 @@ class NewHarnessFormState extends State<NewHarnessForm> {_queryText.dispose();_taskText.dispose();_taskFocus.dispose();- _machineFocus.dispose();+ _headerMachineFocus.dispose();_dialogScope.dispose();for (final node in _desktopFocus.values) {node.dispose();}_fieldsScroll.dispose();+ _settingsScroll.dispose();_choicesScroll.dispose();_desktopNoticesScroll.dispose();_focus.dispose();@@ -240,10 +243,9 @@ class NewHarnessFormState extends State<NewHarnessForm> {WidgetsBinding.instance.addPostFrameCallback((_) {_focusScheduled = false;if (!mounted) return;+ if (_headerMachineMenu.isOpen) return;if (_picking) {- if (!_machineMenu.isOpen && !_machineFocus.hasFocus) {- _inputFocus.requestFocus();- }+ _inputFocus.requestFocus();} else if (widget.desktop) {final origin = _chooserOrigin;if (_restoreChoiceFocus &&@@ -264,14 +266,14 @@ class NewHarnessFormState extends State<NewHarnessForm> {});}+ /// Outside clicks dismiss a desktop picker, never the creation form.+ /// Escape and Close remain the explicit ways to discard an unfinished task.void dismissFromOutside() {if (widget.desktop) {- if (_machineMenu.isOpen) {- _machineMenu.close();+ if (_headerMachineMenu.isOpen) {+ _headerMachineMenu.close();} else if (_picking && !box.locked) {_closeDesktopChooser();- } else if (!widget.embedded && box.requestDismiss()) {- widget.onClose();}} else {_runCommand(_cancel);@@ -286,7 +288,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {}void _closeDesktopChooser({bool? next}) {- _machineMenu.close();+ _headerMachineMenu.close();_folderAction = null;box.setQuery('');box.focusField(NewHarnessField.launch);@@ -344,7 +346,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {_Row.branch => 'Branch',_Row.worktree => 'Worktree',_Row.approvals => 'Approvals',- _Row.profile => 'Profile',+ _Row.profile => widget.desktop ? 'Account' : 'Profile',_Row.start => 'New Harness',};@@ -360,7 +362,8 @@ class NewHarnessFormState extends State<NewHarnessForm> {_Row.branch => box.branchRowLabel,_Row.worktree => box.worktree ? '[x]' : '[ ]',_Row.approvals => box.modeLabel,- _Row.profile => box.profileLabel ?? 'Default',+ _Row.profile =>+ box.profileLabel ?? (widget.desktop ? 'Default account' : 'Default'),_Row.start => box.checking ? 'Check status' : _label(row),};@@ -631,18 +634,6 @@ class NewHarnessFormState extends State<NewHarnessForm> {void _switchPane({bool reverse = false}) {if (box.locked) return;- if (widget.desktop &&- _picking &&- box.field == NewHarnessField.projectMenu) {- if (!reverse && _inputFocus.hasFocus) {- _machineFocus.requestFocus();- return;- }- if (reverse && _machineFocus.hasFocus) {- _inputFocus.requestFocus();- return;- }- }if (widget.desktop && _picking) {_closeDesktopChooser(next: !reverse);return;@@ -961,12 +952,6 @@ class NewHarnessFormState extends State<NewHarnessForm> {}void _confirm() {- if (widget.desktop &&- _machineFocus.hasFocus &&- box.field == NewHarnessField.projectMenu) {- _machineMenu.open();- return;- }// Return chooses a value in the list; only the start row launches.if (_picking) {final option = box.selected;@@ -991,8 +976,8 @@ class NewHarnessFormState extends State<NewHarnessForm> {}void _cancel() {- if (widget.desktop && _machineMenu.isOpen) {- _machineMenu.close();+ if (widget.desktop && _headerMachineMenu.isOpen) {+ _headerMachineMenu.close();return;}if (widget.desktop && !_picking) {@@ -1051,7 +1036,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {}void _openCreationRow(_Row row) {- _machineMenu.close();+ _headerMachineMenu.close();_folderAction = null;// A direct shortcut enters the top-level chooser, even when another// chooser currently owns a nested project or specialized-agent prompt.@@ -1065,19 +1050,16 @@ class NewHarnessFormState extends State<NewHarnessForm> {void _openMachineChooser() {if (box.locked) return;- _folderAction = null;- _chooserOrigin = _desktopFocus[_Row.project];- _chooserAnchor = _desktopAnchors[_Row.project];- _restoreChoiceFocus = false;- if (box.field != NewHarnessField.projectMenu) _selectRow(_Row.project);- box.focusField(NewHarnessField.projectMenu);- setState(() => _listOpen = true);- _focusEditor();- WidgetsBinding.instance.addPostFrameCallback((_) {- if (mounted && box.field == NewHarnessField.projectMenu && _picking) {- _machineFocus.requestFocus();- _machineMenu.open();- }+ _closeDesktopChooser();+ _chooserOrigin = _headerMachineFocus;+ _chooserAnchor = _headerMachineAnchor;+ WidgetsBinding.instance.addPostFrameCallback((_) async {+ if (!mounted) return;+ final anchor = _headerMachineAnchor.currentContext;+ if (anchor != null) await Scrollable.ensureVisible(anchor);+ if (!mounted) return;+ _headerMachineFocus.requestFocus();+ _headerMachineMenu.open();});}@@ -1128,7 +1110,9 @@ class NewHarnessFormState extends State<NewHarnessForm> {KeyEventResult _onKey(FocusNode node, KeyEvent event) {// The cascading menu owns its own arrow, Enter, and Escape handling.- if (_machineMenu.isOpen) return KeyEventResult.ignored;+ if (_headerMachineMenu.isOpen) {+ return KeyEventResult.ignored;+ }if (event is! KeyDownEvent && event is! KeyRepeatEvent) {return KeyEventResult.ignored;}@@ -1171,31 +1155,6 @@ class NewHarnessFormState extends State<NewHarnessForm> {// Candidate navigation and confirmation belong to the input method. Keep// these keys out of both the picker and ancestor focus-traversal shortcuts.if (_isComposing()) return KeyEventResult.skipRemainingHandlers;- if (widget.desktop && box.field == NewHarnessField.projectMenu) {- if (_machineFocus.hasFocus) {- if (event.logicalKey == LogicalKeyboardKey.tab) {- if (HardwareKeyboard.instance.isShiftPressed) {- _inputFocus.requestFocus();- } else {- _closeDesktopChooser(next: true);- }- return KeyEventResult.handled;- }- if (event.logicalKey == LogicalKeyboardKey.enter ||- event.logicalKey == LogicalKeyboardKey.numpadEnter ||- event.logicalKey == LogicalKeyboardKey.arrowDown ||- event.logicalKey == LogicalKeyboardKey.arrowRight) {- _machineMenu.open();- return KeyEventResult.handled;- }- return KeyEventResult.ignored;- }- if (event.logicalKey == LogicalKeyboardKey.tab &&- !HardwareKeyboard.instance.isShiftPressed) {- _machineFocus.requestFocus();- return KeyEventResult.handled;- }- }if (event.logicalKey == LogicalKeyboardKey.keyR &&(HardwareKeyboard.instance.isMetaPressed ||HardwareKeyboard.instance.isControlPressed) &&@@ -1212,7 +1171,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {switch (event.logicalKey) {case LogicalKeyboardKey.tab:// Arrows move within a pane; Tab switches panes without choosing.- _switchPane();+ _switchPane(reverse: HardwareKeyboard.instance.isShiftPressed);case LogicalKeyboardKey.arrowDown:// While the list is open it owns ↑↓, so the rows below do not move// under a highlight the reader is using to choose.@@ -1467,9 +1426,11 @@ class NewHarnessFormState extends State<NewHarnessForm> {},if (widget.desktop)'picker.add_here': () {- if (!_isComposing() && !_picking) unawaited(_start());+ if (!_isComposing() && !_picking && !_headerMachineMenu.isOpen) {+ unawaited(_start());+ }},- if ((!widget.desktop || _picking) && !_machineMenu.isOpen) ...{+ if ((!widget.desktop || _picking) && !_headerMachineMenu.isOpen) ...{'picker.accept': () => _runCommand(_confirm),'picker.next': () =>_runCommand(() => _picking ? _stepMatch(1) : _moveRow(1)),@@ -1693,13 +1654,11 @@ class NewHarnessFormState extends State<NewHarnessForm> {),Positioned.fromRect(rect: anchor,- child: _desktopMachineAnchor(- child: DesktopDialogSurface(- radius: DesktopChrome.menuRadius,- key: const ValueKey('new-harness-chooser-surface'),- elevation: 8,- child: _desktopChooser(),- ),+ child: DesktopDialogSurface(+ radius: DesktopChrome.menuRadius,+ key: const ValueKey('new-harness-chooser-surface'),+ elevation: 8,+ child: _desktopChooser(),),),// Keep the explicit Close action above the chooser's outside-tap@@ -1771,6 +1730,32 @@ class NewHarnessFormState extends State<NewHarnessForm> {capsule: true,),),+ _desktopField(+ order: 2,+ anchor: _headerMachineAnchor,+ child: _desktopMachineAnchor(+ child: DesktopPill(+ key: const ValueKey('new-harness-field-machine'),+ focusNode: _headerMachineFocus,+ label: _repoMachineLabel(box.machineId),+ semanticLabel:+ 'Computer, ${_repoMachineLabel(box.machineId)}',+ icon: box.app.stateOf(box.machineId)?.isLocalMachine == true+ ? AppIcons.laptop+ : AppIcons.monitor,+ menu: true,+ capsule: true,+ tooltip: 'Choose computer',+ textSize: 13,+ surfaceColor: DesktopChrome.surface,+ onPressed: box.locked+ ? null+ : () => _headerMachineMenu.isOpen+ ? _headerMachineMenu.close()+ : _headerMachineMenu.open(),+ ),+ ),+ ),_desktopField(order: 3,anchor: _desktopAnchors[_Row.project]!,@@ -1778,9 +1763,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {child: _desktopChoiceButton(_Row.project,AppIcons.folder,- label: box.app.stateOf(box.machineId)?.isLocalMachine == true- ? projectName- : '$projectName · ${box.machineLabel}',+ label: projectName,capsule: true,),),@@ -1946,10 +1929,10 @@ class NewHarnessFormState extends State<NewHarnessForm> {Widget _desktopSettings() => LayoutBuilder(builder: (context, constraints) {- final controls = Wrap(+ final controls = Row(key: const ValueKey('new-harness-agent-settings'),+ mainAxisSize: MainAxisSize.min,spacing: 2,- runSpacing: 4,children: [if (!box.isTerminal)_desktopField(@@ -1973,7 +1956,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {);final gitControls = Row(key: const ValueKey('new-harness-git-settings'),- mainAxisAlignment: MainAxisAlignment.end,+ mainAxisSize: MainAxisSize.min,children: [if (box.canUseWorktree)_desktopField(@@ -2001,37 +1984,33 @@ class NewHarnessFormState extends State<NewHarnessForm> {),),if (box.isGitProject || box.checkingGit || box.gitError != null)- Flexible(- child: _desktopField(- order: 9,- anchor: _desktopAnchors[_Row.branch]!,- child: _desktopChoiceButton(- _Row.branch,- AppIcons.gitBranch,- label: box.branchRowLabel.split(' · ').first,- ),+ _desktopField(+ order: 9,+ anchor: _desktopAnchors[_Row.branch]!,+ child: _desktopChoiceButton(+ _Row.branch,+ AppIcons.gitBranch,+ label: box.compactBranchLabel,),),],);- if (constraints.maxWidth <- 620 * MediaQuery.textScalerOf(context).scale(1)) {- return Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- controls,- if (!box.isTerminal) const SizedBox(height: 2),- gitControls,- ],- );- }- return Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Expanded(child: controls),- const SizedBox(width: 16),- SizedBox(width: constraints.maxWidth * .48, child: gitControls),- ],+ return Scrollbar(+ controller: _settingsScroll,+ child: SingleChildScrollView(+ key: const ValueKey('new-harness-settings-scroll'),+ controller: _settingsScroll,+ scrollDirection: Axis.horizontal,+ child: ConstrainedBox(+ constraints: BoxConstraints(minWidth: constraints.maxWidth),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ spacing: 16,+ children: [controls, gitControls],+ ),+ ),+ ),);},);@@ -2080,10 +2059,11 @@ class NewHarnessFormState extends State<NewHarnessForm> {String _desktopChoiceTooltip(_Row row) {if (_blocked(row) case final reason?) return '${_label(row)}: $reason';+ if (row == _Row.branch) return box.branchTooltip;final action = switch (row) {_Row.model => 'Choose model',_Row.approvals => 'Choose approval mode',- _Row.profile => 'Choose Codex profile',+ _Row.profile => 'Choose Codex account',_ => _label(row),};return '$action: ${_value(row)}';@@ -2163,14 +2143,9 @@ class NewHarnessFormState extends State<NewHarnessForm> {final preferredWidth = switch (box.field) {NewHarnessField.harness || NewHarnessField.agent => 304.0,NewHarnessField.model => 440.0,- // Keep room for the query beside its machine at enlarged text sizes.- // Fixed space covers both insets, icons, gaps, the capped machine pill,- // and refresh; measuring the labels also supports nonlinear text scaling.NewHarnessField.projectMenu => math.max(400.0,- _desktopTextSize('Search repos', 14).width +- _desktopTextSize('in', 12).width +- 278,+ _desktopTextSize('Search repos', 14).width + 96,),NewHarnessField.project => 400.0,NewHarnessField.mode => 380.0,@@ -2237,7 +2212,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {NewHarnessField.harness => 'Choose agent',NewHarnessField.model => 'Choose model',NewHarnessField.mode => 'Approvals',- NewHarnessField.profile => 'Codex profile',+ NewHarnessField.profile => 'Codex account',NewHarnessField.branch => 'Choose branch',_ => 'Choose an option',};@@ -2523,7 +2498,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {Widget _desktopOption(NewHarnessOption option) {final title = _desktopOptionTitle(option);- final highlighted = identical(option, box.selected) && !_machineMenu.isOpen;+ final highlighted = identical(option, box.selected);final ink = highlighted? DesktopChrome.onSelection: DesktopChrome.foreground;@@ -3156,7 +3131,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {NewHarnessField.projectRepository => 'Enter GitHub URL',NewHarnessField.agent => 'Run ${box.harnessLabel} with',NewHarnessField.mode => 'Search approvals',- NewHarnessField.profile => 'Search profiles',+ NewHarnessField.profile => 'Search accounts',_ => box.hint,}: box.field == NewHarnessField.agent@@ -3172,7 +3147,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {box.app.stateOf(id)?.isLocalMachine == true? Theme.of(context).platform == TargetPlatform.macOS? 'This Mac'- : 'This computer'+ : 'This Computer': box.app.stateOf(id)?.machine.displayName ?? id;void _selectRepoMachine(String id) {@@ -3185,23 +3160,27 @@ class NewHarnessFormState extends State<NewHarnessForm> {}box.focusField(NewHarnessField.machine);box.accept(choice);- _inputFocus.requestFocus();- _focusEditor();+ box.focusField(NewHarnessField.launch);+ _headerMachineFocus.requestFocus();}- // Anchor to the whole repo popover so both top edges align and the child- // menu sits beyond its rim, rather than overlapping the search field.+ // Computer selection belongs to the header, independently of repo search.Widget _desktopMachineAnchor({required Widget child}) => MenuAnchor(- controller: _machineMenu,- childFocusNode: _machineFocus,+ controller: _headerMachineMenu,+ childFocusNode: _headerMachineFocus,consumeOutsideTap: true,alignmentOffset: const Offset(8, 0),onOpen: () => setState(() {}),onClose: () {- if (mounted) setState(() {});+ if (!mounted) return;+ setState(() {});+ _chooserOrigin = _headerMachineFocus;+ _restoreChoiceFocus = true;+ _chooserTraversal = null;+ _focusEditor();},style: MenuStyle(- alignment: Alignment.topRight,+ alignment: Alignment.bottomLeft,backgroundColor: WidgetStatePropertyAll(DesktopChrome.surface),surfaceTintColor: const WidgetStatePropertyAll(Colors.transparent),elevation: const WidgetStatePropertyAll(grid.AppMenu.elevation),@@ -3217,7 +3196,9 @@ class NewHarnessFormState extends State<NewHarnessForm> {key: ValueKey('new-harness-machine-option-${option.id}'),autofocus: option.id == box.machineId && option.enabled,onPressed: option.enabled && !box.locked- ? () => _selectRepoMachine(option.id)+ ? () {+ _selectRepoMachine(option.id);+ }: null,style:MenuItemButton.styleFrom(@@ -3318,34 +3299,6 @@ class NewHarnessFormState extends State<NewHarnessForm> {child: child,);- // Handle traversal before MenuAnchor's menu-bar shortcuts consume arrows.- Widget _repoMachinePicker() => Focus(- canRequestFocus: false,- onKeyEvent: _onKey,- child: ConstrainedBox(- constraints: const BoxConstraints(maxWidth: 160),- child: DesktopPill(- key: const ValueKey('new-harness-repo-machine'),- focusNode: _machineFocus,- label: _repoMachineLabel(box.machineId),- semanticLabel: 'Machine, ${_repoMachineLabel(box.machineId)}',- tooltip: 'Machine: ${box.machineLabel}',- menu: true,- menuIcon: AppIcons.chevronRight,- compact: true,- quiet: true,- onPressed: box.locked- ? null- : () {- _machineFocus.requestFocus();- _machineMenu.isOpen- ? _machineMenu.close()- : _machineMenu.open();- },- ),- ),- );-Widget _searchBar() {return Padding(key: _searchKey,@@ -3445,15 +3398,6 @@ class NewHarnessFormState extends State<NewHarnessForm> {),),),- if (widget.desktop && box.field == NewHarnessField.projectMenu) ...[- const SizedBox(width: 8),- Text(- 'in',- style: DesktopChrome.text(size: 12, color: DesktopChrome.muted),- ),- const SizedBox(width: 2),- _repoMachinePicker(),- ],if (box.canRefreshChoices)// Held to two cells by one row: a Material button's 48px tap// target would make the prompt taller than every other line.diff --git a/desktop/test/desktop_compact_launch_test.dart b/desktop/test/desktop_compact_launch_test.dartindex 0b7ef8b9a..ccd946440 100644--- a/desktop/test/desktop_compact_launch_test.dart+++ b/desktop/test/desktop_compact_launch_test.dart@@ -376,6 +376,7 @@ void main({bool nativeSmoke = false}) {_close,_start,_agent,+ find.byKey(const ValueKey('new-harness-field-machine')),find.byKey(const ValueKey('new-harness-field-project')),_task,]) {@@ -612,6 +613,8 @@ void main({bool nativeSmoke = false}) {expect(tester.getSize(_surface).width, 680);await tester.tapAt(const Offset(5, 5));await tester.pumpAndSettle();+ expect(fixture.closed, 0);+ await key(tester, LogicalKeyboardKey.escape);expect(fixture.closed, 1);});}diff --git a/desktop/test/desktop_composer_layout_test.dart b/desktop/test/desktop_composer_layout_test.dartindex 319b03a27..d1f6f59d7 100644--- a/desktop/test/desktop_composer_layout_test.dart+++ b/desktop/test/desktop_composer_layout_test.dart@@ -420,7 +420,7 @@ void main() {final resting = buttonMaterial(control);await _focus(tester, control);final focused = buttonMaterial(control);- expect(tester.getRect(control), before);+ expect(tester.getRect(control).size, before.size);final restingShape = resting.shape! as OutlinedBorder;final focusedShape = focused.shape! as OutlinedBorder;expect(focusedShape.runtimeType, restingShape.runtimeType);@@ -435,7 +435,7 @@ void main() {for (final (name, message) in [('model', 'Choose model: OpenAI'),('approvals', 'Choose approval mode: Auto-approve'),- ('profile', 'Choose Codex profile: Default'),+ ('profile', 'Choose Codex account: Default account'),]) {final tooltip = tester.widget<Tooltip>(find.descendant(of: _field(name), matching: find.byType(Tooltip)),@@ -507,6 +507,8 @@ void main() {_field('start'),_close,]) {+ await tester.ensureVisible(control);+ await tester.pumpAndSettle();await pointer.moveTo(tester.getCenter(control));await tester.pump();expect(@@ -647,69 +649,64 @@ void main() {expect(tester.takeException(), isNull);});}- testWidgets('Repo and side-by-side machine menus fit ${brightness.name}', (- tester,- ) async {- final fixture = await _mount(- tester,- brightness: brightness,- onBrowse: (_) {},- );- await tester.tap(_field('project'));- await tester.pumpAndSettle();- expect(fixture.box.field, NewHarnessField.projectMenu);- expect(_query.hitTestable(), findsOneWidget);- final menu = tester.getRect(_chooser);- expect(menu.width, greaterThanOrEqualTo(400));- final hint = find.descendant(- of: _query,- matching: find.text('Search repos'),- );- expect(- tester.renderObject<RenderParagraph>(hint).didExceedMaxLines,- isFalse,- );- expect(menu.height, lessThan(280));- expect(fixture.box.options.take(3).map((o) => o.title), [- 'Open Folder',- 'New Folder',- 'GitHub',- ]);- expect(- tester.getRect(_query).center.dy,- closeTo(tester.getRect(_machine).center.dy, 1),- );- expect(- tester.getRect(_query).right,- lessThan(tester.getRect(_machine).left),- );- await capture(tester, fixture, 'repo-menu-${brightness.name}');- await tester.tap(_machine);- await tester.pumpAndSettle();- final local = find.byKey(- const ValueKey('new-harness-machine-option-review'),- );- expect(local, findsOneWidget);- expect(fixture.box.field, NewHarnessField.projectMenu);- expect(tester.getRect(local).left, greaterThan(menu.right));- expect(tester.getRect(local).top, closeTo(menu.top + 6, 2));- expect(- find.descendant(of: local, matching: find.text('office')),- findsOneWidget,- );- await capture(tester, fixture, 'machine-menu-${brightness.name}');- await key(tester, LogicalKeyboardKey.escape);- await tester.pumpAndSettle();- expect(local, findsNothing);- expect(_chooser, findsOneWidget);- await key(tester, LogicalKeyboardKey.escape);- await tester.pumpAndSettle();- expect(_chooser, findsNothing);- expect(_focused(tester, _field('project')), isTrue);- expect(fixture.closes, 0);- expect(fixture.app.launches, isEmpty);- expect(tester.takeException(), isNull);- });+ testWidgets(+ 'Repo search and header computer menus fit ${brightness.name}',+ (tester) async {+ final fixture = await _mount(+ tester,+ brightness: brightness,+ onBrowse: (_) {},+ );+ await tester.tap(_field('project'));+ await tester.pumpAndSettle();+ expect(fixture.box.field, NewHarnessField.projectMenu);+ expect(_query.hitTestable(), findsOneWidget);+ expect(_machine, findsNothing);+ final menu = tester.getRect(_chooser);+ expect(menu.width, greaterThanOrEqualTo(400));+ final hint = find.descendant(+ of: _query,+ matching: find.text('Search repos'),+ );+ expect(+ tester.renderObject<RenderParagraph>(hint).didExceedMaxLines,+ isFalse,+ );+ expect(menu.height, lessThan(280));+ expect(fixture.box.options.take(3).map((o) => o.title), [+ 'Open Folder',+ 'New Folder',+ 'GitHub',+ ]);+ await capture(tester, fixture, 'repo-menu-${brightness.name}');+ await key(tester, LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();+ expect(_focused(tester, _field('project')), isTrue);+ await tester.tap(_field('machine'));+ await tester.pumpAndSettle();+ final local = find.byKey(+ const ValueKey('new-harness-machine-option-review'),+ );+ expect(local, findsOneWidget);+ expect(_chooser, findsNothing);+ expect(+ tester.getRect(local).top,+ greaterThan(tester.getRect(_field('machine')).bottom),+ );+ expect(+ find.descendant(of: local, matching: find.text('office')),+ findsOneWidget,+ );+ await capture(tester, fixture, 'machine-menu-${brightness.name}');+ await key(tester, LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();+ expect(local, findsNothing);+ expect(_focused(tester, _field('machine')), isTrue);+ expect(fixture.closes, 0);+ expect(fixture.app.launches, isEmpty);+ expect(tester.takeException(), isNull);+ },+ );}for (final brightness in Brightness.values) {@@ -732,11 +729,11 @@ void main() {tester.renderObject<RenderParagraph>(hint).didExceedMaxLines,isFalse,);- expect(_machine.hitTestable(), findsOneWidget);+ expect(_machine, findsNothing);expect(tester.getRect(_chooser).right, lessThanOrEqualTo(880));expect(tester.getRect(_query).right,- lessThan(tester.getRect(_machine).left),+ lessThan(tester.getRect(_chooser).right),);await capture(tester, fixture, 'repo-menu-enlarged-${brightness.name}');await tester.enterText(_query, 'openharness');@@ -751,7 +748,7 @@ void main() {);}- testWidgets('Repo scopes folders to its machine and preserves the draft', (+ testWidgets('Header computer scopes repos and preserves the draft', (tester,) async {final fixture = await _mount(tester);@@ -770,20 +767,19 @@ void main() {await tester.enterText(_task, 'Keep my unsent task across machines');await tester.tap(_field('project'));await tester.pumpAndSettle();- expect(find.text('This Mac'), findsOneWidget);+ expect(_machine, findsNothing);expect(fixture.box.options.where((o) => !o.synthetic).every((o) => o.machineId == 'review'),isTrue,);-- // Tab reaches the machine control from search; arrows stay in its menu.- await key(tester, LogicalKeyboardKey.tab);- expect(_focused(tester, _machine), isTrue);+ // Shift-Tab leaves repo search for the preceding visible header control.+ await key(tester, LogicalKeyboardKey.tab, shift: true);+ expect(_chooser, findsNothing);+ expect(_focused(tester, _field('machine')), isTrue);await key(tester, LogicalKeyboardKey.enter);await tester.pumpAndSettle();- expect(fixture.box.field, NewHarnessField.projectMenu);expect(find.byKey(const ValueKey('new-harness-machine-option-remote')),findsOneWidget,@@ -791,8 +787,9 @@ void main() {await key(tester, LogicalKeyboardKey.arrowDown);await key(tester, LogicalKeyboardKey.enter);await tester.pumpAndSettle();- expect(fixture.box.field, NewHarnessField.projectMenu);expect(fixture.box.machineId, 'remote');+ await tester.tap(_field('project'));+ await tester.pumpAndSettle();expect(find.text('remote-repo'), findsOneWidget);expect(fixture.box.options@@ -808,20 +805,27 @@ void main() {await tester.pumpAndSettle();expect(_chooser, findsNothing);expect(_focused(tester, _field('project')), isTrue);- expect(find.text('remote-repo · Build server'), findsOneWidget);+ expect(+ find.descendant(+ of: _field('project'),+ matching: find.text('remote-repo'),+ ),+ findsOneWidget,+ );+ expect(+ find.descendant(+ of: _field('machine'),+ matching: find.text('Build server'),+ ),+ findsOneWidget,+ );expect(fixture.box.project.folder, '/srv/remote-repo');-- await tester.tap(_field('project'));- await tester.pumpAndSettle();- await tester.enterText(_query, 'remote');- await tester.tap(_machine);+ await tester.tap(_field('machine'));await tester.pumpAndSettle();await key(tester, LogicalKeyboardKey.escape);await tester.pumpAndSettle();- expect(fixture.box.field, NewHarnessField.projectMenu);- expect(fixture.box.query, 'remote');expect(fixture.box.machineId, 'remote');- await tester.tap(_machine);+ await tester.tap(_field('machine'));await tester.pumpAndSettle();await tester.tap(find.byKey(const ValueKey('new-harness-machine-option-review')),@@ -829,7 +833,6 @@ void main() {await tester.pumpAndSettle();expect(fixture.box.machineId, 'review');expect(fixture.box.project.folder, '/work/autonomous-harness');- expect(fixture.box.query, isEmpty);expect(fixture.box.task, 'Keep my unsent task across machines');expect(fixture.app.launches, isEmpty);expect(tester.takeException(), isNull);@@ -1026,13 +1029,8 @@ void main() {await tester.tap(recovery);}await tester.pumpAndSettle();- expect(_chooser, findsOneWidget);- expect(_machine, findsOneWidget);- expect(tester.getRect(_chooser).top, greaterThanOrEqualTo(24));- expect(- tester.getRect(_chooser).bottom,- lessThanOrEqualTo(tester.view.physicalSize.height - 24),- );+ expect(_chooser, findsNothing);+ expect(_machine, findsNothing);final remoteChoice = find.byKey(const ValueKey('new-harness-machine-option-remote'),);@@ -1045,6 +1043,8 @@ void main() {await tester.tap(remoteChoice);await tester.pumpAndSettle();expect(fixture.box.machineId, 'remote');+ await tester.tap(_field('project'));+ await tester.pumpAndSettle();final project = find.byKey(const ValueKey('new-harness-option-project:remote:/srv/recovery-repo',@@ -1128,6 +1128,7 @@ void main() {_close,_field('start'),_field('agent'),+ _field('machine'),_field('project'),_task,];@@ -1163,7 +1164,7 @@ void main() {'Repo, office:/work/autonomous-harness','Model, OpenAI','Approvals, Auto-approve',- 'Profile, Default',+ 'Account, Default account',]) {final node = tester.getSemantics(find.bySemanticsLabel(label));expect(node.getSemanticsData().hasAction(ui.SemanticsAction.tap), isTrue);@@ -1276,6 +1277,8 @@ void main() {_field('profile'),_field('branch'),]) {+ await tester.ensureVisible(trigger);+ await tester.pumpAndSettle();await tester.tap(trigger);await tester.pumpAndSettle();expect(_chooser, findsOneWidget);@@ -1289,7 +1292,7 @@ void main() {}await tester.tapAt(const Offset(10, 10));await tester.pumpAndSettle();- expect(fixture.closes, 1);+ expect(fixture.closes, 0);expect(fixture.box.draft.task, draft);},);@@ -1611,6 +1614,13 @@ void main() {await _focus(tester, control);await tester.ensureVisible(control);await tester.pumpAndSettle();+ if (tester.widget(control).key !=+ const ValueKey('new-harness-field-start')) {+ expect(+ tester.getRect(control).center.dy,+ closeTo(tester.getRect(_field('model')).center.dy, 1),+ );+ }expect(control.hitTestable(), findsOneWidget);final rect = tester.getRect(control);expect(rect.left, greaterThanOrEqualTo(24));@@ -1626,9 +1636,8 @@ void main() {fixture,'narrow-project-${brightness.name}-$scale',);- await tester.tap(_field('project'));- await tester.pumpAndSettle();- await tester.tap(_machine);+ await tester.ensureVisible(_field('machine'));+ await tester.tap(_field('machine'));await tester.pumpAndSettle();final local = find.byKey(const ValueKey('new-harness-machine-option-review'),diff --git a/desktop/test/desktop_dialog_interaction_test.dart b/desktop/test/desktop_dialog_interaction_test.dartindex b50704332..caff04ae9 100644--- a/desktop/test/desktop_dialog_interaction_test.dart+++ b/desktop/test/desktop_dialog_interaction_test.dart@@ -7,6 +7,7 @@ import 'package:flutter_test/flutter_test.dart';import 'package:harness/shortcuts/app_keymap.dart';import 'package:harness/shortcuts/keymap_host.dart';import 'package:harness/state/app_state.dart';+import 'package:harness/state/harness_attachments.dart';import 'package:harness/state/new_harness.dart';import 'package:harness/terminal/terminal_binary.dart';import 'package:harness/widgets/desktop_search_panel.dart';@@ -219,6 +220,9 @@ const _nativeSmokeJourneys = {'Shift-Tab leaves a chooser without applying its highlight','Escape closes only the chooser and returns to its control','outside click closes only the chooser and returns to its control',+ 'outside clicks keep the composer open before and after editing',+ 'composer closes on Escape and opens with an empty task',+ 'composer closes on Close and opens with an empty task','Cmd-P and Cmd-N replace each other without reviving cancelled edits','focused Cmd-P preview control owns Return','Return on Close search restores terminal focus without opening a result',@@ -349,7 +353,7 @@ void main({bool nativeSmoke = false}) {ValueKey(reverse? 'new-harness-field-start'- : 'new-harness-field-project',+ : 'new-harness-field-machine',),),),@@ -394,6 +398,17 @@ void main({bool nativeSmoke = false}) {reason: 'Cancel returns to the control that opened the chooser.',);expect(workspace.starts, isEmpty);+ expect(workspace.input, isEmpty);+ if (dismissal == 'Escape') {+ await key(tester, LogicalKeyboardKey.escape);+ expect(_form, findsNothing);+ } else {+ await tester.tapAt(const Offset(10, 400));+ await tester.pumpAndSettle();+ expect(_form, findsOneWidget);+ expect(_box(tester), same(original));+ expect(original.task, task);+ }});}@@ -435,22 +450,12 @@ void main({bool nativeSmoke = false}) {await tester.enterText(_task, 'Inspect $field without losing this task');final box = _box(tester);final task = box.task;- final opener = find.byKey(- ValueKey(- field == 'machine'- ? 'new-harness-field-project'- : 'new-harness-field-$field',- ),- );+ final opener = find.byKey(ValueKey('new-harness-field-$field'));+ await tester.ensureVisible(opener);+ await tester.pumpAndSettle();await tester.tap(opener);await tester.pump();- if (field == 'machine') {- await tester.tap(- find.byKey(const ValueKey('new-harness-repo-machine')),- );- await tester.pump();- }- expect(_chooser, findsOneWidget);+ expect(_chooser, field == 'machine' ? findsNothing : findsOneWidget);await key(tester, LogicalKeyboardKey.enter, cmd: true);expect(workspace.starts,@@ -459,11 +464,6 @@ void main({bool nativeSmoke = false}) {);await tester.tapAt(const Offset(10, 400));await tester.pump();- if (field == 'machine') {- expect(_chooser, findsOneWidget);- await tester.tapAt(const Offset(10, 400));- await tester.pump();- }expect(_form, findsOneWidget);expect(_chooser, findsNothing);expect(_box(tester), same(box));@@ -563,7 +563,36 @@ void main({bool nativeSmoke = false}) {);}- for (final dismissal in ['Escape', 'outside click']) {+ journey('outside clicks keep the composer open before and after editing', (+ tester,+ ) async {+ final workspace = await _mount(tester);+ await _new(tester);+ final original = _box(tester);+ const task = 'Keep this task while I click beside the form';+ for (final editing in [false, true]) {+ if (editing) {+ await tester.enterText(_task, task);+ original.attachments!.add([+ HarnessAttachment('notes.txt', Uint8List.fromList([65])),+ ]);+ await tester.pump();+ }+ for (var click = 0; click < 3; click++) {+ await tester.tapAt(const Offset(10, 400));+ await tester.pumpAndSettle();+ expect(_form, findsOneWidget);+ expect(_box(tester), same(original));+ expect(original.task, editing ? task : isEmpty);+ expect(original.attachments!.files, hasLength(editing ? 1 : 0));+ expect(_ownsFocus(tester, _task), isTrue);+ }+ }+ expect(workspace.starts, isEmpty);+ expect(workspace.input, isEmpty);+ });++ for (final dismissal in ['Escape', 'Close']) {journey('composer closes on $dismissal and opens with an empty task', (tester,) async {@@ -571,39 +600,45 @@ void main({bool nativeSmoke = false}) {await _new(tester);const task = 'Unfinished review with a meaningful draft';await tester.enterText(_task, task);+ _box(tester).attachments!.add([+ HarnessAttachment('notes.txt', Uint8List.fromList([65])),+ ]);+ await tester.pump();if (dismissal == 'Escape') {await key(tester, LogicalKeyboardKey.escape);} else {- await tester.tapAt(const Offset(10, 400));+ await tester.tap(find.byKey(const ValueKey('new-harness-close')));await tester.pump();}expect(_form, findsNothing);await _new(tester);expect(_box(tester).task, isEmpty);+ expect(_box(tester).attachments!.files, isEmpty);expect(tester.widget<TextField>(_task).controller!.text, isEmpty);expect(_ownsFocus(tester, _task), isTrue);});}- journey('Cmd-P and Cmd-N replace each other without reviving cancelled edits', (- tester,- ) async {- final workspace = await _mount(tester, withTerminal: true);- await _new(tester);- await tester.enterText(_task, 'Resume after checking existing work');- await openLaunchRow(tester, 'agent');- await key(tester, LogicalKeyboardKey.keyP, cmd: true);- expect(_form, findsNothing);- expect(_search, findsOneWidget);- expect(_ownsFocus(tester, _search), isTrue);- await _new(tester);- expect(_search, findsNothing);- expect(_chooser, findsNothing);- expect(_box(tester).task, isEmpty);- expect(_ownsFocus(tester, _task), isTrue);- expect(workspace.input, isEmpty);- expect(workspace.starts, isEmpty);- });+ journey(+ 'Cmd-P and Cmd-N replace each other without reviving cancelled edits',+ (tester) async {+ final workspace = await _mount(tester, withTerminal: true);+ await _new(tester);+ await tester.enterText(_task, 'Resume after checking existing work');+ await openLaunchRow(tester, 'agent');+ await key(tester, LogicalKeyboardKey.keyP, cmd: true);+ expect(_form, findsNothing);+ expect(_search, findsOneWidget);+ expect(_ownsFocus(tester, _search), isTrue);+ await _new(tester);+ expect(_search, findsNothing);+ expect(_chooser, findsNothing);+ expect(_box(tester).task, isEmpty);+ expect(_ownsFocus(tester, _task), isTrue);+ expect(workspace.input, isEmpty);+ expect(workspace.starts, isEmpty);+ },+ );journey('long mixed mouse and keyboard setup keeps the draft and dismisses one level',@@ -641,8 +676,17 @@ void main({bool nativeSmoke = false}) {await tester.tap(opener);}await tester.pumpAndSettle();- expect(_chooser, findsOneWidget);- expect(_ownsFocus(tester, _query), isTrue);+ if (tester.widget(opener).key ==+ const ValueKey('new-harness-field-machine')) {+ expect(_chooser, findsNothing);+ expect(+ find.byKey(const ValueKey('new-harness-machine-option-m')),+ findsOneWidget,+ );+ } else {+ expect(_chooser, findsOneWidget);+ expect(_ownsFocus(tester, _query), isTrue);+ }expectStableDraft();}@@ -749,24 +793,21 @@ void main({bool nativeSmoke = false}) {expectStableDraft();final machineControl = find.byKey(- const ValueKey('new-harness-field-project'),+ const ValueKey('new-harness-field-machine'),);await open(machineControl, keyboard: keyboard);- await tester.tap(- find.byKey(const ValueKey('new-harness-repo-machine')),- );await tester.pumpAndSettle();- expect(original.field, NewHarnessField.projectMenu);expect(find.byKey(const ValueKey('new-harness-machine-option-m')),findsOneWidget,);+ expect(_chooser, findsNothing);await key(tester, LogicalKeyboardKey.escape);await tester.pumpAndSettle();- expect(_chooser, findsOneWidget);- await tester.tapAt(const Offset(10, 400));- await tester.pumpAndSettle();- expect(_chooser, findsNothing);+ expect(+ find.byKey(const ValueKey('new-harness-machine-option-m')),+ findsNothing,+ );expect(_ownsFocus(tester, machineControl), isTrue);expectStableDraft();}@@ -829,7 +870,7 @@ void main({bool nativeSmoke = false}) {for (final (command, field) in [('creation.agent', NewHarnessField.harness),('creation.project', NewHarnessField.projectMenu),- ('creation.project_machine', NewHarnessField.projectMenu),+ ('creation.project_machine', NewHarnessField.launch),]) {journey('advertised $command remap opens its chooser from the task', (tester,@@ -843,7 +884,10 @@ void main({bool nativeSmoke = false}) {await tester.enterText(_task, 'Direct keyboard access to configuration');await key(tester, LogicalKeyboardKey.keyG, ctrl: true, alt: true);await tester.pumpAndSettle();- expect(_chooser, findsOneWidget);+ expect(+ _chooser,+ command == 'creation.project_machine' ? findsNothing : findsOneWidget,+ );expect(_box(tester).field, field);if (command == 'creation.project_machine') {expect(@@ -880,8 +924,8 @@ void main({bool nativeSmoke = false}) {await _mount(tester, nativeMenus: true);await _new(tester);await _nativeCommand(tester, 'creation.project_machine');- expect(_chooser, findsOneWidget);- expect(_box(tester).field, NewHarnessField.projectMenu);+ expect(_chooser, findsNothing);+ expect(_box(tester).field, NewHarnessField.launch);expect(find.byKey(const ValueKey('new-harness-machine-option-m')),findsOneWidget,diff --git a/desktop/test/desktop_new_harness_edge_test.dart b/desktop/test/desktop_new_harness_edge_test.dartindex 15be565d1..048b3f248 100644--- a/desktop/test/desktop_new_harness_edge_test.dart+++ b/desktop/test/desktop_new_harness_edge_test.dart@@ -364,24 +364,19 @@ void main() {for (final withKeymap in [false, true]) {testWidgets(- 'Repo machine keyboard traversal works with keymap=$withKeymap',+ 'Header computer keyboard traversal works with keymap=$withKeymap',(tester) async {final fixture = await _mount(tester, withKeymap: withKeymap);await tester.tap(find.byKey(const ValueKey('new-harness-field-project')),);await tester.pumpAndSettle();- final machine = find.byKey(const ValueKey('new-harness-repo-machine'));- bool queryFocused() =>- tester.widget<TextField>(_query).focusNode!.hasFocus;- expect(queryFocused(), isTrue);- await key(tester, LogicalKeyboardKey.tab);- expect(queryFocused(), isFalse);+ expect(tester.widget<TextField>(_query).focusNode!.hasFocus, isTrue);await key(tester, LogicalKeyboardKey.tab, shift: true);- expect(queryFocused(), isTrue);- await key(tester, LogicalKeyboardKey.tab);+ expect(_query, findsNothing);+ final machine = find.byKey(const ValueKey('new-harness-field-machine'));expect(tester.widget<DesktopPill>(machine).focusNode!.hasFocus, isTrue);- await key(tester, LogicalKeyboardKey.arrowRight);+ await key(tester, LogicalKeyboardKey.enter);await tester.pumpAndSettle();final choice = find.byKey(const ValueKey('new-harness-machine-option-machine'),@@ -392,8 +387,8 @@ void main() {.dismissFromOutside();await tester.pumpAndSettle();expect(choice, findsNothing);- expect(_query, findsOneWidget);- // Repeated activation toggles the cascade without closing Repo.+ expect(_query, findsNothing);+ expect(tester.widget<DesktopPill>(machine).focusNode!.hasFocus, isTrue);await tester.tap(machine);await tester.pumpAndSettle();expect(choice, findsOneWidget);@@ -402,7 +397,15 @@ void main() {expect(choice, findsNothing);await key(tester, LogicalKeyboardKey.tab);await tester.pumpAndSettle();- expect(_query, findsNothing);+ expect(+ tester+ .widget<DesktopPill>(+ find.byKey(const ValueKey('new-harness-field-project')),+ )+ .focusNode!+ .hasFocus,+ isTrue,+ );expect(fixture.closes, 0);expect(fixture.app.launches, isEmpty);},@@ -421,9 +424,7 @@ void main() {),)..nodeOnline = true;fixture.app.notifyListeners();- await tester.tap(find.byKey(const ValueKey('new-harness-field-project')));- await tester.pumpAndSettle();- await tester.tap(find.byKey(const ValueKey('new-harness-repo-machine')));+ await tester.tap(find.byKey(const ValueKey('new-harness-field-machine')));await tester.pumpAndSettle();final choice = find.byKey(const ValueKey('new-harness-machine-option-other'),@@ -437,33 +438,28 @@ void main() {expect(fixture.app.launches, isEmpty);});- testWidgets('Escape closes the chooser before the composer close button', (- tester,- ) async {- final fixture = await _mount(tester);- await tester.tap(find.byKey(const ValueKey('new-harness-field-project')));- await tester.pumpAndSettle();- await tester.tap(find.byKey(const ValueKey('new-harness-repo-machine')));- await tester.pumpAndSettle();- expect(- find.byKey(const ValueKey('new-harness-machine-option-machine')),- findsOneWidget,- );- expect(fixture.box.field, NewHarnessField.projectMenu);- fixture.box.warn('Choose an installed agent to continue.');- await tester.pumpAndSettle();- expect(find.text('Choose an installed agent to continue.'), findsWidgets);- await key(tester, LogicalKeyboardKey.escape);- await tester.pumpAndSettle();- expect(fixture.box.field, NewHarnessField.projectMenu);- expect(_query, findsOneWidget);- await key(tester, LogicalKeyboardKey.escape);- await tester.pumpAndSettle();- expect(_query, findsNothing);- expect(fixture.closes, 0);- await tester.tap(find.byKey(const ValueKey('new-harness-close')));- expect(fixture.closes, 1);- });+ testWidgets(+ 'Escape closes the computer menu before the composer close button',+ (tester) async {+ final fixture = await _mount(tester);+ await tester.tap(find.byKey(const ValueKey('new-harness-field-machine')));+ await tester.pumpAndSettle();+ final choice = find.byKey(+ const ValueKey('new-harness-machine-option-machine'),+ );+ expect(choice, findsOneWidget);+ fixture.box.warn('Choose an installed agent to continue.');+ await tester.pumpAndSettle();+ expect(find.text('Choose an installed agent to continue.'), findsWidgets);+ await key(tester, LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();+ expect(choice, findsNothing);+ expect(_query, findsNothing);+ expect(fixture.closes, 0);+ await tester.tap(find.byKey(const ValueKey('new-harness-close')));+ expect(fixture.closes, 1);+ },+ );testWidgets('Change machine backs to the same nested folder prompt', (tester,@@ -521,8 +517,6 @@ void main() {await tester.enterText(_task, 'Keep my review notes');await tester.tap(find.byKey(const ValueKey('new-harness-field-project')));await tester.pumpAndSettle();- await tester.tap(find.byKey(const ValueKey('new-harness-repo-machine')));- await tester.pumpAndSettle();final surface = tester.getRect(find.byKey(const ValueKey('new-harness-surface')),);@@ -533,9 +527,6 @@ void main() {expect(chooser.contains(outside), isFalse);await tester.tapAt(outside);await tester.pumpAndSettle();- expect(_query, findsOneWidget);- await tester.tapAt(outside);- await tester.pumpAndSettle();expect(_query, findsNothing);expect(fixture.closes, 0);expect(fixture.box.task, 'Keep my review notes');@@ -634,7 +625,7 @@ void main() {.widget<Semantics>(find.byKey(const ValueKey('new-harness-choices'))).properties.label,- 'Codex profile',+ 'Codex account',);expect(find.text('Codex profile'), findsNothing);expect(diff --git a/desktop/test/harness_placement_test.dart b/desktop/test/harness_placement_test.dartindex 8c9da10a4..ce2521c4c 100644--- a/desktop/test/harness_placement_test.dart+++ b/desktop/test/harness_placement_test.dart@@ -279,6 +279,21 @@ void main() {await tester.sendKeyEvent(LogicalKeyboardKey.escape);} else {await tester.tapAt(const Offset(4, 10));+ await tester.pumpAndSettle();+ expect(find.byType(NewHarnessForm), findsOneWidget);+ expect(+ box.task,+ ' Review before changing anything\nKeep the patch small ',+ );+ expect(box.mode, 'readOnly');+ expect(box.draft.profileChosen, isTrue);+ expect(box.draft.profile, isNull);+ expect(+ box.project.repository?.url,+ 'https://github.com/acme/terminal-tools.git',+ );+ expect(connection.requests, isEmpty);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);}await tester.pumpAndSettle();expect(find.byType(NewHarnessForm), findsNothing);