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(endpoint): clarify rollback restart semantics
shukieshaha488ad973cec
diff --git a/cli/beacon/internal/endpoint/selfupdate/apply.go b/cli/beacon/internal/endpoint/selfupdate/apply.goindex 31a3630c..f9b5a514 100644--- a/cli/beacon/internal/endpoint/selfupdate/apply.go+++ b/cli/beacon/internal/endpoint/selfupdate/apply.go@@ -21,6 +21,8 @@ import (// MB; this is a generous ceiling that still bounds a hostile response.const maxPackageBytes = 512 << 20+const collectorHealthTimeout = 60 * time.Second+// runnerFunc executes an external command and returns combined output. It is// injectable so tests can avoid real installer/pkgutil/launchctl calls.type runnerFunc func(ctx context.Context, name string, args ...string) (string, error)@@ -377,12 +379,12 @@ func (a *Applier) rollback(backup string, result *ApplyResult) error {return err}_ = os.RemoveAll(failed)+ result.RolledBack = trueif !a.AllowInsecureTest {if err := a.restartCollector(); err != nil {return err}}- result.RolledBack = truereturn nil}@@ -402,7 +404,7 @@ func (a *Applier) healthCheck(ctx context.Context, wantVersion string) error {}// Give launchd a moment to relaunch the collector via the pkg postinstall.mgr := service.Manager{UserMode: false}- deadline := a.clock()().Add(15 * time.Second)+ deadline := a.clock()().Add(collectorHealthTimeout)for {if mgr.Status().Running {return nildiff --git a/cli/beacon/internal/endpoint/selfupdate/apply_test.go b/cli/beacon/internal/endpoint/selfupdate/apply_test.goindex 1356a22f..2791a87b 100644--- a/cli/beacon/internal/endpoint/selfupdate/apply_test.go+++ b/cli/beacon/internal/endpoint/selfupdate/apply_test.go@@ -286,8 +286,8 @@ func TestRollbackReportsCollectorRestartFailure(t *testing.T) {if got := string(mustRead(t, liveBin)); got != "backup" {t.Fatalf("filesystem rollback did not restore backup: %q", got)}- if result.RolledBack {- t.Fatal("RolledBack should remain false when collector restart fails")+ if !result.RolledBack {+ t.Fatal("RolledBack should be true when filesystem rollback completed")}}