From 6ba10692b1ec3dd61ca4431c464a50b700480c0f Mon Sep 17 00:00:00 2001 From: Adam Weidman Date: Sun, 15 Mar 2026 11:11:08 -0400 Subject: [PATCH] feat(agents): use inject completion behavior for remote agent backgrounding Set completionBehavior: 'inject' on remote agent executions so their full output is reinjected into the conversation when they complete in the background, and the task auto-dismisses from the Ctrl+B panel. --- packages/core/src/agents/remote-invocation.test.ts | 1 + packages/core/src/agents/remote-invocation.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/core/src/agents/remote-invocation.test.ts b/packages/core/src/agents/remote-invocation.test.ts index 2982e18d70..04ca486aaf 100644 --- a/packages/core/src/agents/remote-invocation.test.ts +++ b/packages/core/src/agents/remote-invocation.test.ts @@ -850,6 +850,7 @@ describe('RemoteAgentInvocation', () => { const info = bgListener.mock.calls[0][0]; expect(info.executionId).toBe(capturedExecutionId); expect(info.executionMethod).toBe('remote_agent'); + expect(info.completionBehavior).toBe('inject'); expect(info.injectionText).toContain( "Remote agent 'Test Agent' completed successfully", ); diff --git a/packages/core/src/agents/remote-invocation.ts b/packages/core/src/agents/remote-invocation.ts index 080031234d..e7ea9ff9ce 100644 --- a/packages/core/src/agents/remote-invocation.ts +++ b/packages/core/src/agents/remote-invocation.ts @@ -149,6 +149,7 @@ export class RemoteAgentInvocation extends BaseToolInvocation< return output ? `${header}\nOutput:\n${output}` : header; }, agentLabel, + 'inject', ); // createExecution always produces a valid numeric ID const executionId = handle.pid!;