fix(tools): let an optional provider fail without taking the daemon down
provider.Registry.Start was atomic for every provider: one failure unregistered every other provider including the builtins, returned an error up through the capability host, and exited archied. Under Restart=on-failure that is a crash loop. Observed on carina 2026-07-30 -- mcp.desktop-commander could not start because the runtime image was missing unzip, and the daemon restarted continuously, losing chat, the gateway and every builtin tool over one third-party npm package. Atomicity is right for a provider archied requires. It is wrong for an external MCP server pulled from a registry at runtime, which is exactly the category allowed to be absent -- the same reasoning already applied to the forge, and to containers. RegisterOptional marks a provider the daemon can run without. Its failure to start, discover or index stops only itself and excludes it; Register keeps today's rollback. Required/optional is a deployment fact rather than a property of the code, so the registrar states it instead of the engine declaring it in its own manifest -- which also keeps plugin.Manifest metadata-only, per the plugin engine rule. A skipped provider's dependents cannot run either: an optional dependent is skipped with the reason, a required one is a hard failure, since it declared it cannot work without something now absent. Degradation is reported, not silent -- Health goes degraded naming each provider and cause, Skipped() exposes the set, and the daemon logs one error line per exclusion. Silence is how this went unnoticed until the crash loop. A provider that half-started before failing is still stopped, so no child process is left behind. The regression test drives the real capability host, the path main.go calls: with desktop-commander registered as required it fails with the verbatim carina error, and as optional the daemon starts with its builtins intact. Closes archie-core-ky6
This commit is contained in:
1 parent
d95b3a871c
commit
a2b2dc9ef2
4 files changed
+472
-22
No files matched your search
+15
-3
@@ -630,9 +630,15 @@ func run() int {
|
||||
log.Warn("mcp tool provider skipped", "name", srv.Name, "err", err)
|
||||
continue
|
||||
}
|
||||
if err := providerRegistry.Register(provider); err != nil {
|
||||
log.Error("mcp tool provider registration failed", "name", srv.Name, "err", err)
|
||||
return 1
|
||||
// Optional: an MCP server is a third-party process pulled in at
|
||||
// runtime, and it is exactly the category that is allowed to be
|
||||
// absent. Registering it as required meant one failing npm package
|
||||
// unregistered every builtin tool and exited the daemon, which under
|
||||
// Restart=on-failure is a crash loop that takes chat and the gateway
|
||||
// with it.
|
||||
if err := providerRegistry.RegisterOptional(provider); err != nil {
|
||||
log.Warn("mcp tool provider skipped", "name", srv.Name, "err", err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
if err := capabilityHost.Register(providerRegistry); err != nil {
|
||||
@@ -694,6 +700,12 @@ func run() int {
|
||||
log.Error("capability host startup", "err", err)
|
||||
return 1
|
||||
}
|
||||
// Optional providers that could not start are excluded rather than fatal,
|
||||
// so the only way an operator learns about one is this line.
|
||||
for _, skipped := range providerRegistry.Skipped() {
|
||||
log.Error("tool provider unavailable; archie is running without its tools",
|
||||
"provider", skipped.ID, "err", skipped.Err)
|
||||
}
|
||||
|
||||
if err := d.Startup(ctx); err != nil {
|
||||
log.Error("startup", "err", err)
|
||||
|
||||
Reference in new issue
Block a user