-// start runs run in the background. Its context keeps the values of ctx, but
-// only Stop and Close end it.
+// start runs run in the background and logs its start. Its context keeps the
+// values of ctx, but only Stop and Close end it.
func (r *SubagentRuns) start(ctx context.Context, run *SubagentRun) error {
ctx, run.cancel = context.WithCancel(context.WithoutCancel(ctx))
func (r *SubagentRuns) start(ctx context.Context, run *SubagentRun) error {
ctx, run.cancel = context.WithCancel(context.WithoutCancel(ctx))
-// run runs the chains of run and reports its end, unless Close ended it. A
-// chain follows while messages wait after the final answer of the chain before
+// run runs the chains of run and reports and logs its end with the length of
+// the run, unless Close ended it. A chain follows while messages wait after the final answer of the chain before
// it, and no chain failed. A chain that Stop ends gives the reply "stopped".
func (r *SubagentRuns) run(ctx context.Context, run *SubagentRun) {
defer r.workers.Done()
// it, and no chain failed. A chain that Stop ends gives the reply "stopped".
func (r *SubagentRuns) run(ctx context.Context, run *SubagentRun) {
defer r.workers.Done()
- r.logger.Printf("subagent %s failed: %v", run.subagent.name, failure)
+ r.logger.Printf("subagent %s failed after %s: %v", run.subagent.name, length, failure)
}
r.report(run.subagent.name, subagentReport(run.subagent.name, replies), status)
}
r.report(run.subagent.name, subagentReport(run.subagent.name, replies), status)
// SubagentRun is one run of a subagent: the view that its requests get, its
// effort, the end of its context, the messages of Tell that wait for a request,
// SubagentRun is one run of a subagent: the view that its requests get, its
// effort, the end of its context, the messages of Tell that wait for a request,