The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Fix CI session lifecycle bugs: stop/validate ordering, cleanup hangs, path mismatches, signal handling, env overrides
Cursor Agent5ccf3166b2fe
diff --git a/cli/beacon/cmd/ci.go b/cli/beacon/cmd/ci.goindex cc6b3b3e..3b9ea2c1 100644--- a/cli/beacon/cmd/ci.go+++ b/cli/beacon/cmd/ci.go@@ -101,7 +101,7 @@ func runCIExec(cmd *cobra.Command, args []string) error {return childErr}if stopErr != nil {- return stopErr+ fmt.Fprintf(os.Stderr, "Warning: collector stop: %v\n", stopErr)}result := beaconci.Validate(beaconci.ValidationOptions{LogPath: session.LogPath,@@ -117,9 +117,10 @@ func runCIExec(cmd *cobra.Command, args []string) error {}if !ciOpts.keepArtifacts && result.Status != "fail" && childExit == 0 && ciOpts.baseDir == "" && ciOpts.logPath == "" {if err := os.RemoveAll(session.BaseDir); err != nil {- return err+ fmt.Fprintf(os.Stderr, "Warning: artifact cleanup: %v\n", err)+ } else {+ execResult.ArtifactMessage = "Beacon CI artifacts cleaned"}- execResult.ArtifactMessage = "Beacon CI artifacts cleaned"}if ciOpts.jsonOutput {_ = json.NewEncoder(os.Stdout).Encode(execResult)diff --git a/cli/beacon/internal/ci/harness.go b/cli/beacon/internal/ci/harness.goindex 9e0a1e5f..cb31cdbe 100644--- a/cli/beacon/internal/ci/harness.go+++ b/cli/beacon/internal/ci/harness.go@@ -14,6 +14,9 @@ func ClaudeEnv(base []string, endpoint string, retention endpointconfig.ContentRenv["OTEL_METRICS_EXPORTER"] = "otlp"env["OTEL_EXPORTER_OTLP_PROTOCOL"] = "grpc"env["OTEL_EXPORTER_OTLP_ENDPOINT"] = endpoint+ delete(env, "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT")+ delete(env, "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT")+ delete(env, "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT")if retention == endpointconfig.ContentRetentionMetadata {delete(env, "OTEL_LOG_USER_PROMPTS")} else {diff --git a/cli/beacon/internal/ci/session.go b/cli/beacon/internal/ci/session.goindex 410a1c7c..337c46c5 100644--- a/cli/beacon/internal/ci/session.go+++ b/cli/beacon/internal/ci/session.go@@ -86,6 +86,11 @@ func Provision(opts Options) (*Session, error) {logPath := opts.LogPathif logPath == "" {logPath = filepath.Join(baseDir, "runtime.jsonl")+ } else if !filepath.IsAbs(logPath) {+ logPath, err = filepath.Abs(logPath)+ if err != nil {+ return nil, err+ }}grpcPort := opts.GRPCPortif grpcPort == 0 {@@ -161,9 +166,21 @@ func (s *Session) Start(ctx context.Context, stdout, stderr io.Writer) error {go func() {s.done <- cmd.Wait()}()- if err := waitCollectorReady(s.cfg, 10*time.Second); err != nil {- _ = s.Stop(context.Background())- return err+ readyCh := make(chan error, 1)+ go func() {+ readyCh <- waitCollectorReady(s.cfg, 10*time.Second)+ }()+ var readyErr error+ select {+ case readyErr = <-readyCh:+ case <-ctx.Done():+ readyErr = ctx.Err()+ }+ if readyErr != nil {+ cleanupCtx, cleanupCancel := context.WithTimeout(context.Background(), 5*time.Second)+ _ = s.Stop(cleanupCtx)+ cleanupCancel()+ return readyErr}return nil}@@ -260,7 +277,11 @@ func resolveBaseDir(configured, logPath string) (string, error) {}return filepath.Abs(base)}- return os.MkdirTemp("", "beacon-ci-*")+ base := filepath.Join(os.TempDir(), "beacon")+ if err := os.MkdirAll(base, 0755); err != nil {+ return "", err+ }+ return filepath.Abs(base)}func DefaultLogPath() string {