Skip to content

Fix external agents detection - #893

Merged
nodo merged 6 commits into
mainfrom
nodo/ext-agents-detection
Apr 9, 2026
Merged

nodo merged 6 commits into
mainfrom
nodo/ext-agents-detection

Conversation

@nodo

@nodo nodo commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes a bug when running entire enable having an external agents on the PATH.

Note

Medium Risk
Changes first-run agent auto-detection/preselection behavior to treat external agents differently, which can alter interactive setup outcomes and defaults for users with external binaries on PATH.

Overview
Adjusts detectOrSelectAgent so first-run auto-selection and default pre-selection only apply to built-in agents; if the only detected agent is external, the flow now falls through to the interactive selector instead of auto-accepting it.

Strengthens test isolation from host-installed external agents by filtering PATH in TestMain/test setup, and adds new tests with a mock entire-agent-* binary to validate external-only detection prompts and isBuiltInAgent behavior.

Reviewed by Cursor Bugbot for commit 68db6dd. Configure here.

@nodo
nodo requested a review from a team as a code owner April 9, 2026 12:09
Copilot AI review requested due to automatic review settings April 9, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts agent detection/selection during initial setup so external agents don’t get auto-selected just because they’re the only detected agent.

Changes:

  • Only auto-select a single detected agent on first run when it’s a built-in agent.
  • Pre-select only detected built-in agents on first run (external agents remain opt-in via prompt).
  • Add unit tests covering “external-only detected” prompting behavior and built-in/external classification.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
cmd/entire/cli/setup.go Updates first-run auto-selection/preselection logic to exclude external agents; adds isBuiltInAgent helper.
cmd/entire/cli/setup_test.go Adds test helpers for external agent binaries and new tests validating prompting/classification behavior.
cmd/entire/cli/global_test.go Filters PATH in TestMain to avoid picking up real external agents during unit tests.

Comment thread cmd/entire/cli/setup.go
Comment thread cmd/entire/cli/setup_test.go Outdated
Comment thread cmd/entire/cli/setup_test.go

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Test uses git.PlainInit instead of testutil.InitRepo
    • Replaced git.PlainInit in setupTestRepo with testutil.InitRepo and updated imports so all tests using this helper now get the required git test configuration.

Create PR

Or push these changes by commenting:

@cursor push 079746b217
Preview (079746b217)
diff --git a/cmd/entire/cli/setup_test.go b/cmd/entire/cli/setup_test.go
--- a/cmd/entire/cli/setup_test.go
+++ b/cmd/entire/cli/setup_test.go
@@ -21,7 +21,7 @@
 	"github.com/entireio/cli/cmd/entire/cli/session"
 	"github.com/entireio/cli/cmd/entire/cli/settings"
 	"github.com/entireio/cli/cmd/entire/cli/strategy"
-	"github.com/go-git/go-git/v6"
+	"github.com/entireio/cli/cmd/entire/cli/testutil"
 )
 
 // Note: Tests for hook manipulation functions (addHookToMatcher, hookCommandExists, etc.)
@@ -44,9 +44,7 @@
 func setupTestRepo(t *testing.T) {
 	t.Helper()
 	tmpDir := setupTestDir(t)
-	if _, err := git.PlainInit(tmpDir, false); err != nil {
-		t.Fatalf("Failed to init repo: %v", err)
-	}
+	testutil.InitRepo(t, tmpDir)
 }
 
 // writeSettings writes settings content to the settings file.

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 68db6dd. Configure here.

Comment thread cmd/entire/cli/setup_test.go
@nodo

nodo commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

@cursor push 079746b

@nodo
nodo force-pushed the nodo/ext-agents-detection branch from 308204a to 9b80f5e Compare April 9, 2026 12:47
nodo and others added 4 commits April 9, 2026 14:57
Entire-Checkpoint: e9b7d181b850
Entire-Checkpoint: 7e76e12bc745
Entire-Checkpoint: 4a0d4e692d5a
@nodo
nodo force-pushed the nodo/ext-agents-detection branch from 9b80f5e to 32fbf07 Compare April 9, 2026 12:57
Comment thread cmd/entire/cli/global_test.go Outdated
pjbgf
pjbgf previously approved these changes Apr 9, 2026
Entire-Checkpoint: 02acec3af4db
@nodo
nodo enabled auto-merge April 9, 2026 16:00
@nodo
nodo merged commit 5b06490 into main Apr 9, 2026
8 checks passed
@nodo
nodo deleted the nodo/ext-agents-detection branch April 9, 2026 16:02
peyton-alt added a commit that referenced this pull request Aug 28, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
peyton-alt added a commit that referenced this pull request Sep 21, 2026
agy executes .agents/hooks.json hooks in Gemini API-key mode from 1.1.25
on (bisected across the mac release binaries with a probe hook in an
isolated HOME: 1.1.22–1.1.24 fire nothing, 1.1.25/1.2.0/1.2.7 fire
PreInvocation + Stop; upstream google-antigravity/antigravity-cli#893 is
still open and the release notes never mention it). CI installs
releases/latest, so the leg no longer needs the dispatch-only exclusion.

agy 1.2.x dropped gemini-3.5-flash-low from `agy models` in both auth
modes and rejects it with "invalid model selection"; the harness default
moves to gemini-3.8-flash-low and its test follows the constant.

Rewrite the #893 caveats in AGENT.md, agent-guide.md and e2e/README.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Entire-Checkpoint: 01M32SCKS6B1QYRNZY80FNQDFS
peyton-alt added a commit that referenced this pull request Sep 22, 2026
…kflow

e2e.yml gates every PR, and its antigravity leg fetched agy's `latest`
release, so a third-party regression in hook execution (the class #893 was)
would redden PRs that never touched Antigravity and burn the shared
GEMINI_API_KEY quota. Pin the version there and bump it deliberately after a
green dispatch; nightly-e2e.yml keeps `latest`, so an agy change under us
still surfaces in the job built to report it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Entire-Checkpoint: 01M34XPM7VX9KWVFXMW748CVT1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants