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.

Desktop: show the machine owner in the agent details dialog (#1661)

Jacob Pham687756d3967d
diff --git a/desktop/lib/super_tabs/agent_details.dart b/desktop/lib/super_tabs/agent_details.dart
index dd3586b39..fb5edad38 100644
--- a/desktop/lib/super_tabs/agent_details.dart
+++ b/desktop/lib/super_tabs/agent_details.dart
@@ -86,14 +86,21 @@ class SuperTabAgentInfo {
bool get hasQuestion =>
app?.questionFor(agent.machineId, agent.harnessId) != null;
+ /// The agent's machine owner, named as the sidebar Humans list names them.
+ String? get owner => _personName(agent.machineOwnerId);
+
+ String? _personName(Object? personId) {
+ final person = controller.snapshot?.people
+ .where((p) => p.id == personId)
+ .firstOrNull;
+ return _known(person == null ? null : superTabPersonName(person.email));
+ }
+
String? get questionOwner {
if (!hasQuestion) return null;
final execution = taskGroup?.assignment?['execution'];
final ownerId = execution is Map ? execution['machineOwnerId'] : null;
- final person = controller.snapshot?.people
- .where((p) => p.id == ownerId)
- .firstOrNull;
- return _known(person == null ? null : superTabPersonName(person.email)) ??
+ return _personName(ownerId) ??
_known(app?.stateOf(agent.machineId)?.machine.machineShare?.owner) ??
_known(app?.stateOf(agent.machineId)?.machine.ownerName);
}
@@ -278,6 +285,7 @@ Future<void> showSuperTabAgentDetails(
),
),
if (info.machine case final value?) _fact('Machine', value),
+ if (info.owner case final value?) _fact('Owner', value),
if (info.folder case final value?)
_fact('Working folder', value),
if (info.permission case final value?)
diff --git a/desktop/test/super_tab_roster_test.dart b/desktop/test/super_tab_roster_test.dart
index 41968b867..c0cae35b7 100644
--- a/desktop/test/super_tab_roster_test.dart
+++ b/desktop/test/super_tab_roster_test.dart
@@ -594,7 +594,8 @@ void main() {
of: find.byType(AlertDialog),
matching: find.text('owner'),
),
- findsOneWidget,
+ // The Owner row and Who can answer both name the machine owner.
+ findsNWidgets(2),
);
await tester.tap(find.widgetWithText(TextButton, 'Close'));
await tester.pumpAndSettle();
@@ -607,6 +608,55 @@ void main() {
},
);
+ group('agent details Owner', () {
+ Future<void> openDetails(WidgetTester tester, RosterFixture f) async {
+ await f.show(tester);
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ }
+
+ Finder inDialog(String text) => find.descendant(
+ of: find.byType(AlertDialog),
+ matching: find.text(text),
+ );
+
+ testWidgets('names a teammate who owns the machine, under Machine', (
+ tester,
+ ) async {
+ final f = await fixture(tester, account: 'ann');
+ (f.server.state['agents'] as List)[1]['machineOwnerId'] = 'ann';
+ await f.controller.refresh();
+ await openDetails(tester, f);
+ expect(inDialog('Owner'), findsOneWidget);
+ expect(inDialog('ann'), findsOneWidget);
+ expect(
+ tester.getTopLeft(inDialog('Owner')).dy,
+ greaterThan(tester.getTopLeft(inDialog('Machine')).dy),
+ );
+ await f.close(tester);
+ });
+
+ testWidgets('names the current user the same way', (tester) async {
+ final f = await fixture(tester);
+ (f.server.state['agents'] as List)[1]['machineOwnerId'] = 'owner';
+ await f.controller.refresh();
+ await openDetails(tester, f);
+ expect(inDialog('Owner'), findsOneWidget);
+ expect(inDialog('owner'), findsOneWidget);
+ await f.close(tester);
+ });
+
+ testWidgets('hides the row when the owner is unknown', (tester) async {
+ final f = await fixture(tester);
+ (f.server.state['agents'] as List)[1]['machineOwnerId'] = 'ghost';
+ await f.controller.refresh();
+ await openDetails(tester, f);
+ expect(inDialog('Machine'), findsOneWidget);
+ expect(inDialog('Owner'), findsNothing);
+ await f.close(tester);
+ });
+ });
+
testWidgets('a replaced member keeps its identity and shows its new engine', (
tester,
) async {