Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Fix doctor exit code and inventory config scope bugs

Cursor Agentf6dfae930f34
diff --git a/cli/beacon/cmd/endpoint.go b/cli/beacon/cmd/endpoint.go
index b046d026..1c0a3e82 100644
--- a/cli/beacon/cmd/endpoint.go
+++ b/cli/beacon/cmd/endpoint.go
@@ -1284,6 +1284,19 @@ func loadOrDefaultConfig() endpointconfig.Config {
return endpointconfig.Default(userMode, logPath)
}
+func loadConfigForMode(userMode bool, logPath string) endpointconfig.Config {
+ if cfg, err := endpointconfig.Load(userMode); err == nil {
+ if logPath != "" {
+ cfg.LogPath = logPath
+ }
+ return cfg
+ }
+ if logPath == "" {
+ logPath = writer.DefaultPath(userMode)
+ }
+ return endpointconfig.Default(userMode, logPath)
+}
+
func endpointUserMode() bool {
return endpointOpts.userMode && !endpointOpts.systemMode
}
diff --git a/cli/beacon/cmd/endpoint_robust.go b/cli/beacon/cmd/endpoint_robust.go
index 95a3d3c1..fa309745 100644
--- a/cli/beacon/cmd/endpoint_robust.go
+++ b/cli/beacon/cmd/endpoint_robust.go
@@ -100,19 +100,23 @@ func runEndpointDoctor(cmd *cobra.Command, args []string) error {
if result.Status == "ok" {
fmt.Println("All endpoint health checks passed.")
}
+ if result.Status == "fail" {
+ return fmt.Errorf("endpoint health checks failed")
+ }
return nil
}
func runEndpointInventory(cmd *cobra.Command, args []string) error {
status := lifecycle.GetStatus(endpointUserMode(), endpointOpts.logPath)
+ effectiveCfg := loadConfigForMode(status.RuntimeLog.EffectiveUserMode, status.LogPath)
result := inventoryResult{
GeneratedAt: time.Now().UTC().Format(time.RFC3339),
RuntimeLog: status.RuntimeLog,
ConfigPath: status.ConfigPath,
LogPath: status.LogPath,
- ContentRetention: loadOrDefaultConfig().ContentRetention,
+ ContentRetention: effectiveCfg.ContentRetention,
Harnesses: status.Harnesses,
- Hooks: hookStatuses(hookTargets()),
+ Hooks: hookStatusesWithConfig(hookTargets(), effectiveCfg),
Destinations: status.Destinations,
LastEventObserved: status.LastEvent != "",
}
@@ -354,6 +358,10 @@ func hookTargets() []string {
func hookStatuses(targets []string) map[string]hookTargetResult {
cfg := loadOrDefaultConfig()
+ return hookStatusesWithConfig(targets, cfg)
+}
+
+func hookStatusesWithConfig(targets []string, cfg endpointconfig.Config) map[string]hookTargetResult {
statuses := map[string]hookTargetResult{}
for _, name := range targets {
switch strings.TrimSpace(name) {