Skip to content

cli: register external agents in attach command#986

Merged
Soph merged 4 commits intomainfrom
soph/make-attach-external-agent-aware
Apr 20, 2026
Merged

cli: register external agents in attach command#986
Soph merged 4 commits intomainfrom
soph/make-attach-external-agent-aware

Conversation

@Soph
Copy link
Copy Markdown
Collaborator

@Soph Soph commented Apr 20, 2026

entire attach --agent <external-name> failed with "unknown agent" because external agent discovery runs in configure, rewind, resume, and the hook commands but not in attach. Discovery is now called before the --agent flag is resolved, matching rewind/resume.

Test plan:

  • entire attach <session-id> --agent pi no longer errors on the registry check (requires entire-agent-pi on PATH and external_agents enabled in settings)
  • go test ./cmd/entire/cli -run TestAttach still green

Note

Low Risk
Low risk: a small change that only triggers external agent discovery before resolving --agent, affecting CLI behavior but not core checkpoint or git mutation logic.

Overview
Fixes entire attach --agent <external-name> failing with "unknown agent" by running external agent discovery/registration in attach before the agent flag is resolved.

This also allows attach’s transcript auto-detection to consider externally provided agents when external_agents is enabled.

Reviewed by Cursor Bugbot for commit 0b9d29d. Configure here.

Without this, `entire attach --agent <external-name>` fails with
"unknown agent" because external agent discovery runs in configure,
rewind, resume, and the hook commands but not in attach. Call
external.DiscoverAndRegister before resolving the --agent flag, matching
the pattern used in rewind and resume.

Entire-Checkpoint: a61f264a9a07
Copilot AI review requested due to automatic review settings April 20, 2026 11:15
@Soph Soph requested a review from a team as a code owner April 20, 2026 11:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes entire attach --agent <external-name> failing with “unknown agent” by ensuring external agent plugins are discovered/registered during attach, aligning behavior with rewind/resume and hook commands.

Changes:

  • Import the external agent discovery package in attach.
  • Invoke external agent discovery before resolving the --agent flag.

Comment thread cmd/entire/cli/attach.go
Comment thread cmd/entire/cli/attach.go
Stop enumerating built-in agents in the attach help text — the list
went stale the moment external agents became supported. Point users at
'entire configure' for the authoritative list.

Add TestAttach_DiscoversExternalAgents, which stands up a fake
entire-agent-<name> on PATH, enables external_agents in settings, and
asserts that `attach --agent <external-name>` gets past the registry
check. Without the DiscoverAndRegister call, the test reports a
registry miss ("unknown agent"), so a future regression that removes
discovery from attach will fail loudly instead of silently reappearing.

Entire-Checkpoint: 21249c964d00
@Soph Soph force-pushed the soph/make-attach-external-agent-aware branch from fba8137 to 7662e6e Compare April 20, 2026 13:12
CI flagged `buildSummaryGenerator` for ireturn after the previous
commit accidentally stripped the `//nolint:ireturn` suppression. The
strip happened because a stale golangci-lint cache made nolintlint
think the directive was unused; `--fix` then removed it. A clean cache
reproduces no such strip.

Restoring the directive brings the branch back in line with main and
unblocks the PR. Cache-clean discipline is left as a follow-up decision.

Entire-Checkpoint: b8623c735c57
@Soph Soph enabled auto-merge April 20, 2026 14:05
@Soph Soph merged commit 50e5cd7 into main Apr 20, 2026
9 checks passed
@Soph Soph deleted the soph/make-attach-external-agent-aware branch April 20, 2026 14:08
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.

3 participants