fix: address codex review round 3

Recheck the listing cancellation signal after each child inspection settles:
a per-child read failing with a diagnostic-mapped code during an abort
previously bypassed the inspection's own checkpoints, letting a cancelled
single-child scan return a successful result.
This commit is contained in:
Dudu-0223
2026-07-27 10:22:36 +08:00
committed by Tianyi Cui
parent 13631134aa
commit 30b9d0464a
2 changed files with 22 additions and 0 deletions

View File

@@ -275,6 +275,11 @@ export class SubagentService extends Service {
const entries: SubagentListEntry[] = []
for (const node of trace.descendants) {
const entry = await this.inspectChild(query, parentSessionId, node.session, signal)
// Recheck after the inspection settles, not only inside it: a mapped
// per-child failure during an abort becomes a diagnostic and skips the
// inspection's own checkpoints, and a cancelled scan must not return a
// successful result or start another candidate read.
assertListingNotCancelled(signal)
if (entry !== undefined) entries.push(entry)
}
return entries