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.

CLI and Desktop send the Agents setting (#2860, after #3001) (#3003)

0xken159ee75df0afe0
diff --git a/cli/src/superTabs/contribution.spec.ts b/cli/src/superTabs/contribution.spec.ts
index 957d2b0a7..3ce6b60b1 100644
--- a/cli/src/superTabs/contribution.spec.ts
+++ b/cli/src/superTabs/contribution.spec.ts
@@ -213,7 +213,7 @@ describe('the owner setting how many agents a machine offers, from a terminal',
expect(await f.set(96)).toEqual({ ok: true, machineId: 'studio', maxAgents: 96, maximum: 96 })
expect(f.sent).toHaveLength(1)
expect(f.sent[0]!.command).toEqual({ type: 'machine.contribute', machineId: 'studio', name: 'Mac Studio', cwd: '/Users/ken/harnesses/swarms/tab',
- scope: 'swarm', engines: ['claude', 'codex'], maxAgents: 96 })
+ scope: 'swarm', engines: ['claude', 'codex'], maxAgents: 96, agents: 'atMost' })
expect(String(f.sent[0]!.operationId)).toMatch(/^machine-agents-/)
})
it('refuses a number above the machine\'s maximum, and says what the maximum is', async () => {
@@ -237,7 +237,7 @@ describe('the owner setting how many agents a machine offers, from a terminal',
const f = owned(192, { paused: true })
expect(await f.set(32)).toEqual({ ok: true, machineId: 'studio', maxAgents: 32, maximum: 96 })
expect(f.sent.map(body => body.command)).toEqual([{ type: 'machine.contribute', machineId: 'studio', name: 'Mac Studio', cwd: '/Users/ken/harnesses/swarms/tab',
- scope: 'swarm', engines: ['claude', 'codex'], maxAgents: 32 }])
+ scope: 'swarm', engines: ['claude', 'codex'], maxAgents: 32, agents: 'atMost' }])
})
it('passes on the server\'s refusal, such as another person\'s machine', async () => {
const f = owned(192)
diff --git a/cli/src/superTabs/contribution.ts b/cli/src/superTabs/contribution.ts
index b2b96274d..37602f2a8 100644
--- a/cli/src/superTabs/contribution.ts
+++ b/cli/src/superTabs/contribution.ts
@@ -58,7 +58,8 @@ export async function setMachineAgents(core: CoreApi, input: { tabId: string; ma
const engines = (Array.isArray(machine.engines) ? machine.engines : []).filter(e => e === 'claude' || e === 'codex')
if (!engines.length) return { error: 'NO_SWARM_ENGINE', detail: `${name} runs neither Claude Code nor Codex. Configure it from Desktop.` }
const command = { type: 'machine.contribute', machineId: input.machineId, name, cwd: machine.cwd,
- ...(machine.scope === 'swarm' ? { scope: 'swarm' } : {}), engines, maxAgents: input.maxAgents }
+ // A number set here is its owner's own At most (backend superTabs/machines.ts agentLimit, #2860).
+ ...(machine.scope === 'swarm' ? { scope: 'swarm' } : {}), engines, maxAgents: input.maxAgents, agents: 'atMost' }
const sent = await ownerRequest(core, 'POST', `/api/super-tabs/${input.tabId}/commands`,
{ operationId: `machine-agents-${randomUUID()}`, command }, deps.backend)
return { ok: true, machineId: input.machineId, maxAgents: sent.offered16 ? 16 : input.maxAgents, maximum,
diff --git a/cli/src/superTabs/host.spec.ts b/cli/src/superTabs/host.spec.ts
index 667e19aec..2282aeece 100644
--- a/cli/src/superTabs/host.spec.ts
+++ b/cli/src/superTabs/host.spec.ts
@@ -3163,7 +3163,7 @@ describe('adding the machine its own Lead runs on to the Swarm', () => {
await t.pass(0)
expect(t.prepare).toHaveBeenCalledExactlyOnceWith(t.core, { tabId: 'own', scope: 'swarm' }, { reads: expect.any(SwarmReads) })
expect(t.commands).toEqual([{ path: '/api/super-tabs/own/commands', operationId: expect.any(String), command: { type: 'machine.contribute',
- machineId: 'machine-1', name: 'Ken Mac', cwd: '/data/swarm-projects/own', scope: 'swarm', engines: ['claude', 'codex'], maxAgents: 3, ifMissing: true } }])
+ machineId: 'machine-1', name: 'Ken Mac', cwd: '/data/swarm-projects/own', scope: 'swarm', engines: ['claude', 'codex'], maxAgents: 3, agents: 'memory', ifMissing: true } }])
await t.pass(59_000)
t.rows[0]!.joinSwarm = false
await t.pass(120_000)
diff --git a/cli/src/superTabs/host.ts b/cli/src/superTabs/host.ts
index 39316b30d..bc967f20a 100644
--- a/cli/src/superTabs/host.ts
+++ b/cli/src/superTabs/host.ts
@@ -1743,7 +1743,8 @@ export class SuperTabHost {
const prepared = await this.prepareContribution(this.core, { tabId, scope: 'swarm' }, { reads: this.sources.reads })
await backend(this.core, 'POST', `/api/super-tabs/${tabId}/commands`, { operationId: randomUUID(), command: {
type: 'machine.contribute', machineId: this.machineId, name: this.core.account.machineName() ?? hostname(),
- cwd: prepared.cwd, scope: 'swarm', engines: prepared.engines, maxAgents: prepared.maxAgents, ifMissing: true } })
+ // Joining sets no limit: free memory is checked at each start (Dee, 11-04: "remove the limit").
+ cwd: prepared.cwd, scope: 'swarm', engines: prepared.engines, maxAgents: prepared.maxAgents, agents: 'memory', ifMissing: true } })
})().then(() => { join.failures = 0; join.retryAt = this.now() + JOIN_RETRY_MS }, error => {
join.retryAt = error instanceof SuperTabHostError && JOIN_FINAL.has(error.code) ? Infinity
: this.now() + Math.min(JOIN_RETRY_MAX_MS, JOIN_RETRY_MS * 2 ** join.failures++)
diff --git a/desktop/lib/super_tabs/join_machine.dart b/desktop/lib/super_tabs/join_machine.dart
index 0df93a8dd..1ac5424c4 100644
--- a/desktop/lib/super_tabs/join_machine.dart
+++ b/desktop/lib/super_tabs/join_machine.dart
@@ -15,6 +15,19 @@ int? superTabSuggestedAgentSlots(MachineResources? resources) {
return (total / (2 * _agentMemoryBytes)).floor().clamp(1, 16);
}
+/// Whether [stored], on a machine row saved without its Agents setting, is
+/// the number joining suggested, which the server reads as As memory allows
+/// (backend superTabs/machines.ts agentLimit; Dee, 2026-11-04): 16, or the
+/// suggestion its measured memory gave (from 4 GiB, below which it was a
+/// floor of 1 rather than a figure from memory).
+bool superTabOldJoinSuggestion(int stored, MachineResources? resources) {
+ if (stored == 16) return true;
+ final total = resources?.memoryTotalBytes;
+ return total != null &&
+ total >= 2 * _agentMemoryBytes &&
+ stored == superTabSuggestedAgentSlots(resources);
+}
+
/// The role [answer] says this account just became a member as: the
/// server's own answer to the join that asked, a link join (store.ts
/// `joinSwarm`) or an invitation's accept (commands.ts `invite.accept`). Null
@@ -184,6 +197,8 @@ class SwarmJoinMachine {
'scope': 'swarm',
'engines': engines,
'maxAgents': slots,
+ // Joining sets no limit: free memory is checked at each start.
+ 'agents': 'memory',
'teamAccountOnly': true,
});
if (!current()) return null;
diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dart
index 5867c9875..dadf30c6e 100644
--- a/desktop/lib/super_tabs/machines.dart
+++ b/desktop/lib/super_tabs/machines.dart
@@ -42,7 +42,8 @@ import 'machine_details.dart';
import 'machine_icon.dart';
import 'machine_status.dart';
import 'model.dart';
-import 'join_machine.dart' show superTabSuggestedAgentSlots;
+import 'join_machine.dart'
+ show superTabOldJoinSuggestion, superTabSuggestedAgentSlots;
import 'personal_machine_rows.dart';
import 'team_account_setup.dart';
import 'section_heading.dart';
@@ -373,6 +374,7 @@ Future<bool> _sendContribution(
Map<String, dynamic> prepared,
List<String> engines, {
required int maxAgents,
+ required bool memory,
required bool Function() alive,
bool teamAccountOnly = false,
bool offerTeamAccount = true,
@@ -403,6 +405,8 @@ Future<bool> _sendContribution(
if (prepared['scope'] != null) 'scope': prepared['scope'],
'engines': engines,
'maxAgents': maxAgents,
+ // Its Agents setting, so a count is a limit only when its owner chose one.
+ 'agents': memory ? 'memory' : 'atMost',
if (teamAccountOnly) 'teamAccountOnly': true,
if (ifMissing) 'ifMissing': true,
if (unlessRemoved) 'unlessRemoved': true,
@@ -475,6 +479,7 @@ Future<String?> contributeComputer(
prepared,
engines,
maxAgents: slots,
+ memory: true,
alive: alive,
teamAccountOnly: teamAccountOnly,
offerTeamAccount: offerTeamAccount,
@@ -549,11 +554,11 @@ Future<void> _machineSettingsDialog(
String? error;
var busy = false;
String? setupId;
+ Map<String, dynamic>? storedRow(String? id) => id == null
+ ? null
+ : c.snapshot?.machines.where((m) => m['machineId'] == id).firstOrNull;
int? storedSlots(String? id) {
- final row = id == null
- ? null
- : c.snapshot?.machines.where((m) => m['machineId'] == id).firstOrNull;
- final current = row?['maxAgents'];
+ final current = storedRow(id)?['maxAgents'];
return current is num ? current.toInt() : null;
}
@@ -579,8 +584,18 @@ Future<void> _machineSettingsDialog(
int? atMostEdited;
bool memoryChoice() {
if (memoryEdited != null) return memoryEdited!;
+ // The setting the server keeps (Dee, 2026-11-04: "remove the limit").
+ final agents = storedRow(existingId)?['agents'];
+ if (agents == 'memory') return true;
+ if (agents == 'atMost') return false;
final stored = storedSlots(existingId);
final maximum = memoryMaximum();
+ // A machine saved before the server kept it: the server reads the old
+ // join suggestion as As memory allows (superTabOldJoinSuggestion).
+ if (stored != null &&
+ superTabOldJoinSuggestion(stored, settingsResources())) {
+ return true;
+ }
return stored != null && maximum != null && stored >= maximum;
}
@@ -591,6 +606,9 @@ Future<void> _machineSettingsDialog(
int atMostValue() {
if (atMostEdited != null) return atMostEdited!;
final stored = storedSlots(existingId);
+ if (stored != null && storedRow(existingId)?['agents'] == 'atMost') {
+ return stored.clamp(_agentSlotsMin, atMostMaximum());
+ }
final maximum = memoryMaximum();
if (stored != null && (maximum == null || stored < maximum)) {
return _clampAgentSlots(stored);
@@ -714,6 +732,7 @@ Future<void> _machineSettingsDialog(
prepared,
engines,
maxAgents: atMost ?? memoryLimit(prepared),
+ memory: atMost == null,
alive: () => context.mounted,
// The machine is in the Swarm already: changing its
// settings is no moment to ask for the Team account, and
diff --git a/desktop/test/super_tab_add_computers_test.dart b/desktop/test/super_tab_add_computers_test.dart
index b944dd422..54d2a20ec 100644
--- a/desktop/test/super_tab_add_computers_test.dart
+++ b/desktop/test/super_tab_add_computers_test.dart
@@ -271,6 +271,7 @@ void main() {
'scope': 'swarm',
'engines': ['claude', 'codex'],
'maxAgents': 8,
+ 'agents': 'memory',
'teamAccountOnly': true,
});
expect(commands.last['name'], 'Studio');
diff --git a/desktop/test/super_tab_machines_test.dart b/desktop/test/super_tab_machines_test.dart
index 7cde146a5..7adf20908 100644
--- a/desktop/test/super_tab_machines_test.dart
+++ b/desktop/test/super_tab_machines_test.dart
@@ -2103,7 +2103,9 @@ void main() {
server.state['machines'] = [machine('owner')];
server.preview = {
'previewVersion': 2,
- 'blockedBy': {'reason': "A Product Manager of a project you can't see runs on this machine."},
+ 'blockedBy': {
+ 'reason': "A Product Manager of a project you can't see runs on this machine.",
+ },
'agents': <dynamic>[],
'hiddenAgentCount': 2,
'soleSourceProjects': <dynamic>[],
@@ -2121,7 +2123,9 @@ void main() {
await tester.pumpAndSettle();
expect(
- find.text("A Product Manager of a project you can't see runs on this machine."),
+ find.text(
+ "A Product Manager of a project you can't see runs on this machine.",
+ ),
findsOneWidget,
);
expect(
@@ -2835,6 +2839,7 @@ void main() {
'scope': 'swarm',
'engines': ['claude', 'codex'],
'maxAgents': 8,
+ 'agents': 'memory',
});
expect(tester.takeException(), isNull);
@@ -2876,6 +2881,7 @@ void main() {
await _settleSave(tester);
expect(find.byType(SuperTabDetailDialog), findsNothing);
expect(f.connection.server.posts.single['command']!['maxAgents'], 4);
+ expect(f.connection.server.posts.single['command']!['agents'], 'atMost');
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
@@ -2892,7 +2898,7 @@ void main() {
f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');
f.connection.maxAvailableAgents = 96;
f.connection.server.state['machines'] = [
- {'machineId': 'm', 'contributorId': 'owner', 'maxAgents': 16},
+ {'machineId': 'm', 'contributorId': 'owner', 'maxAgents': 10},
];
final c = await f.app.superTabs.open(tabId);
await c.refresh();
@@ -2904,7 +2910,7 @@ void main() {
);
expect(_agentsChoice(tester), 'atMost');
- expect(_limit(tester), '16');
+ expect(_limit(tester), '10');
await tester.tap(find.byKey(const ValueKey('machine-agents-memory')));
await tester.pumpAndSettle();
expect(_agentsChoice(tester), 'memory');
@@ -2912,6 +2918,7 @@ void main() {
await tester.tap(find.widgetWithText(FilledButton, 'Save'));
await _settleSave(tester);
expect(f.connection.server.posts.single['command']!['maxAgents'], 96);
+ expect(f.connection.server.posts.single['command']!['agents'], 'memory');
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
@@ -2921,6 +2928,87 @@ void main() {
},
);
+ // Dee, 2026-11-04: "remove the limit". Joining stored its suggestion as a
+ // number, and the server now reads that number as As memory allows.
+ testWidgets('an old joining suggestion of 16 opens as As memory allows', (
+ tester,
+ ) async {
+ final f = SuperTabLaunchFixture();
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');
+ f.connection.maxAvailableAgents = 96;
+ f.connection.server.state['machines'] = [
+ {'machineId': 'm', 'contributorId': 'owner', 'maxAgents': 16},
+ ];
+ final c = await f.app.superTabs.open(tabId);
+ await c.refresh();
+ await _openConfigureDialog(
+ tester,
+ f,
+ c,
+ readLocal: (_) async => _reading(totalGiB: 192, freeGiB: 100),
+ );
+
+ expect(_agentsChoice(tester), 'memory');
+ await tester.tap(find.widgetWithText(FilledButton, 'Save'));
+ await _settleSave(tester);
+ expect(f.connection.server.posts.single['command']!['agents'], 'memory');
+ expect(tester.takeException(), isNull);
+
+ await tester.pumpWidget(const SizedBox());
+ await c.flush();
+ f.app.superTabs.dispose();
+ await tester.pump();
+ });
+
+ for (final setting in [
+ (totalGiB: 192.0, stored: 16, expected: 16),
+ (totalGiB: 32.0, stored: 16, expected: 16),
+ (totalGiB: 192.0, stored: 96, expected: 96),
+ (totalGiB: 32.0, stored: 24, expected: 16),
+ ]) {
+ testWidgets(
+ 'an owner’s own At most ${setting.stored} on ${setting.totalGiB} GiB opens and saves as At most ${setting.expected}',
+ (tester) async {
+ final f = SuperTabLaunchFixture();
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');
+ f.connection.maxAvailableAgents = setting.totalGiB ~/ 2;
+ f.connection.server.state['machines'] = [
+ {
+ 'machineId': 'm',
+ 'contributorId': 'owner',
+ 'maxAgents': setting.stored,
+ 'agents': 'atMost',
+ },
+ ];
+ final c = await f.app.superTabs.open(tabId);
+ await c.refresh();
+ await _openConfigureDialog(
+ tester,
+ f,
+ c,
+ readLocal: (_) async => _reading(
+ totalGiB: setting.totalGiB,
+ freeGiB: setting.totalGiB / 2,
+ ),
+ );
+
+ expect(_agentsChoice(tester), 'atMost');
+ expect(_limit(tester), '${setting.expected}');
+ await tester.tap(find.widgetWithText(FilledButton, 'Save'));
+ await _settleSave(tester);
+ final sent = f.connection.server.posts.single['command']!;
+ expect(sent['maxAgents'], setting.expected);
+ expect(sent['agents'], 'atMost');
+ expect(tester.takeException(), isNull);
+
+ await tester.pumpWidget(const SizedBox());
+ await c.flush();
+ f.app.superTabs.dispose();
+ await tester.pump();
+ },
+ );
+ }
+
testWidgets('changing the At most number chooses At most', (tester) async {
final f = SuperTabLaunchFixture();
f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');
@@ -3061,7 +3149,7 @@ void main() {
final f = SuperTabLaunchFixture();
f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');
f.connection.server.state['machines'] = [
- {'machineId': 'm', 'contributorId': 'owner', 'maxAgents': 4},
+ {'machineId': 'm', 'contributorId': 'owner', 'maxAgents': 3},
];
final c = await f.app.superTabs.open(tabId);
await c.refresh();
@@ -3078,21 +3166,21 @@ void main() {
await tester.tap(find.widgetWithText(FilledButton, 'Save'));
await _settleSave(tester);
expect(find.byType(SuperTabDetailDialog), findsOneWidget);
- expect(f.connection.server.posts.single['command']!['maxAgents'], 4);
+ expect(f.connection.server.posts.single['command']!['maxAgents'], 3);
// The owner changes their mind before trying again.
await tester.tap(_limitStep('more'));
await tester.pumpAndSettle();
await tester.tap(_limitStep('more'));
await tester.pumpAndSettle();
- expect(_limit(tester), '6');
+ expect(_limit(tester), '5');
await tester.tap(find.widgetWithText(FilledButton, 'Save'));
await _settleSave(tester);
expect(find.byType(SuperTabDetailDialog), findsNothing);
- // The stored attempt is settled first, and then the six on screen — the
- // four it was built with is not what the machine ends up with.
- expect(f.connection.server.posts.last['command']!['maxAgents'], 6);
+ // The stored attempt is settled first, and then the five on screen — the
+ // three it was built with is not what the machine ends up with.
+ expect(f.connection.server.posts.last['command']!['maxAgents'], 5);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
diff --git a/desktop/test/swarm_join_machine_test.dart b/desktop/test/swarm_join_machine_test.dart
index 984e09029..1612311c6 100644
--- a/desktop/test/swarm_join_machine_test.dart
+++ b/desktop/test/swarm_join_machine_test.dart
@@ -100,6 +100,8 @@ void main() {
'engines': ['claude', 'codex'],
// Half its memory in agents, at most 16: 32 GiB suggests 8.
'maxAgents': 8,
+ // Joining sets no limit (Dee, 2026-11-04: "remove the limit").
+ 'agents': 'memory',
'teamAccountOnly': true,
},
]);