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.
This commit is contained in:
Adam Weidman
2026-03-15 11:11:08 -04:00
parent 4f2a1ad214
commit 6ba10692b1
2 changed files with 2 additions and 0 deletions
@@ -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",
);
@@ -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!;