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
file name fix
Justin D'Souza0453cf5b67c1
diff --git a/cli/beacon-hooks/internal/cloudshuttle/shuttle.go b/cli/beacon-hooks/internal/cloudshuttle/shuttle.goindex 4bfcb837..c0558f4e 100644--- a/cli/beacon-hooks/internal/cloudshuttle/shuttle.go+++ b/cli/beacon-hooks/internal/cloudshuttle/shuttle.go@@ -72,6 +72,8 @@ type state struct {LastUpload string `json:"last_upload,omitempty"`LastSize int64 `json:"last_size,omitempty"`LastObject string `json:"last_object,omitempty"`+ Provider string `json:"provider,omitempty"`+ RunID string `json:"run_id,omitempty"`}type tokenResponse struct {@@ -158,7 +160,7 @@ func Upload(ctx context.Context, cfg Config, force bool) error {return err}defer cleanup()- objectName := ObjectName(cfg)+ objectName := uploadObjectName(cfg)if err := uploadSnapshot(ctx, cfg, objectName, snapshot); err != nil {return err}@@ -166,9 +168,32 @@ func Upload(ctx context.Context, cfg Config, force bool) error {LastUpload: time.Now().UTC().Format(time.RFC3339),LastSize: info.Size(),LastObject: objectName,+ Provider: cfg.Provider,+ RunID: cfg.RunID,})}+func uploadObjectName(cfg Config) string {+ st, err := readState(cfg.StatePath)+ if err == nil && stateObjectMatchesConfig(st, cfg) {+ return strings.TrimSpace(st.LastObject)+ }+ return ObjectName(cfg)+}++func stateObjectMatchesConfig(st state, cfg Config) bool {+ objectName := strings.TrimSpace(st.LastObject)+ if objectName == "" {+ return false+ }+ if st.Provider != "" || st.RunID != "" {+ return st.Provider == cfg.Provider && st.RunID == cfg.RunID+ }+ provider := cleanKeyPart(defaultString(cfg.Provider, "unknown"))+ runID := cleanKeyPart(defaultString(cfg.RunID, "unknown"))+ return strings.HasSuffix(path.Base(objectName), "-"+provider+"-"+runID+".jsonl.gz")+}+func ObjectName(cfg Config) string {now := nowUTC()parts := cleanKeyParts(cfg.Prefix)diff --git a/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go b/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.goindex ba061004..1b6d177b 100644--- a/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go+++ b/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go@@ -270,6 +270,59 @@ func TestUploadSendsJSONLToS3(t *testing.T) {}}+func TestUploadReusesLastObjectForSameRun(t *testing.T) {+ current := time.Date(2026, 7, 12, 20, 17, 3, 0, time.UTC)+ restore := stubNowFunc(t, func() time.Time { return current })+ defer restore()+ var uploadedPaths []string+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ uploadedPaths = append(uploadedPaths, r.URL.EscapedPath())+ w.WriteHeader(http.StatusOK)+ }))+ defer server.Close()++ dir := t.TempDir()+ logPath := filepath.Join(dir, "runtime.jsonl")+ if err := os.WriteFile(logPath, []byte("{\"event\":\"first\"}\n"), 0644); err != nil {+ t.Fatalf("write log: %v", err)+ }+ cfg := Config{+ Upload: uploadS3,+ LogPath: logPath,+ StatePath: filepath.Join(dir, "state.json"),+ Bucket: "bucket",+ Prefix: "prefix",+ Provider: "cursor_cloud",+ RunID: "run",+ S3Region: "us-west-2",+ S3AccessKeyID: "AKIATEST",+ S3SecretKey: "secret",+ S3Endpoint: server.URL,+ }+ if err := Upload(context.Background(), cfg, true); err != nil {+ t.Fatalf("first Upload returned error: %v", err)+ }++ current = current.Add(2 * time.Minute)+ if err := os.WriteFile(logPath, []byte("{\"event\":\"second\"}\n"), 0644); err != nil {+ t.Fatalf("rewrite log: %v", err)+ }+ if err := Upload(context.Background(), cfg, true); err != nil {+ t.Fatalf("second Upload returned error: %v", err)+ }++ if len(uploadedPaths) != 2 {+ t.Fatalf("uploaded paths = %v, want 2 uploads", uploadedPaths)+ }+ if uploadedPaths[0] != uploadedPaths[1] {+ t.Fatalf("Upload used different object keys: first=%q second=%q", uploadedPaths[0], uploadedPaths[1])+ }+ want := "/bucket/prefix/runtime/date=2026-07-12/1783887423-cursor_cloud-run.jsonl.gz"+ if uploadedPaths[0] != want {+ t.Fatalf("upload path = %q, want %q", uploadedPaths[0], want)+ }+}+func TestResolveRunIDUsesOnlyEnvironment(t *testing.T) {t.Setenv("CLAUDE_CODE_REMOTE_SESSION_ID", "cse_env")if got := resolveRunID(); got != "cse_env" {@@ -302,9 +355,14 @@ func mustRSAKey(t *testing.T) *rsa.PrivateKey {}func stubNow(t *testing.T, value time.Time) func() {+ t.Helper()+ return stubNowFunc(t, func() time.Time { return value.UTC() })+}++func stubNowFunc(t *testing.T, fn func() time.Time) func() {t.Helper()old := nowUTC- nowUTC = func() time.Time { return value.UTC() }+ nowUTC = func() time.Time { return fn().UTC() }return func() { nowUTC = old }}