Skip to content

Don't fail setup on an agent whose CLI is missing - #1072

Open
dhh wants to merge 4 commits into
mainfrom
setup-skips-missing-agents
Open

dhh wants to merge 4 commits into
mainfrom
setup-skips-missing-agents

Conversation

@dhh

@dhh dhh commented Dec 5, 2026

Copy link
Copy Markdown
Member

On a machine with ~/.codex but no codex binary, basecamp auth login ended with "✗ AI coding agents need attention — run: basecamp doctor". Detection counted the home directory alone, so setup tried to install the Codex plugin, which can't work without the CLI.

  • A plugin agent (Claude Code, Codex) counts as detected only when its executable is on disk (AgentInfo.NeedsBinary, applied in harness.DetectedAgents). Setup, doctor, quickstart and the login nudge all ignore a leftover home directory. Shared-skill agents (Grok) still detect by their home directory, since their setup needs only the skill.
  • With no agent detected, setup still installs the shared ~/.agents/skills/basecamp skill and creates the directory if needed. Only a failed skill install is reported.
  • Tests that faked a plugin agent with a bare home directory now put a stub binary on PATH. New tests cover the leftover-home case and the zero-agent skill install.

bin/ci passes locally.

🤖 Generated with Claude Code

@dhh
dhh requested a review from a team as a code owner December 5, 2026 07:24
Copilot AI adaptive review requested due to automatic review settings December 5, 2026 07:24

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.

🟡 Changes recommended

When no agents are detected, shared-skill installation failures lose their filesystem error, leaving fast setup with a doctor referral that cannot diagnose the failure instead of actionable basecamp setup agents remediation.

1 open issue
What changed in this PR

This PR prevents missing plugin-agent executables from causing setup failures, while preserving shared-skill installation when no agents are detected.

Changes:

  • Require binaries when detecting Claude Code and Codex.
  • Install the shared skill when no agents are detected.
  • Add regression coverage and update detection documentation.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
internal/​harness/​codex.go Require the Codex executable for detection.
internal/​harness/​claude.go Require the Claude executable for detection.
internal/​harness/​agent.go Filter agents using NeedsBinary.
internal/​harness/​agent_test.go Test binary-dependent detection.
internal/​commands/​wizard_test.go Test shared-skill installation without agents.
internal/​commands/​wizard_agents.go Install the shared skill when no agents are detected.
internal/​commands/​setup_agents_test.go Add executable stubs and leftover-home coverage.
internal/​commands/​auth_test.go Verify login ignores leftover agent homes.
AGENTS.md Document detection and shared-skill behavior.

Review effort: Balanced (adaptive)

Comment thread internal/commands/wizard_agents.go Resolved
Copilot AI adaptive review requested due to automatic review settings December 5, 2026 07:37

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.

🟡 Changes recommended

Stale Claude plugin checks incorrectly flag setup when Claude is absent, and the shared-skill tests use the real user profile on Windows instead of the temporary home.

2 open issues
1 resolved since last review

Review effort: Balanced (adaptive)

Comment thread internal/commands/wizard_test.go Resolved
Comment thread internal/harness/agent.go
var detected []AgentInfo
for _, a := range snapshot {
if a.Detect != nil && a.Detect() {
if a.Detect != nil && a.Detect() && (!a.NeedsBinary || a.FindBinary == nil || a.FindBinary() != "") {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 1a37468: detectedAgentsReady and installDetectedAgents now look at stale entries only through staleClaudePlugins(agents), which returns none unless Claude Code is among the detected agents.

dhh and others added 3 commits December 5, 2026 09:47
A leftover ~/.codex or ~/.claude without the codex or claude binary made
setup try to install a plugin it never could, and login reported the AI
coding agents as needing attention. A plugin agent now counts as detected
only with its executable on disk (AgentInfo.NeedsBinary), so setup, doctor
and the login nudge leave it alone. Shared-skill agents still detect by
their home directory.

With no agent detected, setup still installs the shared ~/.agents skill,
creating the directory, so an agent installed later finds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failed skill install was reduced to "AI coding agents need attention —
run: basecamp doctor", but doctor checks the skill only once it exists, so
it had nothing to say. Fast setup also ran the install with its output
discarded. The outcome now keeps the install error, and fast setup prints
it with its own remedy, basecamp setup agents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A leftover ~/.claude with stale Basecamp entries but no claude binary
still made setup report needing attention whenever another agent was
detected, though doctor now skips Claude there. Setup now looks at those
entries only when Claude Code is among the detected agents. The shared-
skill tests isolate USERPROFILE too, so on Windows they install into the
temporary home rather than the real profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhh
dhh force-pushed the setup-skips-missing-agents branch from 76edeca to 1a37468 Compare December 5, 2026 08:52
Copilot AI adaptive review requested due to automatic review settings December 5, 2026 08:52
@github-actions github-actions Bot added commands CLI command implementations tests Tests (unit and e2e) docs labels Dec 5, 2026

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.

🟡 Changes recommended

Fallback binary detection still accepts directories and non-executable files, triggering unwanted plugin setup, while the Windows regression test can pass without exercising the regression because it uses the wrong home variable.

4 open issues

Review effort: Balanced (adaptive)

Comment thread internal/commands/auth_test.go Resolved
Comment thread internal/harness/agent.go
var detected []AgentInfo
for _, a := range snapshot {
if a.Detect != nil && a.Detect() {
if a.Detect != nil && a.Detect() && (!a.NeedsBinary || a.FindBinary == nil || a.FindBinary() != "") {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 8b5d4dd: FindClaudeBinary and FindCodexBinary resolve the ~/.local/bin fallback through exec.LookPath, with tests for a directory, a non-executable file and an executable there.

Both binary lookups accepted anything at ~/.local/bin/claude or codex by
os.Stat alone, so a directory or non-executable file there, with a
leftover home, still counted as an agent to set up. The fallback now goes
through exec.LookPath, as SkillAgent.FindBinary already does. The login
nudge's leftover-home test isolates USERPROFILE through emptyHome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI adaptive review requested due to automatic review settings December 5, 2026 09:05

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.

🟢 Approved

No active review issues are reported for the stale-agent detection and shared-skill installation changes.

2 open issues
2 resolved since last review

Review effort: Balanced (adaptive)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands CLI command implementations docs tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants