Skip to content

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

Avoid blocking hooks on periodic uploads

shukieshahf9b4316d6a65
diff --git a/cli/beacon-hooks/cmd/endpoint_events.go b/cli/beacon-hooks/cmd/endpoint_events.go
index c6b1c9ae..153ef6c4 100644
--- a/cli/beacon-hooks/cmd/endpoint_events.go
+++ b/cli/beacon-hooks/cmd/endpoint_events.go
@@ -42,9 +42,6 @@ func emitHookEvent(logger *logging.Logger, action, category, severity, message s
if err := logger.EndpointEvent(action, category, severity, message, fields); err != nil {
logger.Error("Failed to write endpoint event", "error", err.Error(), "action", action)
}
- if !isFinalUploadAction(action) {
- uploadCloudTelemetry(logger, false)
- }
}
func uploadCloudTelemetry(logger *logging.Logger, force bool) {
@@ -55,15 +52,6 @@ func uploadCloudTelemetry(logger *logging.Logger, force bool) {
}
}
-func isFinalUploadAction(action string) bool {
- switch action {
- case "tool.completed", "session.ended":
- return true
- default:
- return false
- }
-}
-
func sessionFields(sessionID string, input map[string]interface{}) map[string]interface{} {
fields := map[string]interface{}{}
session := map[string]interface{}{}
diff --git a/cli/beacon-hooks/internal/cloudshuttle/shuttle.go b/cli/beacon-hooks/internal/cloudshuttle/shuttle.go
index 22172617..dce3eb65 100644
--- a/cli/beacon-hooks/internal/cloudshuttle/shuttle.go
+++ b/cli/beacon-hooks/internal/cloudshuttle/shuttle.go
@@ -113,14 +113,6 @@ func ResetFromEnv() error {
return err
}
}
- if cfg.Interval > 0 {
- if err := writeState(cfg.StatePath, state{
- LastUpload: time.Now().UTC().Format(time.RFC3339),
- LastSize: 0,
- }); err != nil {
- return err
- }
- }
return nil
}
@@ -190,7 +182,7 @@ func uploadDue(cfg Config, currentSize int64, now time.Time) bool {
}
st, err := readState(cfg.StatePath)
if err != nil {
- return false
+ return true
}
if currentSize != st.LastSize {
// Still respect interval to avoid uploading on every hook during active runs.
diff --git a/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go b/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go
index a9c6a8a5..c0c4125f 100644
--- a/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go
+++ b/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go
@@ -58,14 +58,11 @@ func TestResetFromEnvRemovesCloudRuntimeFiles(t *testing.T) {
if err := ResetFromEnv(); err != nil {
t.Fatalf("ResetFromEnv returned error: %v", err)
}
- for _, path := range []string{logPath, logPath + ".lock", statePath + ".run-id"} {
+ for _, path := range []string{logPath, logPath + ".lock", statePath, statePath + ".run-id"} {
if _, err := os.Stat(path); !os.IsNotExist(err) {
t.Fatalf("%s still exists, stat err=%v", path, err)
}
}
- if _, err := os.Stat(statePath); err != nil {
- t.Fatalf("state path should be recreated to throttle first periodic upload: %v", err)
- }
}
func TestUploadSendsJSONLToGCS(t *testing.T) {