docs(subagent): correct report acceptance semantics for closing parents

The tool README claimed a "missing, disposed, or closing parent" fails
the call — but acceptance is governed by the parent's registry presence:
`resolveReportParent` only rejects when the durable parent id is absent
from the registry, so a host-owned parent already in disposal but still
registered still accepts (the pinned host-disposing-parent behavior).
The claim misled callers into treating disposal state as a delivery
signal.

Restate the contract in both languages: absence from the registry is the
only `PARENT_UNAVAILABLE` case, and a failed tool call does not prove
non-delivery — a later `tools/post-execute` veto can fail a call whose
report was already accepted, so the durable child transcript remains the
recovery source.

Adds a regression test pinning acceptance into a host-disposing but
still-registered parent, and rejection after disposal settles.
This commit is contained in:
Tianyi Cui
2026-08-02 12:31:54 +08:00
parent 5da2ac5835
commit 3114947324
3 changed files with 19 additions and 2 deletions
@@ -350,6 +350,23 @@ describe('dsh-tool-subagent-report', () => {
expect(ctx.agents.list().map(agent => agent.id)).toEqual([parent.id])
})
it('accepts a report into a host-disposing but still-registered parent', async () => {
const { ctx } = await setup()
const parentHandle = await ctx.agents.create({
sessionId: SessionId('disposing-parent'),
agentOptions: { provider: 'mock', model: 'mock' },
})
const { child } = await startChild(ctx, parentHandle.agent)
// Host-owned disposal starts asynchronously; the parent stays registered
// until quiescence, and registry presence — not disposal state — is the
// acceptance gate (pins the README contract).
const disposing = parentHandle.dispose()
const accepted = await callReport(ctx, child, 'during-close')
expect(accepted.isError).toBe(false)
await disposing
expect((await callReport(ctx, child, 'after-close')).isError).toBe(true)
})
it('keeps the namespace plugin shape and validates its default', () => {
expect('default' in tool).toBe(false)
expect(tool.name).toBe('tool-subagent-report')