fix(subagent): preserve published run failures

This commit is contained in:
Dudu-0223
2026-07-31 14:02:03 +08:00
committed by Tianyi Cui
parent 8b0a7a5d8d
commit a977ef30ee
57 changed files with 444 additions and 208 deletions

View File

@@ -56,7 +56,7 @@ export enum HostToWorkerType {
Go = 'go',
/** Cancel the run: hooks start throwing and the script dies at its next await. */
Cancel = 'cancel',
/** Child RPC reply: the provider fulfilled with a ready run (exactly one start reply per ChildStart). */
/** Child RPC reply: the provider fulfilled with a published run (exactly one start reply per ChildStart). */
ChildStarted = 'child-started',
/** Child RPC reply: the provider's asynchronous start failed. */
ChildStartError = 'child-start-error',

View File

@@ -89,7 +89,7 @@ class ChildRpcBridge implements ChildPort {
return new RpcChildHandle(this.post, callId, entry, childId)
}
/** The host established a ready child; releases the `startAgent` await. */
/** The host established a published child; releases the `startAgent` await. */
onChildStarted(callId: number, childId: string): void {
this.pending.get(callId)?.started.resolve(childId)
}

View File

@@ -87,7 +87,7 @@ export interface ChildPort {
/**
* Start one child agent on the host (the `agent()` hook's start half).
* @param request - the prompt and validated options.
* @returns the ready child handle; rejects when synchronous start or the
* @returns the published child handle; rejects when synchronous start or the
* provider's asynchronous start fails.
*/
startAgent(request: ChildStartRequest): Promise<ChildHandle>

View File

@@ -35,7 +35,7 @@ const ESCAPE = "globalThis.constructor.constructor('return process')()"
/** One controllable child run: the test (or auto mode) settles it. */
interface ControlledRun {
request: SubagentStartRequest
/** Fulfill the provider's async start with a ready child. */
/** Fulfill the provider's async start with a published child. */
publish(): void
/** Reject the provider's async start before ownership transfer. */
rejectStart(error: unknown): void