deepseek-harness/docs/core-data-structures
Tianyi Cui 861791d2d8 Contain subagent lifecycle listeners per-listener, not per-emit
A single try/catch around ctx.emit prevented a thrown subagent/start or
subagent/end listener from propagating, but cordis emit dispatches listeners in
a `.map(cb => cb())` that HALTS on the first throw — so a bad subscriber still
starved the listeners registered after it, violating the AGENTS.md
callback-boundary rule ("one bad subscriber must not starve the listeners after
it"). Resolve the listener callbacks via ctx.events.dispatch and contain each
call individually, the same per-listener guarantee BashExecutor.notifyTaskDone
gives its own listener set.

The two containment tests now register TWO listeners where the first throws and
assert the second still observes the event (start) and the settle (end) — a
regression that fails on the per-emit code (verified: reverted, watched both go
red, restored).
2026-06-21 23:44:07 +08:00
..
bash.md feat(types): brand bash ids + stop brand erosion; extract Branded to dsh-brand 2026-06-21 07:19:59 +08:00
core.md Fix review findings: lifecycle containment, configurable tool name, coverage, type catalog 2026-06-21 23:15:43 +08:00
llm-streaming.md simplify(llm): drop unconsumed adapter-change event and assembled call surfaces 2026-06-21 01:27:41 +08:00
persistence.md fix review findings: bump session format version + restore late turn-end warn 2026-06-21 11:08:10 +08:00
session.md simplify(session): fold trace-only usage/error events into load-bearing events 2026-06-21 10:00:06 +08:00
subagent.md Contain subagent lifecycle listeners per-listener, not per-emit 2026-06-21 23:44:07 +08:00
tools.md Fix doc cross-links for the hierarchy; add package-path + shape gates 2026-06-20 23:12:14 +08:00