fix(subagent): preserve published run failures
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/workflow/workflow/README.md
|
||||
README.md: 9d01cfd3d2504d6b5af5a1af6cba735a4abb5795
|
||||
README.zh.md: 20dde758d82b38658c39157f9d72d1f3fba046a9
|
||||
README.md: 0de661423206cc71eb4669bc8ddb2419202bcb4a
|
||||
README.zh.md: 5abda102a128f9c70cd0971e316c2f0c7f504871
|
||||
|
||||
@@ -34,7 +34,7 @@ Same-process event payloads are borrowed immutable values. Every listener is ind
|
||||
- `INVALID_ARGUMENT` / `UNSUPPORTED_OPTION` / `UNSUPPORTED_SCHEMA` — a hook call violates the engine contract.
|
||||
- `AGENT_CAP` / `ITEM_CAP` — configured safety limits were exceeded.
|
||||
- `AGENT_START` — the provider's async start rejected.
|
||||
- `AGENT_RESULT` — a ready child's result rejected with an infrastructure fault.
|
||||
- `AGENT_RESULT` — a published child's result rejected with an infrastructure fault.
|
||||
- `RESULT_UNSERIALIZABLE` — a script/worker value is not plain JSON data.
|
||||
- `CANCELLED` — cancellation owns the run and pending/future hooks reject.
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
- `INVALID_ARGUMENT` / `UNSUPPORTED_OPTION` / `UNSUPPORTED_SCHEMA`:钩子调用违反引擎契约;
|
||||
- `AGENT_CAP` / `ITEM_CAP`:超过已配置的安全上限;
|
||||
- `AGENT_START`:提供方的异步启动调用被拒绝;
|
||||
- `AGENT_RESULT`:已就绪子 agent 的结果因基础设施故障而拒绝;
|
||||
- `AGENT_RESULT`:已发布子 agent 的结果因基础设施故障而拒绝;
|
||||
- `RESULT_UNSERIALIZABLE`:脚本/worker 值不是普通 JSON 数据;
|
||||
- `CANCELLED`:取消会接管该运行,待处理和未来的钩子都会拒绝。
|
||||
|
||||
|
||||
@@ -59,9 +59,9 @@ declare module 'cordis' {
|
||||
*/
|
||||
'workflow/log'(info: WorkflowRunInfo, message: string): void
|
||||
/**
|
||||
* One `agent()` call established a ready child run. Paired with
|
||||
* One `agent()` call established a published child run. Paired with
|
||||
* {@link Events['workflow/agent-end']} by `agent.seq`. A call that never
|
||||
* receives a ready run from the provider emits neither
|
||||
* receives a published run from the provider emits neither
|
||||
* event in this pair.
|
||||
* @param info - the run's identity snapshot.
|
||||
* @param agent - the call's sequence number, label, phase, and child id.
|
||||
|
||||
Reference in New Issue
Block a user