docs(events): remove stale subturn event names

Replace leftover SubTurnOrphanResultEvent and short subturn event references with runtime event kinds in comments, tests, and hook design notes.

Validation: GOCACHE=/tmp/picoclaw-go-cache go test ./pkg/agent -run TestSpawnSubTurn_OrphanResultRouting; make lint
This commit is contained in:
Hoshina
2026-04-26 17:04:38 +08:00
parent e613258fa5
commit f4a24614b8
3 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -505,16 +505,16 @@ func spawnSubTurn(
//
// Delivery behavior:
// - If parent turn is still running: attempts to deliver to pendingResults channel
// - If channel is full: emits SubTurnOrphanResultEvent (result is lost from channel but tracked)
// - If parent turn has finished: emits SubTurnOrphanResultEvent (late arrival)
// - If channel is full: emits agent.subturn.orphan (result is lost from channel but tracked)
// - If parent turn has finished: emits agent.subturn.orphan (late arrival)
//
// Thread safety:
// - Reads parent state under lock, then releases lock before channel send
// - Small race window exists but is acceptable (worst case: result becomes orphan)
//
// Event emissions:
// - SubTurnResultDeliveredEvent: successful delivery to channel
// - SubTurnOrphanResultEvent: delivery failed (parent finished or channel full)
// - agent.subturn.result_delivered: successful delivery to channel
// - agent.subturn.orphan: delivery failed (parent finished or channel full)
func deliverSubTurnResult(al *AgentLoop, parentTS *turnState, childID string, result *tools.ToolResult) {
// Let GC clean up the pendingResults channel; parent Finish will no longer close it.
// We use defer/recover to catch any unlikely channel panics if it were ever closed.
+1 -1
View File
@@ -326,7 +326,7 @@ func TestSpawnSubTurn_OrphanResultRouting(t *testing.T) {
time.Sleep(10 * time.Millisecond) // let event goroutine flush
// Verify Orphan event is emitted
if !collector.hasEventOfKind(runtimeevents.KindAgentSubTurnOrphan) {
t.Error("SubTurnOrphanResultEvent not emitted for finished parent")
t.Error("agent.subturn.orphan not emitted for finished parent")
}
// Verify history is NOT polluted