Skip to content

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

Fix antigravity hook telemetry bugs: failed edits, quoted paths, duplicate prompts, edit_file diffs

Cursor Agente99eaf77b655
diff --git a/cli/beacon-hooks/cmd/post_tool.go b/cli/beacon-hooks/cmd/post_tool.go
index c7ce1f45..001d0ba2 100644
--- a/cli/beacon-hooks/cmd/post_tool.go
+++ b/cli/beacon-hooks/cmd/post_tool.go
@@ -138,6 +138,10 @@ func parseClaudeCopilotInput(input map[string]interface{}, logger *logging.Logge
return nil
}
+ if platformFlag == "antigravity" && getFirstStr(input, "error") != "" {
+ return nil
+ }
+
filePath := diff.GetStringFromMaps("file_path", toolInput, toolResponse)
if filePath == "" {
filePath = diff.GetStringFromMaps("filePath", toolInput, toolResponse)
@@ -151,6 +155,7 @@ func parseClaudeCopilotInput(input map[string]interface{}, logger *logging.Logge
if filePath == "" {
filePath = diff.GetStringFromMaps("AbsolutePath", toolInput, toolResponse)
}
+ filePath = diff.NormalizePath(filePath)
if (sessionID == "" && platformFlag != "devin") || toolName == "" || filePath == "" {
return nil
diff --git a/cli/beacon-hooks/cmd/prompt_submit.go b/cli/beacon-hooks/cmd/prompt_submit.go
index 95f24dbf..cd975308 100644
--- a/cli/beacon-hooks/cmd/prompt_submit.go
+++ b/cli/beacon-hooks/cmd/prompt_submit.go
@@ -5,6 +5,7 @@ import (
"github.com/asymptote-labs/agent-beacon/cli/beacon-hooks/internal/config"
"github.com/asymptote-labs/agent-beacon/cli/beacon-hooks/internal/logging"
+ "github.com/asymptote-labs/agent-beacon/cli/beacon-hooks/internal/state"
)
var promptSubmitCmd = &cobra.Command{
@@ -48,5 +49,10 @@ func runPromptSubmit(cmd *cobra.Command, args []string) {
}
emitHookEvent(logger, "prompt.submitted", "prompt", "info", "Prompt submitted to agent", input, fields)
+ if platformFlag == "antigravity" && sessionID != "" {
+ st := state.NewSessionState(sessionID, "antigravity")
+ st.SetPromptEmitted()
+ }
+
outputJSON(noopResponse)
}
diff --git a/cli/beacon-hooks/internal/diff/diff.go b/cli/beacon-hooks/internal/diff/diff.go
index f689161d..62902451 100644
--- a/cli/beacon-hooks/internal/diff/diff.go
+++ b/cli/beacon-hooks/internal/diff/diff.go
@@ -21,6 +21,7 @@ func FromToolResponse(toolName string, toolInput, toolResponse map[string]interf
if filePath == "" {
filePath = GetStringFromMaps("AbsolutePath", toolInput, toolResponse)
}
+ filePath = NormalizePath(filePath)
if filePath == "" {
return ""
}
@@ -32,7 +33,7 @@ func FromToolResponse(toolName string, toolInput, toolResponse map[string]interf
// Fall back to tool-specific construction
switch toolName {
- case "Edit", "edit":
+ case "Edit", "edit", "edit_file":
oldString := resolveEditString("old_string", "oldString", "old_str", toolInput, toolResponse)
newString := resolveEditString("new_string", "newString", "new_str", toolInput, toolResponse)
return fromEditTool(filePath, oldString, newString)
@@ -303,6 +304,12 @@ func splitLines(s string) []string {
return strings.Split(s, "\n")
}
+// NormalizePath strips surrounding double quotes and whitespace from a path string.
+func NormalizePath(s string) string {
+ s = strings.TrimSpace(s)
+ return strings.Trim(s, `"`)
+}
+
// GetStringFromMaps returns the first non-empty string value for key across the given maps.
func GetStringFromMaps(key string, maps ...map[string]interface{}) string {
for _, m := range maps {