Skip to content

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

Fix stop errors being silently discarded on child/start failures

Cursor Agentd2714228dc48
diff --git a/cli/beacon/cmd/ci.go b/cli/beacon/cmd/ci.go
index 3b9ea2c1..e2c22a2a 100644
--- a/cli/beacon/cmd/ci.go
+++ b/cli/beacon/cmd/ci.go
@@ -97,12 +97,12 @@ func runCIExec(cmd *cobra.Command, args []string) error {
stopCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
stopErr := session.Stop(stopCtx)
cancel()
- if childErr != nil {
- return childErr
- }
if stopErr != nil {
fmt.Fprintf(os.Stderr, "Warning: collector stop: %v\n", stopErr)
}
+ if childErr != nil {
+ return childErr
+ }
result := beaconci.Validate(beaconci.ValidationOptions{
LogPath: session.LogPath,
MinEvents: ciOpts.minEvents,
diff --git a/cli/beacon/internal/ci/session.go b/cli/beacon/internal/ci/session.go
index 337c46c5..274b99cd 100644
--- a/cli/beacon/internal/ci/session.go
+++ b/cli/beacon/internal/ci/session.go
@@ -178,8 +178,11 @@ func (s *Session) Start(ctx context.Context, stdout, stderr io.Writer) error {
}
if readyErr != nil {
cleanupCtx, cleanupCancel := context.WithTimeout(context.Background(), 5*time.Second)
- _ = s.Stop(cleanupCtx)
+ stopErr := s.Stop(cleanupCtx)
cleanupCancel()
+ if stopErr != nil {
+ return fmt.Errorf("%w; collector stop also failed: %v", readyErr, stopErr)
+ }
return readyErr
}
return nil