Skip to content

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

Fix three CLI bugs: test-event ignoring failed writable check, discover --all flag unused, bundle-diagnostics leaking last event

Cursor Agentd3e1908fb01c
diff --git a/cli/beacon/cmd/endpoint.go b/cli/beacon/cmd/endpoint.go
index 44eeba4f..b046d026 100644
--- a/cli/beacon/cmd/endpoint.go
+++ b/cli/beacon/cmd/endpoint.go
@@ -1183,9 +1183,21 @@ func runEndpointStatus(cmd *cobra.Command, args []string) error {
func runEndpointDiscover(cmd *cobra.Command, args []string) error {
discovered := harness.DiscoverAll()
if endpointOpts.jsonOutput {
+ if !endpointOpts.allTargets {
+ filtered := []harness.Harness{}
+ for _, h := range discovered {
+ if h.Detected {
+ filtered = append(filtered, h)
+ }
+ }
+ return json.NewEncoder(os.Stdout).Encode(filtered)
+ }
return json.NewEncoder(os.Stdout).Encode(discovered)
}
for _, h := range discovered {
+ if !endpointOpts.allTargets && !h.Detected {
+ continue
+ }
state := "not detected"
if h.Detected {
state = "detected"
diff --git a/cli/beacon/cmd/endpoint_robust.go b/cli/beacon/cmd/endpoint_robust.go
index cadebf8f..cfde49f3 100644
--- a/cli/beacon/cmd/endpoint_robust.go
+++ b/cli/beacon/cmd/endpoint_robust.go
@@ -138,8 +138,22 @@ func runEndpointInventory(cmd *cobra.Command, args []string) error {
func runEndpointTestEvent(cmd *cobra.Command, args []string) error {
cfg := loadOrDefaultConfig()
- stages := []validationStage{
- stageFromCheck(checkLogWritable(cfg)),
+ writableStage := stageFromCheck(checkLogWritable(cfg))
+ stages := []validationStage{writableStage}
+ if writableStage.Status != "ok" {
+ if endpointOpts.jsonOutput {
+ _ = json.NewEncoder(os.Stdout).Encode(stages)
+ } else {
+ fmt.Printf("%s: %s", writableStage.Name, writableStage.Status)
+ if writableStage.Target != "" {
+ fmt.Printf(" target=%s", writableStage.Target)
+ }
+ if writableStage.Message != "" {
+ fmt.Printf(" (%s)", writableStage.Message)
+ }
+ fmt.Println()
+ }
+ return fmt.Errorf("runtime log is not writable: %s", writableStage.Evidence)
}
path, err := writeValidationEvent(cfg, "pipeline")
if err != nil {
@@ -176,6 +190,7 @@ func runEndpointBundleDiagnostics(cmd *cobra.Command, args []string) error {
return err
}
status := lifecycle.GetStatus(endpointUserMode(), endpointOpts.logPath)
+ status.LastEvent = redactLastEvent(status.LastEvent)
if err := writeJSONFile(filepath.Join(out, "status.json"), status); err != nil {
return err
}
@@ -424,6 +439,13 @@ func stageFromCheck(check diagnostics.Check) validationStage {
return validationStage{Name: check.Name, Target: check.Target, Status: check.Status, Severity: check.Severity, Message: check.Message, Evidence: check.Evidence}
}
+func redactLastEvent(raw string) string {
+ if raw == "" {
+ return ""
+ }
+ return "[present]"
+}
+
func redactConfig(cfg endpointconfig.Config) endpointconfig.Config {
if cfg.Destinations != nil && cfg.Destinations.SplunkHEC != nil && cfg.Destinations.SplunkHEC.Token != "" {
destinations := *cfg.Destinations