fix(gateway): report why curators are disabled instead of never reporting
This commit is contained in:
1 file changed
+7
-4
@@ -24,12 +24,12 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/toolbuilder"
|
||||
)
|
||||
|
||||
func (b *server) setupCurators(ctx context.Context) bool {
|
||||
func (b *server) setupCurators(ctx context.Context) error {
|
||||
log := b.log.With("component", "curator")
|
||||
model, err := b.chatModels.ModelFor(ctx)
|
||||
if err != nil {
|
||||
log.WarnContext(ctx, "curators disabled: chat model unavailable; configure a chat model and restart the gateway", "err", err)
|
||||
return false
|
||||
return fmt.Errorf("curators disabled until the gateway restarts with a chat model: %w", err)
|
||||
}
|
||||
skillsRoot := b.cfg.SkillsDir
|
||||
if skillsRoot == "" {
|
||||
@@ -60,7 +60,7 @@ func (b *server) setupCurators(ctx context.Context) bool {
|
||||
b.addCleanup(shutdownCuratorRuntime(rt, log))
|
||||
reg := b.curatorRegistry
|
||||
b.addCleanup(shutdownCuratorRegistry(reg, log))
|
||||
return true
|
||||
return nil
|
||||
}
|
||||
|
||||
//nolint:contextcheck // shutdown runs after the parent context is cancelled
|
||||
@@ -218,7 +218,10 @@ func (b *server) watchCurators(ctx context.Context, version int64) error {
|
||||
|
||||
func (b *server) startCurators(ctx context.Context) error {
|
||||
// Curators wake on this process's turns and read its conversations.
|
||||
if !b.setupCurators(ctx) {
|
||||
// A disabled runtime is reported, so the dashboard shows why curators do
|
||||
// not apply rather than a process that never reported.
|
||||
if err := b.setupCurators(ctx); err != nil {
|
||||
b.applyStatus.Report(ctx, controlplanestore.CuratorsKind, 0, err)
|
||||
return nil
|
||||
}
|
||||
if err := b.curatorRuntime.Start(ctx); err != nil {
|
||||
|
||||
Reference in new issue
Block a user