fix(subagent): identify lifecycle runs explicitly
This commit is contained in:
@@ -105,6 +105,7 @@ class StubProvider implements SubagentProvider {
|
||||
if (request.signal.aborted) throw new Error('child start aborted before publication')
|
||||
return {
|
||||
id: SessionId(`stub-child-${index}`),
|
||||
localAgent: undefined,
|
||||
result: terminal.promise,
|
||||
dispose: () => {
|
||||
controlled.disposeCalls += 1
|
||||
@@ -362,6 +363,7 @@ describe('dsh-workflow-workerthread', () => {
|
||||
inheritsParentContext: false,
|
||||
start: async () => ({
|
||||
id: SessionId('reject-child'),
|
||||
localAgent: undefined,
|
||||
result: Promise.reject(new Error('backend exploded')),
|
||||
dispose: () => Promise.resolve(),
|
||||
}),
|
||||
@@ -396,6 +398,7 @@ describe('dsh-workflow-workerthread', () => {
|
||||
} as unknown as SubagentResult
|
||||
const start = vi.spyOn(ctx.subagents, 'start').mockResolvedValue({
|
||||
id: SessionId('raw-invalid-child'),
|
||||
localAgent: undefined,
|
||||
result: Promise.resolve(invalid),
|
||||
dispose: () => Promise.resolve(),
|
||||
})
|
||||
@@ -419,6 +422,7 @@ describe('dsh-workflow-workerthread', () => {
|
||||
inheritsParentContext: false,
|
||||
start: async () => ({
|
||||
id: SessionId('bad-dispose-child'),
|
||||
localAgent: undefined,
|
||||
result: Promise.resolve({ output: [{ type: 'text', text: 'fine' }], stopReason: 'completed' }),
|
||||
cancel: () => { /* settled already */ },
|
||||
dispose: () => { throw new Error('dispose exploded') },
|
||||
@@ -440,6 +444,7 @@ describe('dsh-workflow-workerthread', () => {
|
||||
inheritsParentContext: false,
|
||||
start: async () => ({
|
||||
id: SessionId('trap-child'),
|
||||
localAgent: undefined,
|
||||
result: Promise.resolve({ output: [{ type: 'text', text: 'fine' }], stopReason: 'completed' }),
|
||||
cancel: () => { /* settled already */ },
|
||||
// The rejection VALUE's own coercion throws: a warn built with bare
|
||||
@@ -767,6 +772,7 @@ describe('dsh-workflow-workerthread', () => {
|
||||
}, { once: true })
|
||||
return {
|
||||
id: SessionId('signal-only-child'),
|
||||
localAgent: undefined,
|
||||
result,
|
||||
dispose: () => Promise.resolve(),
|
||||
}
|
||||
@@ -1088,6 +1094,7 @@ describe('dsh-workflow-workerthread', () => {
|
||||
|
||||
ready.resolve({
|
||||
id: SessionId('late-ready-child'),
|
||||
localAgent: undefined,
|
||||
result: Promise.resolve({ output: [], stopReason: 'aborted' }),
|
||||
dispose: () => {
|
||||
disposeCalls += 1
|
||||
@@ -1124,6 +1131,7 @@ describe('dsh-workflow-workerthread', () => {
|
||||
}, { once: true })
|
||||
return {
|
||||
id: SessionId('doomed-child'),
|
||||
localAgent: undefined,
|
||||
result: new Promise(() => { /* never settles; the reap is the teardown */ }),
|
||||
dispose: () => Promise.reject(new Error('dispose exploded during reap')),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user