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(swarm): a Swarm started from a local repository does not stall its PM at Claude Code's trust question

bitcoinbuildera3bd850f83f3
diff --git a/cli/src/core/agents/launches.spec.ts b/cli/src/core/agents/launches.spec.ts
index 3db57538c..3af72225f 100644
--- a/cli/src/core/agents/launches.spec.ts
+++ b/cli/src/core/agents/launches.spec.ts
@@ -816,7 +816,8 @@ describe('agent_create with a receipt', () => {
await launch({ engine: 'claude', ...remote, permissionMode: 'full' }, 2)
await launch({ engine: 'claude', ...remote, swarmRole: 'lead', permissionMode: 'auto' }, 3)
await launch({ engine: 'claude', cwd: dir, swarmRole: 'lead', permissionMode: 'full' }, 4)
- await launch({ engine: 'claude', projectSource: 'worktree', gitSource: '/elsewhere', branchName: 'feature', swarmRole: 'lead', permissionMode: 'full' }, 5)
+ await ask({ creationId: `${CREATION}-5`, engine: 'claude', projectSource: 'worktree', gitSource: '/elsewhere', branchName: 'feature', swarmRole: 'lead', permissionMode: 'full' }, false)
+ await vi.waitFor(() => expect(replies).toHaveLength(5))
expect(preTrustClaudeProject).toHaveBeenCalledOnce()
// Claude Code only: a Codex Lead's checkout is not trusted for it.
await launch({ engine: 'codex', ...remote, swarmRole: 'lead', permissionMode: 'full' }, 6)
@@ -827,6 +828,23 @@ describe('agent_create with a receipt', () => {
expect(preTrustClaudeProject).toHaveBeenCalledTimes(2)
})
+ // 2026-10-30: a new Swarm made with Cmd+S on a local openharness checkout started its PM in a worktree of that
+ // checkout, which Claude Code had never been told to trust; the PM sat at the question, shown as Idle in the Swarm.
+ it('trusts the worktree of a repository the person picked in this machine\'s window for a Swarm agent in full mode', async () => {
+ const { ask, replies } = setup()
+ const launch = async (payload: Record<string, unknown>, local: boolean, n: number) => { await ask({ creationId: `${CREATION}-${n}`, ...payload }, local); await vi.waitFor(() => expect(replies).toHaveLength(n)) }
+ const worktree = { projectSource: 'worktree', gitSource: '/Users/me/openharness', branchName: 'lively-meteor' }
+ await launch({ engine: 'claude', ...worktree, swarmRole: 'lead', permissionMode: 'full' }, true, 1)
+ expect(preTrustClaudeProject).toHaveBeenCalledWith('/projects/prepared')
+ // Not relayed, not outside a Swarm or full mode, not for Codex: those stay the person's question.
+ await launch({ engine: 'claude', ...worktree, swarmRole: 'lead', permissionMode: 'full' }, false, 2)
+ await launch({ engine: 'claude', ...worktree, permissionMode: 'full' }, true, 3)
+ await launch({ engine: 'claude', ...worktree, swarmRole: 'lead', permissionMode: 'auto' }, true, 4)
+ await launch({ engine: 'codex', ...worktree, swarmRole: 'lead', permissionMode: 'full' }, true, 5)
+ expect(preTrustClaudeProject).toHaveBeenCalledOnce()
+ expect(preTrustCodexProject).not.toHaveBeenCalled()
+ })
+
// A Codex agent on its own profile reads its trust from THAT profile's config.toml: the trust was
// read and written in ~/.codex alone, so it got Codex's trust prompt in a folder Harness had just made.
it('asks and records a Codex agent\'s trust in its own profile', async () => {
diff --git a/cli/src/core/agents/launches.ts b/cli/src/core/agents/launches.ts
index 87028681c..e2920b4d9 100644
--- a/cli/src/core/agents/launches.ts
+++ b/cli/src/core/agents/launches.ts
@@ -130,8 +130,13 @@ export function createLaunchRequests({ receipts, createAgent, prepareCreate, pre
// answered. Its Yes then landed under the source's key (Claude Code records a worktree's answer under its
// main repository), which made the source look trusted before the worktree started.
// Claude Code only: Codex's trust also sets its defaults for the person's own later sessions in that folder.
- const swarmCheckout = input.engine === 'claude' && projectFolder.source === 'remote' && !!input.swarmRole
- && input.permissionMode === 'full'
+ //
+ // And a worktree of a repository the person picked in this machine's OWN window for a Swarm agent in full mode:
+ // 2026-10-30, a new Swarm made with Cmd+S on a local openharness checkout started its PM in a worktree of it, and
+ // the PM sat at Claude Code's trust question, which no Swarm view shows; it read Idle and every message to it was
+ // withheld. Only from a local frame: a relayed request could name any repository on this machine.
+ const swarmAgent = input.engine === 'claude' && !!input.swarmRole && input.permissionMode === 'full'
+ const swarmCheckout = swarmAgent && (projectFolder.source === 'remote' || (projectFolder.source === 'worktree' && local))
try {
// A Codex agent on its own profile reads its trust from that profile's config.toml, not ~/.codex.
const engineTrust = folderTrust(input.engine, input.codexHome)
diff --git a/cli/src/engines/kit/folderTrust.ts b/cli/src/engines/kit/folderTrust.ts
index d9a98122a..8e31353b1 100644
--- a/cli/src/engines/kit/folderTrust.ts
+++ b/cli/src/engines/kit/folderTrust.ts
@@ -8,8 +8,9 @@
* of one): that answer is theirs. One consented exception is a Swarm's own project clones: clicking Add
* machine authorizes those checkouts and their Swarm agent worktrees (superTabs/cloneTrust.ts), including
* earlier contributions repaired after an update. It never authorizes the person's other repositories.
- * The other is a Swarm agent in the Swarm's full mode in the checkout of its remote project's own repository
- * (core/agents/launches.ts `swarmCheckout`). Any other existing folder stays the person's question.
+ * The other is a Swarm agent in the Swarm's full mode in the checkout of its remote project's own repository, or in a
+ * worktree of the repository the person picked for it in this machine's own window (core/agents/launches.ts
+ * `swarmCheckout`). Any other existing folder stays the person's question.
* The callers decide (core/agents/create.ts, launches.ts). A worktree only inherits the answer its source
* repo already has.
*