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(desktop): let Monitor branches use remaining row width (#280)

Dee461ff2bf378c
diff --git a/.github/assets/monitor/branch-width-after.png b/.github/assets/monitor/branch-width-after.png
new file mode 100644
index 000000000..7aa5ac4e2
Binary files /dev/null and b/.github/assets/monitor/branch-width-after.png differ
diff --git a/.github/assets/monitor/branch-width-before.png b/.github/assets/monitor/branch-width-before.png
new file mode 100644
index 000000000..d322c6212
Binary files /dev/null and b/.github/assets/monitor/branch-width-before.png differ
diff --git a/desktop/lib/widgets/harness_session_manager.dart b/desktop/lib/widgets/harness_session_manager.dart
index 6d1bb1f6e..9358167cb 100644
--- a/desktop/lib/widgets/harness_session_manager.dart
+++ b/desktop/lib/widgets/harness_session_manager.dart
@@ -609,26 +609,41 @@ class _SessionRow extends StatelessWidget {
? 'Last activity unavailable'
: 'Last active ${harnessActivityAge(row.lastActiveAt, now)} ago';
Widget detail(IconData icon, String text, Color color, {String? tooltip}) =>
- Flexible(
- child: Tooltip(
- message: tooltip ?? text,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(icon, size: 11, color: color),
- const SizedBox(width: 5),
- Flexible(
- child: Text(
- text,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: AppType.monoMeta(color: color, height: 1.3),
- ),
+ Tooltip(
+ message: tooltip ?? text,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(icon, size: 11, color: color),
+ const SizedBox(width: 5),
+ Flexible(
+ child: Text(
+ text,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: AppType.monoMeta(color: color, height: 1.3),
),
- ],
- ),
+ ),
+ ],
),
);
+ final details = [
+ detail(
+ LucideIcons.monitor,
+ row.machine.machine.displayName,
+ AppPalette.textSecondary,
+ ),
+ if (row.project case final project?) ...[
+ detail(
+ LucideIcons.folder,
+ project.label,
+ const Color(0xff79bbaf),
+ tooltip: project.cwd,
+ ),
+ if (project.shownBranch case final branch?)
+ detail(LucideIcons.gitBranch, branch, const Color(0xff8dbb79)),
+ ],
+ ];
return Padding(
padding: const EdgeInsets.symmetric(vertical: 1),
child: DecoratedBox(
@@ -736,33 +751,39 @@ class _SessionRow extends StatelessWidget {
],
),
const SizedBox(height: 6),
- Row(
- children: [
- detail(
- LucideIcons.monitor,
- row.machine.machine.displayName,
- AppPalette.textSecondary,
- ),
- if (row.project
- case final project?) ...[
- const SizedBox(width: 12),
- detail(
- LucideIcons.folder,
- project.label,
- const Color(0xff79bbaf),
- tooltip: project.cwd,
- ),
- if (project.shownBranch
- case final branch?) ...[
- const SizedBox(width: 12),
- detail(
- LucideIcons.gitBranch,
- branch,
- const Color(0xff8dbb79),
- ),
+ LayoutBuilder(
+ builder: (context, constraints) {
+ // Cap leading labels without reserving
+ // columns: the branch gets all space
+ // left over by short machine/project names.
+ final leadingWidth = math.max(
+ 0.0,
+ (constraints.maxWidth -
+ 12 * (details.length - 1)) /
+ details.length,
+ );
+ return Row(
+ children: [
+ for (
+ var i = 0;
+ i < details.length;
+ i++
+ ) ...[
+ if (i > 0)
+ const SizedBox(width: 12),
+ if (i == details.length - 1)
+ Expanded(child: details[i])
+ else
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: leadingWidth,
+ ),
+ child: details[i],
+ ),
+ ],
],
- ],
- ],
+ );
+ },
),
if (row.agent.hasMonitorStats) ...[
const SizedBox(height: 6),
diff --git a/desktop/test/harness_session_manager_test.dart b/desktop/test/harness_session_manager_test.dart
index c5883ca19..2842fbb4a 100644
--- a/desktop/test/harness_session_manager_test.dart
+++ b/desktop/test/harness_session_manager_test.dart
@@ -971,6 +971,12 @@ void main() {
'engine': 'claude',
'sessionId': 'conversation',
'terminal': {'available': true},
+ 'project': {
+ 'name': 'autonomous-harness-desktop-with-a-long-project-name',
+ 'cwd': '/work/autonomous-harness-desktop-with-a-long-project-name',
+ 'branch':
+ 'feat/centered-new-harness-session-picker-with-long-details',
+ },
'updatedAt': DateTime.now()
.subtract(const Duration(minutes: 8))
.toIso8601String(),
@@ -1004,6 +1010,23 @@ void main() {
await tester.runAsync(loadPreviewFonts);
debugDisableShadows = false;
addTearDown(() => debugDisableShadows = true);
+ app.machineStates['m']!.machine = const Machine(
+ machineId: 'm',
+ name: 'M2',
+ authMode: MachineAuthMode.remote,
+ );
+ app.machineStates['m']!.agents[0] = const Agent(
+ id: 'a0',
+ name: 'Improve multiple-machine experience',
+ engine: 'codex',
+ sessionId: 'conversation',
+ terminalAvailable: true,
+ project: AgentProject(
+ name: 'autonomous-harness',
+ cwd: '/work/autonomous-harness',
+ branch: 'improve-multiple-machine-experience',
+ ),
+ );
app.machineStates['m']!.agents.addAll([
const Agent(
id: 'review',
@@ -1011,7 +1034,11 @@ void main() {
engine: 'codex',
sessionId: 'review-history',
terminalAvailable: true,
- project: _project,
+ project: AgentProject(
+ name: 'autonomous-harness',
+ cwd: '/work/autonomous-harness',
+ branch: 'feat/centered-new-harness-session-picker',
+ ),
),
const Agent(
id: 'api',
@@ -1115,6 +1142,22 @@ void main() {
find.byType(MaterialApp),
matchesGoldenFile(Uri.file('$renderDir/sessions.png')),
);
+ tester.view.physicalSize = const Size(880, 560);
+ await tester.pumpAndSettle();
+ await expectLater(
+ find.byType(MaterialApp),
+ matchesGoldenFile(Uri.file('$renderDir/minimum-window.png')),
+ );
+ tester.platformDispatcher.textScaleFactorTestValue = 1.5;
+ addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
+ await tester.pumpAndSettle();
+ await expectLater(
+ find.byType(MaterialApp),
+ matchesGoldenFile(Uri.file('$renderDir/scaled-text.png')),
+ );
+ tester.platformDispatcher.clearTextScaleFactorTestValue();
+ tester.view.physicalSize = const Size(1280, 800);
+ await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('session-filter:needsInput')));
await tester.pumpAndSettle();
await expectLater(