Skip to content

refactor(#2512): propagate discovery errors and address review findings#2519

Open
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/2512-refactor-config-review-findings
Open

refactor(#2512): propagate discovery errors and address review findings#2519
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/2512-refactor-config-review-findings

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Change discoverAgentSlugs and loadKnownSlugs to return errors instead of swallowing them. When DiscoverRemoteAgents fails with a transient error and no usable agents are found, the error is now propagated so callers can distinguish "no harness files exist" from "discovery failed."

runUninstall and runGitHubUninstall now abort when discovery errors with no slugs, preventing silent fallback to default naming that could orphan GitHub Apps after deleting the config repo.

Also: add ADR-0045 breadcrumb comments, tighten runGitHubUninstall variable declaration to short form, rename TestDiscoverAgentSlugs_HarnessFirst to TestDiscoverAgentSlugs_HarnessDiscovery, and add transient error tests for both discoverAgentSlugs and runUninstall.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Closes #2512

Post-script verification

  • Branch is not main/master (agent/2512-refactor-config-review-findings)
  • Secret scan passed (gitleaks — 619c19d688c0aa3c25af0be4fd8b07cbc8099241..HEAD)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

Change discoverAgentSlugs and loadKnownSlugs to return errors instead
of swallowing them. When DiscoverRemoteAgents fails with a transient
error and no usable agents are found, the error is now propagated so
callers can distinguish "no harness files exist" from "discovery failed."

runUninstall and runGitHubUninstall now abort when discovery errors
with no slugs, preventing silent fallback to default naming that could
orphan GitHub Apps after deleting the config repo.

Also: add ADR-0045 breadcrumb comments, tighten runGitHubUninstall
variable declaration to short form, rename TestDiscoverAgentSlugs_HarnessFirst
to TestDiscoverAgentSlugs_HarnessDiscovery, and add transient error
tests for both discoverAgentSlugs and runUninstall.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

E2E tests did not run

E2E tests run automatically for org/repo members and collaborators on pull requests.

For other contributors, a maintainer must add the ok-to-test label after the latest push.

See E2E testing guide for details.

@github-actions

Copy link
Copy Markdown

Site preview

Preview: https://f35c5660-site.fullsend-ai.workers.dev

Commit: 8c1efce280858486ec46ccac600a24021cbe2923

@fullsend-ai-review

fullsend-ai-review Bot commented Jun 22, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 4:24 PM UTC · Completed 4:36 PM UTC
Commit: 8c1efce · View workflow run →

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/cli/admin.go 69.23% 4 Missing ⚠️
internal/cli/github.go 33.33% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [error handling inconsistency] internal/cli/admin.go:2073 — In loadKnownSlugs, when DiscoverRemoteAgents returns both an error and agents (err != nil && len(agents) > 0), but none of those agents produce valid slugs (all filtered out by role/slug validation), the function returns (nil, nil) — swallowing the error. By contrast, discoverAgentSlugs in the same scenario falls through to its bottom if err != nil check and returns the wrapped error. The two functions have inconsistent behavior for this edge case: a partial error where the only readable agents happen to be invalid (missing role or slug) will be silently swallowed by loadKnownSlugs but propagated by discoverAgentSlugs.
    Remediation: Add an if err != nil { return nil, fmt.Errorf("harness discovery failed: %w", err) } check before the final return nil, nil in loadKnownSlugs, mirroring the pattern in discoverAgentSlugs.

Low

  • [documentation-comment-format] internal/cli/admin.go:2035 — The loadKnownSlugs doc comment has a stale trailing // config repo. line — a leftover from the original two-line comment that was not removed when the new multi-paragraph docstring was inserted above it.
  • [redundant logging] internal/cli/admin.go:1335 — When loadKnownSlugs encounters a transient error, the user sees two warnings: one inside loadKnownSlugs ("harness discovery: ...") and one from the caller in runAppSetup ("Could not discover known slugs: harness discovery failed: ..."), producing redundant nested output.
  • [error message format] internal/cli/admin.go:1611 — The fmt.Errorf in runUninstall places text after %w ("cannot discover agent slugs: %w; aborting uninstall to avoid orphaning apps"), producing an awkward triple-nested message. Functional but unusual.

Labels: PR modifies CLI install/uninstall slug discovery from harness wrapper files.

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment component/install CLI install and app setup component/harness Agent harness, config, and skills loading go Pull requests that update go code labels Jun 22, 2026
@ggallen

ggallen commented Jun 22, 2026

Copy link
Copy Markdown
Member

/fs-fix. Rebase to get the latest sources. Fix so the code coverage test passes. Then address all actionalble review issues as well, even low ones.

@ggallen

ggallen commented Jun 22, 2026

Copy link
Copy Markdown
Member

/fs-fix. Rebase to get the latest sources. Fix so the code coverage test passes. Then address all actionable review issues as well, even low ones.

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

Labels

component/harness Agent harness, config, and skills loading component/install CLI install and app setup go Pull requests that update go code requires-manual-review Review requires human judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(config): address review findings from ADR-0045 Phase 4 PR 3

1 participant