(
sessionId: string,
input: RetryChildAgentInput,
)
| 3901 | } |
| 3902 | |
| 3903 | async retryChildAgent( |
| 3904 | sessionId: string, |
| 3905 | input: RetryChildAgentInput, |
| 3906 | ): Promise<SpawnChildAgentResult> { |
| 3907 | let runtimeExecution = this.runtimeKernel.claimExecution(sessionId); |
| 3908 | let hintedTargetExecution: RuntimeExecutionClaim | undefined; |
| 3909 | try { |
| 3910 | if (input.execution?.kind === 'child_session') { |
| 3911 | hintedTargetExecution = this.runtimeKernel.claimExecution(input.execution.sessionId); |
| 3912 | } |
| 3913 | throwIfChildExecutionAborted( |
| 3914 | input.abortSignal, |
| 3915 | 'Child agent retry was cancelled before start', |
| 3916 | ); |
| 3917 | if (!this.deps.runStore || !this.deps.runtimeEventStore) { |
| 3918 | throw new Error('Child agent retry requires AgentRunStore and RuntimeEventStore'); |
| 3919 | } |
| 3920 | const execution = await this.resolveChildAgentExecution(sessionId, input.sourceRunId); |
| 3921 | this.assertChildRetryExecutionIdentity(input, execution); |
| 3922 | if (execution.kind === 'child_session') { |
| 3923 | if (hintedTargetExecution) { |
| 3924 | runtimeExecution = this.handoffRuntimeExecution(runtimeExecution, hintedTargetExecution); |
| 3925 | hintedTargetExecution = undefined; |
| 3926 | } else { |
| 3927 | runtimeExecution = this.transferRuntimeExecution(runtimeExecution, execution.sessionId); |
| 3928 | } |
| 3929 | } |
| 3930 | const releaseHostedExecution = |
| 3931 | execution.kind === 'child_session' |
| 3932 | ? this.acquireHostedLinkedChildExecution(execution.sessionId) |
| 3933 | : () => {}; |
| 3934 | try { |
| 3935 | return await this.retryChildAgentWithExecution( |
| 3936 | sessionId, |
| 3937 | input, |
| 3938 | execution, |
| 3939 | runtimeExecution, |
| 3940 | ); |
| 3941 | } finally { |
| 3942 | releaseHostedExecution(); |
| 3943 | } |
| 3944 | } finally { |
| 3945 | hintedTargetExecution?.release(); |
| 3946 | runtimeExecution.release(); |
| 3947 | } |
| 3948 | } |
| 3949 | |
| 3950 | private assertChildRetryExecutionIdentity( |
| 3951 | input: RetryChildAgentInput, |
no test coverage detected