Queue and turn-loop contracts distinguish restored deliveries from
external data held outside memory. The comments identify the next turn
boundary as the point where an accepted event becomes visible to the
agent.
Issue:
44d8703
return l.memory.Flush(ctx)
}
return l.memory.Flush(ctx)
}
-// Run runs a turn each time user messages or reports wait, until ctx ends. It
-// returns the error of a failed log write, which stops the agent. At its start
-// it resumes the subagents that a stop of the daemon cut, and at its end it
-// ends the runs of the subagents and waits for them.
+// Run starts a turn when user messages, reports, or queued external events
+// wait, until ctx ends. It returns the error of a failed log write, which stops
+// the agent. External events enter memory only between chains. At its start it
+// resumes the subagents that a stop of the daemon cut, and at its end it ends
+// the runs of the subagents and waits for them.
func (l *TurnLoop) Run(ctx context.Context) error {
defer l.runs.Close()
func (l *TurnLoop) Run(ctx context.Context) error {
defer l.runs.Close()