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.

Fix pane removal layouts and Harness Monitor dismissal (#558)

Deeaf1ef7c031e6
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.md
index ae51be2cd..dc16c0b7a 100644
--- a/desktop/CLAUDE.md
+++ b/desktop/CLAUDE.md
@@ -252,7 +252,9 @@ Per-machine runtime state is `MachineState` (connection status, transport mode,
from `node_status` pushes — distinct from our own socket status, pending offline agent, turn activity).
Explicit pane/tab Close uses `requestClosePane` / `requestCloseSwarm` and closes the session across
-the global workspace. An owned idle session saves its native conversation and terminal snapshot
+the global workspace. Harness Monitor is the exception: closing its reusable dashboard dismisses
+the view immediately, even offline, and keeps its assistant available for the next open.
+An owned idle session saves its native conversation and terminal snapshot
before releasing its process, regardless of other viewers. A ready, unused Claude/Codex chat with
an empty composer also closes directly, saving its terminal snapshot without requiring a native
conversation. Missing activity evidence for an existing chat remains unknown. Working,
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index cf8417aae..4dc178176 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1730,8 +1730,8 @@ class AppNotifier extends ChangeNotifier {
}
}
- /// Explicit user Close. Layout cleanup, tab switching, sign-out and moving a
- /// tile continue using their existing view-only operations.
+ /// Explicit user Close. The reusable Harness Monitor dismisses its views;
+ /// ordinary sessions are saved and stopped before their views close.
Future<void> requestCloseSwarm(String id) {
final tab = swarms.where((s) => s.id == id).firstOrNull;
if (tab == null) return Future.value();
@@ -1782,6 +1782,9 @@ class AppNotifier extends ChangeNotifier {
final agent = machine?.agents.where((a) => a.id == id).firstOrNull;
if (machine?.machine.isShared == true ||
agent == null ||
+ // The monitor is a reusable dashboard, including its assistant.
+ // Dismissing it must work even when its machine cannot be reached.
+ agent.dsh == harnessMonitorId ||
agent.isStopped ||
!agent.terminalAvailable ||
!agent.closeSupported) {
@@ -2064,24 +2067,43 @@ class AppNotifier extends ChangeNotifier {
agentId: agent.agentId,
)..composerVisible = agent.composerVisible);
if (!target.panes.contains(pane)) {
+ final count = target.panes.length;
+ final defaultPreset = PanePreset.defaultFor(count);
+ final defaultTiles = defaultPreset == null
+ ? null
+ : PaneArrangement(defaultPreset.tilesFor(count)).fillRowEnds().tiles;
+ // A close now leaves the default layout. The desk may have frozen it as
+ // manual geometry; either form still permits undo until the user edits it.
final restoreManual =
agent.manualLayout != null &&
listEquals(
target.panes.map((p) => (p.machineId, p.agentId)).toList(),
- agent.remainingAgents,
+ agent.remainingReadingOrder,
) &&
- (target.panes.length == 1 ||
- listEquals(
- target.manualLayout?.tiles,
- agent.manualLayout!.remove(agent.index)?.tiles,
- ));
+ !target.presets.containsKey(count) &&
+ target.paneSizes.entries
+ .where((entry) => entry.key.startsWith('$count:'))
+ .every(
+ (entry) =>
+ entry.key == '$count:manual' &&
+ listEquals(entry.value.tiles, defaultTiles),
+ );
if (restoreManual) {
- target.pinnedSlots.updateAll(
- (_, slot) => slot >= agent.index ? slot + 1 : slot,
+ // The old split's rectangles still address the original list order.
+ target.panes.sort(
+ (a, b) => agent.remainingAgents
+ .indexOf((a.machineId, a.agentId))
+ .compareTo(
+ agent.remainingAgents.indexOf((b.machineId, b.agentId)),
+ ),
);
}
target.panes.insert(agent.index.clamp(0, target.panes.length), pane);
if (restoreManual) {
+ final members = target.panes;
+ target.pinnedSlots.updateAll(
+ (id, _) => members.indexWhere((p) => p.id == id),
+ );
target.savePaneSizes(
'${target.panes.length}:manual',
agent.manualLayout!,
@@ -12217,17 +12239,6 @@ class AppNotifier extends ChangeNotifier {
return false;
}
source.remove(pane);
- // The tab left behind re-tiles. `Swarm.remove` keeps the shape by carrying
- // the manual layout down a tile — right when a pane CLOSES, because the
- // split was drawn around the tiles that remain. A tile that left for
- // another tab is not that: what is left here is a different set, and
- // holding the old proportions leaves it visibly lopsided. A layout chosen
- // outright in the Layout palette still stands; only the dragged sizes go.
- source.paneSizes.removeWhere(
- (key, _) => key.startsWith('${source.panes.length}:'),
- );
- source.arranged = null;
- source.arrangedKey = null;
// A harness's viewer lives beside its terminal, so it travels with it —
// the same rule `closePane` keeps when the terminal goes.
final viewers = <TerminalPane>[];
diff --git a/desktop/lib/state/swarm.dart b/desktop/lib/state/swarm.dart
index 2e787a9f7..5f453ea97 100644
--- a/desktop/lib/state/swarm.dart
+++ b/desktop/lib/state/swarm.dart
@@ -100,6 +100,24 @@ class Swarm {
PaneArrangement? get manualLayout => paneSizes['${panes.length}:manual'];
+ List<TerminalPane> get panesInReadingOrder {
+ final ordered = panes.toList();
+ final layout = arranged?.tiles.length == panes.length
+ ? arranged
+ : manualLayout;
+ if (layout == null || layout.tiles.length != panes.length) return ordered;
+ // Splits insert beside their source in the list, which may differ from
+ // the visible order. Read each row left to right before reflowing.
+ final tiles = {
+ for (var i = 0; i < panes.length; i++) panes[i]: layout.tiles[i],
+ };
+ ordered.sort((a, b) {
+ final row = tiles[a]!.top.compareTo(tiles[b]!.top);
+ return row != 0 ? row : tiles[a]!.left.compareTo(tiles[b]!.left);
+ });
+ return ordered;
+ }
+
void savePaneSizes(String key, PaneArrangement arrangement) {
paneSizes[key] = arrangement;
while (paneSizes.length > 64) {
@@ -108,9 +126,13 @@ class Swarm {
}
void remove(TerminalPane pane) {
- final index = panes.indexOf(pane);
- if (index < 0) return;
+ if (!panes.contains(pane)) return;
final manual = manualLayout;
+ final ordered = panesInReadingOrder;
+ panes
+ ..clear()
+ ..addAll(ordered);
+ final index = panes.indexOf(pane);
panes.removeAt(index);
// Layouts are kept per pane count, so the harness split for a viewer and
// its terminal would otherwise wait for the next two tiles of any kind.
@@ -119,20 +141,17 @@ class Swarm {
identical(manual, PaneArrangement.viewerBesideTerminal)) {
paneSizes.remove('2:manual');
}
- if (manual != null && panes.length > 1) {
- final next = manual.remove(index);
- if (next == null) {
- paneSizes.remove('${panes.length}:manual');
- } else {
- savePaneSizes('${panes.length}:manual', next);
- }
- }
- if (manual != null) {
- pinnedSlots.updateAll((_, slot) => slot > index ? slot - 1 : slot);
- }
+ // Every removal returns to the default for the remaining count, including
+ // when that count has an older preset or dragged proportions saved.
+ presets.remove(panes.length);
+ paneSizes.removeWhere((key, _) => key.startsWith('${panes.length}:'));
+ pinnedSlots.remove(pane.id);
+ // Keep pins attached to their panes without undoing the visible order.
+ pinnedSlots.updateAll((id, _) => panes.indexWhere((p) => p.id == id));
arranged = null;
arrangedKey = null;
- pinnedSlots.remove(pane.id);
+ arrangedMinimum = null;
+ gridColumns = null;
if (focusedPaneId == pane.id) {
focusedPaneId = panes.isEmpty
? null
@@ -203,6 +222,10 @@ class ClosedAgent extends ClosedWork {
for (final other in swarm.panes)
if (other != pane) (other.machineId, other.agentId),
]),
+ remainingReadingOrder = List.unmodifiable([
+ for (final other in swarm.panesInReadingOrder)
+ if (other != pane) (other.machineId, other.agentId),
+ ]),
zoomed = swarm.zoomedPaneId == pane.id;
final String swarmId, swarmName, machineId, machineName, agentId, name;
@@ -212,6 +235,7 @@ class ClosedAgent extends ClosedWork {
final int? pinnedSlot;
final PaneArrangement? manualLayout;
final List<(String, String?)> remainingAgents;
+ final List<(String, String?)> remainingReadingOrder;
}
/// Terminal buffers and controllers are released normally; a reopened view
diff --git a/desktop/test/desk_sync_test.dart b/desktop/test/desk_sync_test.dart
index 93d43c34b..cf1ab9ed6 100644
--- a/desktop/test/desk_sync_test.dart
+++ b/desktop/test/desk_sync_test.dart
@@ -78,6 +78,52 @@ void main() {
setUpAll(() async {
if (captureDir != null) await loadPreviewFonts();
});
+ test(
+ 'closing syncs the default layout and reopening restores split order',
+ () async {
+ final api = _DeskApi();
+ final app = createApp()..api = api;
+ addTearDown(app.dispose);
+ await app.deskStartForTest();
+ for (var i = 0; i < 5; i++) {
+ await app.addAgentToSwarm('m', 'a$i');
+ }
+ final work = app.activeSwarm;
+ final panes = work.panes.toList();
+ final split = PaneArrangement(const [
+ Rect.fromLTRB(0, 0, .5, .25),
+ Rect.fromLTRB(0, .25, .5, .5),
+ Rect.fromLTRB(.5, 0, 1, .5),
+ Rect.fromLTRB(0, .5, .5, 1),
+ Rect.fromLTRB(.5, .5, 1, 1),
+ ]);
+ work.savePaneSizes('5:manual', split);
+ app.togglePinPane(panes[4].id);
+
+ await app.closePane(panes[3].id);
+ await app.deskFlushForTest();
+
+ expect(work.panes.map((p) => p.agentId), ['a0', 'a2', 'a1', 'a4']);
+ expect(work.manualLayout!.tiles, PanePreset.quad.tilesFor(4));
+ final synced = api.doc!.tabs.singleWhere((t) => t.id == work.id);
+ expect(synced.panes.map((p) => p.agentId), ['a0', 'a2', 'a1', 'a4']);
+ expect(synced.layout!.sizes['4:manual'], work.manualLayout!.toJson());
+
+ expect(app.reopenClosed(), isTrue);
+ expect(work.panes.map((p) => p.agentId), ['a0', 'a1', 'a2', 'a3', 'a4']);
+ expect(work.manualLayout!.tiles, split.tiles);
+ expect(app.pinnedSlotFor(panes[4]), 4);
+ await app.deskFlushForTest();
+ expect(
+ api.doc!.tabs
+ .singleWhere((t) => t.id == work.id)
+ .layout!
+ .sizes['5:manual'],
+ split.toJson(),
+ );
+ },
+ );
+
testWidgets(
'shared slots survive viewport, focus and zoom changes without writes or terminal remounts',
(tester) async {
diff --git a/desktop/test/harness_monitor_test.dart b/desktop/test/harness_monitor_test.dart
index 363421120..b3694cc94 100644
--- a/desktop/test/harness_monitor_test.dart
+++ b/desktop/test/harness_monitor_test.dart
@@ -1,5 +1,6 @@
import 'dart:async';
+import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -129,6 +130,33 @@ void main() {
expect(connection.creations, hasLength(1));
});
+ test('the monitor closes offline and reopens the same assistant', () async {
+ await app.harnessMonitor.open();
+ final tab = app.activeSwarm;
+ final owner = app.stateOf('m')!;
+ final agent = owner.agents.single;
+ owner
+ ..connectionStatus = ConnectionStatus.disconnected
+ ..nodeOnline = false;
+
+ await app.requestCloseSwarm(tab.id);
+
+ expect(app.swarms, isNot(contains(tab)));
+ expect(app.allPanes, isEmpty);
+ expect(connection.closes, isEmpty);
+ expect(owner.agents.single, same(agent));
+ expect(owner.agents.single.isStopped, isFalse);
+
+ owner
+ ..connectionStatus = ConnectionStatus.connected
+ ..nodeOnline = true;
+ expect(await app.harnessMonitor.open(), isNull);
+ expect(app.activeSwarm.name, harnessMonitorName);
+ expect(app.panes.singleWhere((p) => !p.isWeb).agentId, agent.id);
+ expect(connection.creations, hasLength(1));
+ expect(app.resumes, 0);
+ });
+
test(
'Open refreshes the owning machine and reveals an existing tab',
() async {
@@ -215,6 +243,31 @@ void main() {
await tester.pumpAndSettle();
expect(app.zoomedPaneId, viewer.id);
expect(tester.takeException(), isNull);
+ final monitorTab = app.activeSwarm;
+ if (nativeTabs) {
+ tester.binding.defaultBinaryMessenger.handlePlatformMessage(
+ channel.name,
+ const StandardMethodCodec().encodeMethodCall(
+ MethodCall('close', {'id': monitorTab.id}),
+ ),
+ (_) {},
+ );
+ } else {
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: const Offset(1200, 700));
+ await mouse.moveTo(
+ tester.getCenter(find.byKey(ValueKey(monitorTab.id))),
+ );
+ await tester.pump();
+ await tester.tap(
+ find.byKey(ValueKey('tab-close:${monitorTab.id}')).hitTestable(),
+ );
+ await mouse.removePointer();
+ }
+ await tester.pumpAndSettle();
+ expect(app.swarms, isNot(contains(monitorTab)));
+ expect(connection.closes, isEmpty);
+ expect(find.text('OK'), findsNothing);
await tester.pumpWidget(const SizedBox());
});
}
diff --git a/desktop/test/pane_defaults_test.dart b/desktop/test/pane_defaults_test.dart
index 8aa587427..dbd507c58 100644
--- a/desktop/test/pane_defaults_test.dart
+++ b/desktop/test/pane_defaults_test.dart
@@ -3,6 +3,8 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/state/pane_arrangement.dart';
+import 'package:harness/state/pane_preset.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'package:harness/widgets/pane_grid.dart';
import 'package:xterm/xterm.dart';
@@ -14,6 +16,131 @@ import 'swarm_screen_test.dart' show terminal;
import 'swarm_state_test.dart' show createApp, MemoryStore;
void main() {
+ testWidgets(
+ 'closing split panes resets defaults in visible order and retains terminals',
+ (tester) async {
+ final store = MemoryStore();
+ final app = createApp(store: store, connected: true);
+ final frames = <TerminalBinaryFrame>[];
+ final panes = [
+ for (var i = 0; i < 5; i++)
+ app.adoptSessionForTest(terminal('a$i', frames)),
+ ];
+ final tab = app.activeSwarm;
+ // A downward split puts a1 before a2 in the list, but a2 is beside a0.
+ tab.savePaneSizes(
+ '5:manual',
+ PaneArrangement(const [
+ Rect.fromLTRB(0, 0, .5, .25),
+ Rect.fromLTRB(0, .25, .5, .5),
+ Rect.fromLTRB(.5, 0, 1, .5),
+ Rect.fromLTRB(0, .5, .5, 1),
+ Rect.fromLTRB(.5, .5, 1, 1),
+ ]),
+ );
+ // Old choices for the smaller counts must not reappear on close.
+ for (final count in [2, 3, 4]) {
+ tab.presets[count] = PanePreset.rows;
+ final saved = PaneArrangement(PanePreset.rows.tilesFor(count));
+ tab.savePaneSizes('$count:manual', saved);
+ tab.savePaneSizes('$count:rows:0:rows', saved);
+ }
+ app.togglePinPane(panes[4].id);
+ app.focusPane(panes[2].id);
+ await mountWide(tester, app);
+ final retained = {
+ for (final pane in panes)
+ pane: tester.element(
+ find.descendant(
+ of: find.byKey(pane.cellKey),
+ matching: find.byType(TerminalView),
+ ),
+ ),
+ };
+ final sessions = {for (final pane in panes) pane: pane.session};
+ const shapes = [
+ [
+ Rect.fromLTRB(0, 0, .5, .5),
+ Rect.fromLTRB(.5, 0, 1, .5),
+ Rect.fromLTRB(0, .5, .5, 1),
+ Rect.fromLTRB(.5, .5, 1, 1),
+ ],
+ [
+ Rect.fromLTRB(0, 0, 1 / 3, 1),
+ Rect.fromLTRB(1 / 3, 0, 2 / 3, 1),
+ Rect.fromLTRB(2 / 3, 0, 1, 1),
+ ],
+ [Rect.fromLTRB(0, 0, .5, 1), Rect.fromLTRB(.5, 0, 1, 1)],
+ [Rect.fromLTRB(0, 0, 1, 1)],
+ ];
+ const orders = [
+ [0, 2, 1, 4],
+ [0, 1, 4],
+ [0, 4],
+ [0],
+ ];
+ const closing = [3, 2, 1, 4];
+ const focused = [2, 1, 4, 0];
+ for (var step = 0; step < closing.length; step++) {
+ await app.closePane(panes[closing[step]].id);
+ await tester.pump(const Duration(milliseconds: 150));
+ expect(app.panes, [for (final i in orders[step]) panes[i]]);
+ expect(app.focusedPaneId, panes[focused[step]].id);
+ expect(
+ app.presetFor(app.panes.length),
+ PanePreset.defaultFor(app.panes.length),
+ );
+ expect(tab.manualLayout, isNull);
+ final grid = tester.getRect(find.byType(PaneGrid));
+ for (var i = 0; i < app.panes.length; i++) {
+ final pane = app.panes[i];
+ final rect = tester.getRect(find.byKey(pane.cellKey));
+ final want = shapes[step][i];
+ expect((rect.left - grid.left) / grid.width, closeTo(want.left, .02));
+ expect((rect.top - grid.top) / grid.height, closeTo(want.top, .02));
+ expect(
+ (rect.right - grid.left) / grid.width,
+ closeTo(want.right, .02),
+ );
+ expect(
+ (rect.bottom - grid.top) / grid.height,
+ closeTo(want.bottom, .02),
+ );
+ expect(pane.session, same(sessions[pane]));
+ expect(
+ tester.element(
+ find.descendant(
+ of: find.byKey(pane.cellKey),
+ matching: find.byType(TerminalView),
+ ),
+ ),
+ same(retained[pane]),
+ );
+ }
+ if (step < 3) expect(app.pinnedSlotFor(panes[4]), app.panes.length - 1);
+ frames.clear();
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
+ await tester.pump(const Duration(milliseconds: 10));
+ expect(frames.single.streamId, app.focusedPane!.session!.streamId);
+ expect(tester.takeException(), isNull);
+ await app.flushPaneLayout();
+ final restored = createApp(store: store);
+ await restored.restorePaneLayoutForTest();
+ expect(restored.panes.map((pane) => pane.agentId), [
+ for (final i in orders[step]) 'a$i',
+ ]);
+ expect(restored.activeSwarm.manualLayout, isNull);
+ expect(
+ restored.presetFor(app.panes.length),
+ PanePreset.defaultFor(app.panes.length),
+ );
+ restored.dispose();
+ }
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ },
+ );
+
testWidgets(
'New Pane reflows 2 to 3 to 4 to 5 panes, retaining terminals and focus',
(tester) async {
diff --git a/desktop/test/pane_move_to_tab_test.dart b/desktop/test/pane_move_to_tab_test.dart
index 99e92d46d..40e31be7a 100644
--- a/desktop/test/pane_move_to_tab_test.dart
+++ b/desktop/test/pane_move_to_tab_test.dart
@@ -149,9 +149,8 @@ void main() {
test('the tab left behind re-tiles instead of keeping a lopsided split', () {
// Panes opened with Split Right/Down save a manual layout, so a tab that
- // never had a divider dragged still has one. Carrying it down a tile — what
- // a close does — leaves the rest at proportions drawn for a tile that is no
- // longer there.
+ // never had a divider dragged still has one. Removing a pane resets the
+ // remaining count to its default layout.
final (app, source, target) = twoTabs(count: 3);
addTearDown(app.dispose);
app.activeSwarm.savePaneSizes(
@@ -171,7 +170,7 @@ void main() {
expect(left.arranged, isNull);
});
- test('a layout chosen outright still stands after a move', () {
+ test('the tab left behind resets a remembered preset after a move', () {
final (app, source, target) = twoTabs(count: 3);
addTearDown(app.dispose);
app.setPreset(2, PanePreset.rows);
@@ -179,7 +178,8 @@ void main() {
app.movePaneToSwarm(1, target, follow: false);
final left = app.swarms.firstWhere((swarm) => swarm.id == source);
- expect(left.presets[2], PanePreset.rows);
+ expect(left.presets[2], isNull);
+ expect(app.presetFor(2), PanePreset.defaultFor(2));
});
test('the destination forgets a shape it remembered for this count', () {
diff --git a/desktop/test/session_close_test.dart b/desktop/test/session_close_test.dart
index 6854e63e2..59133ffe4 100644
--- a/desktop/test/session_close_test.dart
+++ b/desktop/test/session_close_test.dart
@@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
+import 'package:harness/state/harness_monitor_controller.dart';
import 'package:harness/ws/ws_conn.dart';
import 'swarm_screen_test.dart' show mount, terminal;
@@ -131,6 +132,37 @@ void main() {
},
);
+ testWidgets('closing a mixed tab saves its work and dismisses the monitor', (
+ tester,
+ ) async {
+ app.stateOf('m')!.agents = [
+ agent('a0'),
+ Agent(
+ id: 'a1',
+ name: harnessMonitorName,
+ dsh: harnessMonitorId,
+ engine: 'opencode',
+ createdAt: DateTime.utc(2026, 10, 1),
+ closeSupported: true,
+ terminalAvailable: true,
+ ),
+ ];
+ app.adoptSessionForTest(terminal('a0', []));
+ app.adoptSessionForTest(terminal('a1', []));
+ final tab = app.activeSwarm;
+ await mount(tester, app);
+ unawaited(app.requestCloseSwarm(tab.id));
+ await tester.pumpAndSettle();
+ expect(app.swarms, isNot(contains(tab)));
+ expect(modes(), ['inspect', 'idle']);
+ expect(connection.closes.every((r) => r['agentId'] == 'a0'), isTrue);
+ expect(
+ app.stateOf('m')!.agents.firstWhere((a) => a.id == 'a1').isStopped,
+ isFalse,
+ );
+ await tester.pumpWidget(const SizedBox());
+ });
+
testWidgets('an unused idle Companions chat closes its whole tab directly', (
tester,
) async {
diff --git a/desktop/test/support/harness_monitor.dart b/desktop/test/support/harness_monitor.dart
index cfe87aba2..082ef7984 100644
--- a/desktop/test/support/harness_monitor.dart
+++ b/desktop/test/support/harness_monitor.dart
@@ -6,6 +6,7 @@ import 'model_manager.dart';
class MonitorConnection extends ModelManagerConnection {
List<Map<String, dynamic>>? inventory;
int inventoryReads = 0;
+ final closes = <Map<String, dynamic>>[];
@override
Future<void> waitUntilReady({
Duration timeout = const Duration(seconds: 10),
@@ -17,6 +18,10 @@ class MonitorConnection extends ModelManagerConnection {
Map<String, dynamic> payload = const {},
Duration timeout = const Duration(seconds: 20),
}) async {
+ if (type == 'agent_close') {
+ closes.add(Map.of(payload));
+ throw StateError('The monitor machine is unavailable.');
+ }
if (type == 'agents_list' && inventory != null) {
inventoryReads++;
return {'agents': inventory};
@@ -33,6 +38,8 @@ class MonitorConnection extends ModelManagerConnection {
'agent': {
...agent,
'engine': 'opencode',
+ 'closeSupported': true,
+ 'createdAt': '2026-10-01T12:00:00.000Z',
'viewerUrl': 'http://127.0.0.1:4179/',
'viewerName': harnessMonitorName,
},
diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dart
index 6a3b0c6f8..764da6750 100644
--- a/desktop/test/swarm_split_test.dart
+++ b/desktop/test/swarm_split_test.dart
@@ -470,7 +470,8 @@ void main() {
restored.dispose();
await app.closePane(shared.id);
await tester.pump();
- expect(app.activeSwarm.manualLayout!.tiles, before.tiles);
+ expect(app.activeSwarm.manualLayout, isNull);
+ expect(app.activeSwarm.arranged!.tiles, before.tiles);
expect(app.pinnedSlotFor(second), 1);
expect(app.reopenClosed(), isTrue);
await tester.pump();
@@ -479,13 +480,14 @@ void main() {
expect(app.pinnedSlotFor(second), 2);
await app.closePane(shared.id);
await tester.pump();
- final current = app.activeSwarm.manualLayout!;
+ final current = app.activeSwarm.arranged!;
+ final layoutKey = app.activeSwarm.arrangedKey!;
final resized = current.resize(
current.dividers.firstWhere((d) => d.axis == PaneResizeAxis.x),
.6,
minimum: app.activeSwarm.arrangedMinimum!,
);
- app.resizePanes(original, '3:manual', resized);
+ app.resizePanes(original, layoutKey, resized);
await tester.pump();
expect(app.reopenClosed(), isTrue);
await tester.pump();
@@ -494,7 +496,7 @@ void main() {
isNull,
reason: 'Reopening must not resurrect the old layout over newer sizing choices',
);
- expect(app.activeSwarm.paneSizes['3:manual']!.tiles, resized.tiles);
+ expect(app.activeSwarm.paneSizes[layoutKey]!.tiles, resized.tiles);
app.setPreset(4, PanePreset.quad);
await tester.pump();
expect(app.activeSwarm.manualLayout, isNull);