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:
parent
e613258fa5
commit
f4a24614b8
3 changed files with 6 additions and 6 deletions
|
|
@ -455,7 +455,7 @@ V1 不做复杂自动发现。
|
||||||
### Phase 3
|
### Phase 3
|
||||||
|
|
||||||
- 把 `SubagentManager` 迁移到 `runTurn/sub-turn`
|
- 把 `SubagentManager` 迁移到 `runTurn/sub-turn`
|
||||||
- 接通 `subturn_spawn` / `subturn_end` / `subturn_result_delivered`
|
- 接通 `agent.subturn.spawn` / `agent.subturn.end` / `agent.subturn.result_delivered`
|
||||||
|
|
||||||
### Phase 4
|
### Phase 4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -505,16 +505,16 @@ func spawnSubTurn(
|
||||||
//
|
//
|
||||||
// Delivery behavior:
|
// Delivery behavior:
|
||||||
// - If parent turn is still running: attempts to deliver to pendingResults channel
|
// - 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 channel is full: emits agent.subturn.orphan (result is lost from channel but tracked)
|
||||||
// - If parent turn has finished: emits SubTurnOrphanResultEvent (late arrival)
|
// - If parent turn has finished: emits agent.subturn.orphan (late arrival)
|
||||||
//
|
//
|
||||||
// Thread safety:
|
// Thread safety:
|
||||||
// - Reads parent state under lock, then releases lock before channel send
|
// - Reads parent state under lock, then releases lock before channel send
|
||||||
// - Small race window exists but is acceptable (worst case: result becomes orphan)
|
// - Small race window exists but is acceptable (worst case: result becomes orphan)
|
||||||
//
|
//
|
||||||
// Event emissions:
|
// Event emissions:
|
||||||
// - SubTurnResultDeliveredEvent: successful delivery to channel
|
// - agent.subturn.result_delivered: successful delivery to channel
|
||||||
// - SubTurnOrphanResultEvent: delivery failed (parent finished or channel full)
|
// - agent.subturn.orphan: delivery failed (parent finished or channel full)
|
||||||
func deliverSubTurnResult(al *AgentLoop, parentTS *turnState, childID string, result *tools.ToolResult) {
|
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.
|
// 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.
|
// We use defer/recover to catch any unlikely channel panics if it were ever closed.
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ func TestSpawnSubTurn_OrphanResultRouting(t *testing.T) {
|
||||||
time.Sleep(10 * time.Millisecond) // let event goroutine flush
|
time.Sleep(10 * time.Millisecond) // let event goroutine flush
|
||||||
// Verify Orphan event is emitted
|
// Verify Orphan event is emitted
|
||||||
if !collector.hasEventOfKind(runtimeevents.KindAgentSubTurnOrphan) {
|
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
|
// Verify history is NOT polluted
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue