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(cloud): find the exclude file in linked worktrees, and outside git checkouts
shukieshahef4635364f23
diff --git a/cli/beacon/cmd/cloud.go b/cli/beacon/cmd/cloud.goindex 2eb9595b..7a98eb97 100644--- a/cli/beacon/cmd/cloud.go+++ b/cli/beacon/cmd/cloud.go@@ -328,10 +328,17 @@ fimkdir -p "$REPO_ROOT/.cursor"cat > "$REPO_ROOT/.cursor/hooks.json" <<'BEACON_HOOKS'%sBEACON_HOOKS-# info/exclude is never committed, so the agent does not see the hooks file as a change.-EXCLUDE="$(git -C "$REPO_ROOT" rev-parse --absolute-git-dir)/info/exclude"-mkdir -p "$(dirname "$EXCLUDE")"-grep -qxF '.cursor/hooks.json' "$EXCLUDE" 2>/dev/null || echo '.cursor/hooks.json' >> "$EXCLUDE"+# info/exclude is never committed, so the agent does not see the hooks file as a change. Git reads+# it from the common directory, which --git-path names in a linked worktree too.+EXCLUDE="$(git -C "$REPO_ROOT" rev-parse --git-path info/exclude 2>/dev/null || true)"+case "$EXCLUDE" in+ "" | /*) ;;+ *) EXCLUDE="$REPO_ROOT/$EXCLUDE" ;;+esac+if [ -n "$EXCLUDE" ]; then+ mkdir -p "$(dirname "$EXCLUDE")"+ grep -qxF '.cursor/hooks.json' "$EXCLUDE" 2>/dev/null || echo '.cursor/hooks.json' >> "$EXCLUDE"+fiecho "Beacon wrote $REPO_ROOT/.cursor/hooks.json"`, version, hooks), nil}diff --git a/cli/beacon/cmd/cloud_test.go b/cli/beacon/cmd/cloud_test.goindex ff36154d..01962adb 100644--- a/cli/beacon/cmd/cloud_test.go+++ b/cli/beacon/cmd/cloud_test.go@@ -95,6 +95,9 @@ func TestRenderCursorCloudSetupWritesExcludedHooks(t *testing.T) {`"afterAgentThought"`,`BEACON_ORIGIN=cloud BEACON_RUN_PROVIDER=cursor_cloud`,`grep -qxF '.cursor/hooks.json' "$EXCLUDE" 2>/dev/null || echo '.cursor/hooks.json' >> "$EXCLUDE"`,+ // The common directory's exclude file, which git reads in a linked worktree too, and no+ // failure (under set -e) outside a git checkout.+ `EXCLUDE="$(git -C "$REPO_ROOT" rev-parse --git-path info/exclude 2>/dev/null || true)"`,// A repository's own committed hooks are never overwritten.`git -C "$REPO_ROOT" ls-files --error-unmatch .cursor/hooks.json`,} {@@ -111,6 +114,9 @@ func TestRenderCursorCloudSetupWritesExcludedHooks(t *testing.T) {if err != nil {t.Fatalf("render safe cursor cloud setup: %v", err)}+ if strings.Contains(got, "--absolute-git-dir") {+ t.Fatalf("setup must not find info/exclude through the worktree's own git dir:\n%s", got)+ }if strings.Contains(safe, `"beforeShellExecution"`) {t.Fatalf("--safe-hooks setup should leave out the shell hooks:\n%s", safe)}