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.

Own-account switch: say it's per Swarm, and why Team-written work moves (#3056)

harness-for-autonomous[bot]d4129afd926a
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index 57bf82ddf..c9809edc6 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -2416,7 +2416,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
// Moved to the Mac's Team account: the starter is told why in one line (task #2806).
if (moved.machineId !== named.machineId) {
const mac = state.machines?.find(m => m.machineId === named.machineId)
- if (mac) result.moved = movedToTeamAccount(mac)
+ if (mac) result.moved = movedToTeamAccount(mac, written)
}
if (written) requireTeamWrittenMachine(state, startGroup, moved.machineId)
// A branch GitHub cannot place stays out of the main account too, unmarked, as it may yet read clean.
diff --git a/backend/src/superTabs/machines.ts b/backend/src/superTabs/machines.ts
index 54cf49c38..f9b47eb1f 100644
--- a/backend/src/superTabs/machines.ts
+++ b/backend/src/superTabs/machines.ts
@@ -487,9 +487,12 @@ export const ownAccountWork = (pool: Pick<ContributedMachine, 'ownAccountChoice'
export const ownAccountNote = (pool: Pick<ContributedMachine, 'name'>, ownerName: string | undefined): string =>
`${pool.name} runs teammates' work in ${ownerName ?? 'its owner'}'s own account.`
-/** What a start moved to [pool]'s Team account says, so it is never moved silently (task #2806). */
-export const movedToTeamAccount = (pool: Pick<ContributedMachine, 'name'>): string =>
- `${pool.name} runs teammates' work in its Harness Team account. Its owner can change that in Manage > Machines.`
+/** What a start moved to [pool]'s Team account says, so it is never moved silently (task #2806). The owner's choice is kept
+ * on each Swarm's own entry for the Mac, so it says which Swarm's to change (task #2993: Gray turned it on in another
+ * Swarm). Team-written code moves whatever the owner chose, so that note names the code, not a setting that would not help. */
+export const movedToTeamAccount = (pool: Pick<ContributedMachine, 'name'>, teamWritten = false): string => teamWritten
+ ? `A Harness Team agent wrote this task's code, so it runs in the Harness Team account on ${pool.name}.`
+ : `${pool.name} runs teammates' work in its Harness Team account in this Swarm. Its owner can change that in this Swarm's Manage > Machines.`
/** Where a new agent for [project] runs when a start names [machineId]: the Mac's team account when the project is not
* its contributor's own and the Mac has one in this Swarm, else the machine named. Not when its owner lets teammates'
diff --git a/backend/src/superTabs/ownAccountWork.test.ts b/backend/src/superTabs/ownAccountWork.test.ts
index 9037cf76f..72afed39f 100644
--- a/backend/src/superTabs/ownAccountWork.test.ts
+++ b/backend/src/superTabs/ownAccountWork.test.ts
@@ -201,7 +201,8 @@ describe('teammates\' work in a Mac owner\'s own account', () => {
expect(f.machine('gray-mac').ownAccountChoice).toEqual({ allowed: false, by: 'gray', at: new Date(NOW).toISOString() })
const moved = f.start(f.group())
expect(f.state.starts!.at(-1)!.request).toMatchObject({ machineId: 'gray-team' })
- expect(moved.result.moved).toBe('Gray\'s Mac runs teammates\' work in its Harness Team account. Its owner can change that in Manage > Machines.')
+ // The choice is per Swarm: the note says where this Swarm's is (task #2993: Gray turned it on in another Swarm).
+ expect(moved.result.moved).toBe('Gray\'s Mac runs teammates\' work in its Harness Team account in this Swarm. Its owner can change that in this Swarm\'s Manage > Machines.')
expect(f.state.agents.find(a => a.id === (running as { agentId: string }).agentId)!.machineId).toBe('gray-mac')
})
@@ -222,4 +223,23 @@ describe('teammates\' work in a Mac owner\'s own account', () => {
// Moved or refused, never run as Gray.
expect(result === null ? f.state.starts!.at(-1)!.request.machineId : result.code).not.toBe('gray-mac')
})
+
+ it('says a Team-written start moved for its code, not for a choice its owner can change (task #2993)', () => {
+ const f = swarm()
+ f.choose(true)
+ const group = f.group()
+ Object.assign(f.state.conversations.find(c => c.id === group)!, { teamWritten: true })
+ const moved = f.start(group)
+ expect(f.state.starts!.at(-1)!.request).toMatchObject({ machineId: 'gray-team' })
+ expect(moved.result.moved).toBe('A Harness Team agent wrote this task\'s code, so it runs in the Harness Team account on Gray\'s Mac.')
+ })
+
+ it('is kept per Swarm: turning it on in one Swarm leaves another Swarm\'s entry for the same Mac as it was (task #2993)', () => {
+ const ours = swarm(), theirs = swarm()
+ ours.choose(true)
+ expect(theirs.machine('gray-mac').ownAccountChoice).toBeUndefined()
+ const moved = theirs.start(theirs.group())
+ expect(theirs.state.starts!.at(-1)!.request).toMatchObject({ machineId: 'gray-team' })
+ expect(moved.result.moved).toContain('in this Swarm\'s Manage > Machines')
+ })
})
diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dart
index 9e6e81c65..5867c9875 100644
--- a/desktop/lib/super_tabs/machines.dart
+++ b/desktop/lib/super_tabs/machines.dart
@@ -1692,8 +1692,9 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "Teammates' agents will run as you on $name. They can read your files, your keychain and your "
- 'signed-in apps. Agents already running are not moved.',
+ // Kept per Swarm (task #2993): other Swarms with this Mac keep their own choice.
+ "Teammates' agents in this Swarm will run as you on $name. They can read your files, your keychain "
+ 'and your signed-in apps. Agents already running are not moved. Your other Swarms keep their own choice.',
),
if (attempted && !busy && c.operationError != null) ...[
const SizedBox(height: 12),
diff --git a/desktop/test/super_tab_machine_own_account_test.dart b/desktop/test/super_tab_machine_own_account_test.dart
index 54ceb2b4e..b5d8d418a 100644
--- a/desktop/test/super_tab_machine_own_account_test.dart
+++ b/desktop/test/super_tab_machine_own_account_test.dart
@@ -147,8 +147,8 @@ void main() {
);
expect(
find.text(
- "Teammates' agents will run as you on Gray's Mac. They can read your files, your keychain and your "
- 'signed-in apps. Agents already running are not moved.',
+ "Teammates' agents in this Swarm will run as you on Gray's Mac. They can read your files, your keychain "
+ 'and your signed-in apps. Agents already running are not moved. Your other Swarms keep their own choice.',
),
findsOneWidget,
);