stopToolSets gracefully stops all tool sets with a bounded timeout so that cleanup cannot block indefinitely. It detaches from ctx's cancellation (cleanup often runs after the caller's ctx is already done, e.g. on shutdown or tab close) while keeping ctx's trace context.
(ctx context.Context, t toolStopper)
| 1106 | // cancellation (cleanup often runs after the caller's ctx is already done, |
| 1107 | // e.g. on shutdown or tab close) while keeping ctx's trace context. |
| 1108 | func stopToolSets(ctx context.Context, t toolStopper) { |
| 1109 | ctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second) |
| 1110 | defer cancel() |
| 1111 | if err := t.StopToolSets(ctx); err != nil { |
| 1112 | slog.ErrorContext(ctx, "Failed to stop tool sets", "error", err) |
| 1113 | } |
| 1114 | } |
| 1115 | |
| 1116 | // validateTheme reports whether ref names a loadable theme. It is used to |
| 1117 | // fail fast on an explicit --theme value, listing the available themes so the |
no test coverage detected